How does the temporary variable of batch processing (Bat) in Jenkins become the global variable of Jenkins (Inject environment variables plugin)

  • As shown in the figure below: I have generated two local variables in the bat script inserted in ① (the variables will be destroyed after the bat script is executed), and my current requirement is that I will use these two in the following script or jenkins variables.
  • So variables can be saved to a temporary file through the echo command properties.properties.

insert image description here

  • After execution, this file will be generated under the execution path of the current Job properties.properties.
    insert image description here

  • Then in ②, inject environment variables, so that properties.propertiesthe key-value pairs in the file are registered as global variables of Jenkins

  • Then in ③, I create a bat command again, which can access the variables created in ①, if there is no step ②, it cannot be accessed.

insert image description here

Guess you like

Origin blog.csdn.net/qq_34414530/article/details/128618162