Pipeline Multi-branch different options based on branch

693 views
Skip to first unread message

Mike Caspar

unread,
May 12, 2016, 7:24:46 PM5/12/16
to Jenkins Users

I am working on a pipeline that does Test/Deploy after a commit.

That's all cool!

However....When I create a branch (for a new feature), and it gets auto-launched as a new build pipeline, how do I prevent the same Jenkinsfile from initiating the Deploy step, since it's the same Jeniinsfile ?

Is there a standard way to do this ?

If not, I imagine I could only do Deploy if I'm on branch Master ?

Thoughts on how to do either of these two options ?

Mike





Richard Bywater

unread,
May 12, 2016, 9:57:42 PM5/12/16
to Jenkins Users
Haven't done it myself but there is the different Property Strategy in the multibranch config of "Named branches get different properties" - so presumably you could set (or unset) a property for certain branches and drive the decision to deploy off of that?

Richard.

--
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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/31a3041d-f943-4906-aa2c-ebcf9d54025d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mike Caspar

unread,
May 13, 2016, 9:10:24 AM5/13/16
to jenkins...@googlegroups.com
Looked for that option.

Repos are automatically scanned for Jenkiinsfile, then added (with their branches) to my Jenkins instance.

I can't find that option anywhere?

Could you point me to where I might find it ?  Sound like it might work.

Mike
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/4RQrbzi01II/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAMui946-iCDfT7v%2BJ3KYCTVSpMerbM14xbxEf%3DCMQmdXKeE5eg%40mail.gmail.com.

Nigel Magnay

unread,
May 13, 2016, 9:21:28 AM5/13/16
to jenkins...@googlegroups.com
What we do is look at what the branch name is in the Jenkinsfile itself.

I.E:

if( branchName.equals("master") )
{
   // deployment steps
}

Mike Caspar

unread,
May 13, 2016, 9:24:19 AM5/13/16
to jenkins...@googlegroups.com
Awesome.

Thanks !

Mike
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/4RQrbzi01II/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPYP83Q4ND6Dt4V_9yKAyCgcNO5rP1mDeWwDNa8%3DfnP9obozbg%40mail.gmail.com.

Richard Bywater

unread,
May 13, 2016, 6:29:40 PM5/13/16
to jenkins...@googlegroups.com
Odd - on my instance it's on the configuration page of the top level "folder" instance. (Sorry can't be more precise as it's Saturday so not in front of machine :) )

Richard 

Reply all
Reply to author
Forward
0 new messages