I have a Jenkins multibranch item and several branches where the Jenkins pipeline file is. I also have several common parameters which are actual for every of those branches (like test Groups to run, selenium properties etc.)
How can I define the set of those parameters in Jenkins interface so they will appear for each run of branch so that each new branch automatically becomes as "Parameterized build"? I can see this flag in the configuration of particular branch build (can't save it, though):
But not in the multibranch item's configuration.
Jenkins 2.89.3
If you want to add new parameters you have to do it using properties in Jenkinsfile - goto <JENKINS URL>/pipeline-syntax and generate code for the properties step.
Step 1: From the Jenkins home page create a “new item”. Step 2: Select the “Multibranch pipeline” from the option and click ok. Step 3: Click “Add a Source” and select Github. Step 4: Under the credentials field, select Jenkins, and create a credential with your Github username and password.
The Multibranch Pipeline project type enables you to implement different Jenkinsfiles for different branches of the same project.
I just needed to define them in properties step in the pipeline...
properties([
parameters([
string(name: 'one', defaultValue: ''),
string(name: 'second', defaultValue: ''),
string(name: 'third', defaultValue: ''),
])
])
It's a magic! :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With