Jenkins allows you to parameterize builds, but I can't figure out how to actually make use of it:
Say I would normally kick my Ant build off from the command-line like so:
ant -buildfile /path/to/my/build.xml -DpackageType=jar package
This would invoke the build.xml
's package
target, and make a property named packageType
available to it, with a value of jar
.
I'm assuming that in the screenshot above, the Name field is where I would specify packageType
, but what about the value?
war
, but have this Jenkins job pass in a value of jar
(to override the default). Thanks in advance!
Whenever the user configures a parameterised build in Jenkins, the parameter name is taken as an environment variable
The user can make use of such parameters using the environment variable.
For example, in your case if packageType is the parameter you want to pass,
then specify the name as packageType and value as war
You can use it in the script you required as %packageType%
(for Batch) or $packageType
(for shell)
After configuring the job, whenever you click the build now button, Jenkins prompts for the parameter
When you are using file Parameter, the uploaded file will be placed into the working directory
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.