Parameterized option in multibranch pipeline job

8,062 views
Skip to first unread message

ajith arthur

unread,
Jun 23, 2017, 10:22:22 PM6/23/17
to Jenkins Users

Hi Guys,

 

I have a Jenkins multibranch pipeline job, which always configure build without parameter at branch initialization, but I need to configure the branches as build with parameter.

 

We can use properties to configure the parameters in a Jenkinsfile, but my question is how to configure parameterized option in Jenkins multibranch pipeline project from website, not from Jenkinsfile?

 

Please refer the below report for further details.

 

https://issues.jenkins-ci.org/browse/JENKINS-45102

 

Regards,

Ajith R

Lee Meador

unread,
Jun 28, 2017, 6:53:40 PM6/28/17
to jenkins...@googlegroups.com
Since the multibranch pipeline job creates sub-jobs for each branch, there is no place to set the options for those generated jobs except the Jenkinsfile. 

Jenkins creates the sub-jobs when the multibranch pipeline job runs (on its schedule or whatever as configured). It starts any new ones building right away and the properties step at the top of the Jenkins file will then set the options on the generated job. 

If you change the Jenkinsfile properties step to have different options, it will only apply after the sub-job builds once. This applies to each branch's sub-job independently.

You can view some of the options that the properties step can set by clicking "View Configuration" on the sub-job for a particular branch. But there are many more things that get set.

If you go to this page https://jenkins.io/doc/pipeline/steps/workflow-multibranch/ but, unless you are a better puzzle solver than me, you will be unable to read the list of optional things you can put in that list that serves as the single parameter to the pipeline step. Its huge.

When the properties step runs, it also clears away any existing properties on the sub-job before setting the ones specified in the list. Not all of the things it clears are visible on that "View Configuration" page.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/7432e9e5-a3c1-4418-8141-4609cd7dfa6b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
-- Lee Meador
Sent from gmail. My real email address is lee AT leemeador.com

Abir M

unread,
Jul 2, 2017, 10:34:47 AM7/2/17
to Jenkins Users
I am not sure I quire understand but:

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.

how to configure parameterized option in Jenkins multibranch pipeline project from website

You cannot. If you are using Jenkinsfile and multibranch pipeline you have to set all properties including parameters in the Jenkinsfile using the properties step. I think by website you mean the configuration page at <JOB URL>/configure. For multibranch pipelines, this page is effectively read only. Unfortunately this isn't very clear from the UI.

If it's just a matter of adding parameters, just use the syntax generator and copy the code into your Jenkinsfile.

ajith arthur

unread,
Jul 3, 2017, 12:40:04 PM7/3/17
to Jenkins Users
Thanks for the reply. I know, I already configured the parameters via properties of jenkinsfile. The problem is, its not get parameterized for the very first build. I suppress all branch scm trigger and I am manually triggering the builds from webhook, so I can't pass the first build with parameters. Once first build triggered without parameter, it can be parameterized from the second build. 

Lee Meador

unread,
Jul 3, 2017, 1:43:48 PM7/3/17
to jenkins...@googlegroups.com
Yep. That's how it works. Remember, the script can't set anything before it runs. When it runs, it builds. That's why lines of code in the script have no effect before you do a build. And changes to a script have no effect before you build. The effect of a properties statement is to change the build settings including some in the UI.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

ajith arthur

unread,
Jul 3, 2017, 2:26:13 PM7/3/17
to jenkins...@googlegroups.com
Okay, so I have to run the first build without parameter. 

Is there any option to trigger the build without parameter at branch initialization alone? I have set suppress automatic scm trigger in my multibranch pipeline settings for all branches. So it doesn't trigger the build for branch creation too. 

If it allows to build at branch initialization alone, then I can trigger further builds with parameters from webhook. 

You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/XqaCMb4Hjyk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAA4vtDRYmmv8cAJ8g%3DHStCFHtwtTTEUXX3m3k4C%3DuxUCqVpEoQ%40mail.gmail.com.

ZillaYT

unread,
Dec 23, 2018, 2:01:04 PM12/23/18
to Jenkins Users
Is there a fix for the disappearing "Build with parameters" link on a multi-branch pipeline? In my case, when a job fails, I see the link but when a job succeeds, the link disappears.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.



--
-- Lee Meador
Sent from gmail. My real email address is lee AT leemeador.com

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/XqaCMb4Hjyk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-use...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages