The contents of this paper are as follows:
Parameters used within the project
- Parameter creation
- Create a project
- Check in generalThis project is parameterized,
- Click“Add parameter”
- After selection, fill in the parameter name in the name and the parameter value in the option
By parameter type“Choice Parameter”Add as an example:
Step screenshot:



-
Parameter use
After parameter setting, you can use ${parameter name} to use the created parameter
- Add construction steps and selectExecute shell
- Enter command
echo ${param}
Step screenshot:


- implement
- Select build with parameters and select a parameter to start building.
- Viewing the console, you can see that the output content is the selected parameter value
Step screenshot:


Transfer of different project parameters
- Add configuration for item 1
- To transfer parameters, you need to install it firstParameterized Triggerplug-in unit.
- choiceTrigger parameterized build on other projects
- Projects to build content: fill in the name of the project to transfer parameters; Use properties from file fill in the file address written by the parameter.
- Add echo “paramtest = $param” > jenkinsparam Txt writes parameters to a file.
- Project II configuration
- Configure character parameters in the project, and the parameters are consistent with the parameter name in the written file.
- After completion, you can use the configured parameters in the command
be careful: the name of the triggered item in Item 1 should be consistent with the name of triggered item 2; The parameter name written should be consistent with the value of parameter configuration in Item 2.
Step screenshot:




