[JIRA] (JENKINS-58112) Triggering multibranch pipeline from jira-trigger-plugin

16 views
Skip to first unread message

wisen@ceilfors.com (JIRA)

unread,
Jun 22, 2019, 3:06:03 PM6/22/19
to jenkinsc...@googlegroups.com
Wisen Tanasa updated an issue
 
Jenkins / New Feature JENKINS-58112
Triggering multibranch pipeline from jira-trigger-plugin
Change By: Wisen Tanasa
Summary: Triggering mulibranch multibranch pipeline from jira-trigger-plugin
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

kshettihewa@gmail.com (JIRA)

unread,
Jun 22, 2019, 11:44:03 PM6/22/19
to jenkinsc...@googlegroups.com
hhkkss commented on New Feature JENKINS-58112
 
Re: Triggering multibranch pipeline from jira-trigger-plugin

My requirement is to trigger release branch as i would require continues delivery when the developers merged their code with the release branch. 

Lets say my pipeline must be triggered like below:

          Lets say I have Jira project named "Project1" and has issue ID named "Issue-1", so whenever, "Issue-1" comes to "Deploy in SIT" stage in my workflow, it must be sent an Webhook call to my Jenkins API and from there I should able to run the matching branch in my Multibranch pipeline job.

In my Jenkins pipeline, I have SCM checkout, Build, unit testing, packaging, SIT deployment, UAT deployment, PROD deployment.

Note, in my scenario I will deploy into SIT only from release branch and this can be continue to UAT and PROD deployments if the proper approval is there. but none of deployment triggers from development branch, instead, all development branch triggers will be stopped at unit testing stage as I have defined WHEN condition in Jenkinsfile for other stages after unit testing, which WHEN condition should match "BRANCH = release".

It would be nice to have "pattern matching feature" in Multibranch Job configuration so the we can put some branch pattern and allow to trigger any branch which matches that pattern.   

kshettihewa@gmail.com (JIRA)

unread,
Jun 23, 2019, 11:04:02 PM6/23/19
to jenkinsc...@googlegroups.com
hhkkss assigned an issue to hhkkss
 
Change By: hhkkss
Assignee: Wisen Tanasa hhkkss

wisen@ceilfors.com (JIRA)

unread,
Jun 24, 2019, 1:37:02 AM6/24/19
to jenkinsc...@googlegroups.com
Wisen Tanasa commented on New Feature JENKINS-58112
 
Re: Triggering multibranch pipeline from jira-trigger-plugin

Thanks for the detailed use case.

A pattern matching won't suffice as you might want to trigger different workflow to different branches i.e. "Deploy in SIT" for "release branch", "Deploy in UAT" for "uat branch" (example), etc.

Perhaps your best bet here is to get your branch triggered by an upstream project:

To be honest I'm not really sure if Multibranch job is really appropriate in your use case either, what I'm hearing is:

  • release branch: sit deployment, uat deployment, prod deployment
  • other branches: scm checkout, build, unit testing, packaging

It sounds like they are an entirely different jobs that sharing one Jenkinsfile might not be appopriate?

kshettihewa@gmail.com (JIRA)

unread,
Jun 24, 2019, 1:56:02 AM6/24/19
to jenkinsc...@googlegroups.com
hhkkss commented on New Feature JENKINS-58112

I agree with you on following points. but the thing is, in that case I have to create individual upstream projects for all my pipeline jobs. . or let me know if there is any workaround to manage from single upstream job.  

Perhaps your best bet here is to get your branch triggered by an upstream project:

 

Regarding the below comment, what I was trying to tell you is my pipeline is same for all the branches in the project. but it has WHEN condition's defined already. thus, deployment handle only from release branch. meaning, development branch is only to commit day to day changes. whenever, developers are ready to move the changes into SIT, then they have to merge the changes into release branch and then only entire pipeline is triggered. any triggers from development branch will not handle any deployment and it will run the build and unit testing only, so developers know that they do not have any compilation errors on the code.

 

its simply like below:

 

 { stage ('SIT Deployment'){
  when { branch 'release' } 
       steps {    
          script {"my deployment"
.....
 

 

To be honest I'm not really sure if Multibranch job is really appropriate in your use case either, what I'm hearing is:

  • release branch: sit deployment, uat deployment, prod deployment
  • other branches: scm checkout, build, unit testing, packaging

It sounds like they are an entirely different jobs that sharing one Jenkinsfile might not be appopriate?

kshettihewa@gmail.com (JIRA)

unread,
Jun 24, 2019, 1:57:02 AM6/24/19
to jenkinsc...@googlegroups.com
hhkkss edited a comment on New Feature JENKINS-58112
I agree with you on following {color:# FF0000 ff0000 }points{color}. but the thing is, in that case I have to create individual upstream projects for all my pipeline jobs projects . :(. or let me know if there is any workaround to manage from single upstream job.  

{color:#
FF0000 ff0000 }Perhaps your best bet here is to get your branch triggered by an upstream project:{color}
* {color:#
FF0000 ff0000 }deploy in uat job: configured with jira-trigger-plugin{color}
* {color:#
FF0000 ff0000 }multibranch pipeline job: configured with upstream trigger to "deploy in uat job" (see: [https://stackoverflow.com/questions/36825103/jenkins-trigger-multi-branch-pipeline-on-upstream-change]){color}

 

Regarding the {color:#ffab00}below 
{color:#172b4d} comment, what I was trying to tell you is my pipeline is same for all the branches in the project. but it has WHEN condition's defined already. thus, deployment handle only from release branch. meaning, development branch is only to commit day to day changes. whenever, developers are ready to move the changes into SIT, then they have to merge the changes into release branch and then only entire pipeline is triggered. any triggers from development branch will not handle any deployment and it will run the build and unit testing only, so developers know that they do not have any compilation errors on the code.{color} {color}


 


its simply like below:


 
{code:java}

{ stage ('SIT Deployment'){
  when { branch 'release' }
       steps {   
          script {"my deployment"
.....

{code}

 

{color:#ff8b00}

To be honest I'm not really sure if Multibranch job is really appropriate in your use case either, what I'm hearing is: {color}

 
* {color:#ff8b00}release branch: sit deployment, uat deployment, prod deployment{color}
* {color:#ff8b00}other branches: scm checkout, build, unit testing, packaging{color}

{color:#ff8b00}It sounds like they are an entirely different jobs that sharing one Jenkinsfile might not be appopriate?{color}

kshettihewa@gmail.com (JIRA)

unread,
Jun 24, 2019, 1:58:03 AM6/24/19
to jenkinsc...@googlegroups.com
hhkkss edited a comment on New Feature JENKINS-58112
I agree with you on following {color:#ff0000}points{color}. but the thing is, in that case I have to create individual upstream projects for all my pipeline projects. :(. or let me know if there is any workaround to manage from single upstream job.  

{color:#ff0000}Perhaps your best bet here is to get your branch triggered by an upstream project:{color}
* {color:#ff0000}deploy in uat job: configured with jira-trigger-plugin{color}
* {color:#ff0000}multibranch pipeline job: configured with upstream trigger to "deploy in uat job" (see: [https://stackoverflow.com/questions/36825103/jenkins-trigger-multi-branch-pipeline-on-upstream-change]){color}

 

Regarding the {color:#ffab00}below comment, what I was trying to tell you is my pipeline is same for all the branches in the project. but it has WHEN condition's defined already. thus, deployment handle only from release branch. meaning, development branch is only to commit day to day changes. whenever, developers are ready to move the changes into SIT, then they have to merge the changes into release branch and then only entire pipeline is triggered. any triggers from development branch will not handle any deployment and it will run the build and unit testing only, so developers know that they do not have any compilation errors on the code.{color}


 


its simply like below:


 
{code:java}
{ stage ('SIT Deployment'){
  when { branch 'release' }
       steps {   
          script {"my deployment"
.....

{code}

 


{color:#ff8b00}
To be honest I'm not really sure if Multibranch job is really appropriate in your use case either, what I'm hearing is: {color}

 
* {color:#ff8b00}release branch: sit deployment, uat deployment, prod deployment{color}
* {color:#ff8b00}other branches: scm checkout, build, unit testing, packaging{color}

{color:#ff8b00}It sounds like they are an entirely different jobs that sharing one Jenkinsfile might not be appopriate?{color}

kshettihewa@gmail.com (JIRA)

unread,
Jun 24, 2019, 1:59:02 AM6/24/19
to jenkinsc...@googlegroups.com
hhkkss edited a comment on New Feature JENKINS-58112
I agree with you on following {color:#ff0000}points{color}. but the thing is, in that case I have to create individual upstream projects for all my pipeline projects. :(. or let me know if there is any workaround to manage from single upstream job.  

{color:#ff0000}Perhaps your best bet here is to get your branch triggered by an upstream project:{color}
* {color:#ff0000}deploy in uat job: configured with jira-trigger-plugin{color}
* {color:#ff0000}multibranch pipeline job: configured with upstream trigger to "deploy in uat job" (see: [https://stackoverflow.com/questions/36825103/jenkins-trigger-multi-branch-pipeline-on-upstream-change]){color}

 

{color:#172b4d} Regarding the {color }{color :#ffab00} {color:#172b4d}{color:#ff8b00} below  {color} comment, what I was trying to tell you is my pipeline is same for all the branches in the project. but it has WHEN condition's defined already. thus, deployment handle only from release branch. meaning, development branch is only to commit day to day changes. whenever, developers are ready to move the changes into SIT, then they have to merge the changes into release branch and then only entire pipeline is triggered. any triggers from development branch will not handle any deployment and it will run the build and unit testing only, so developers know that they do not have any compilation errors on the code.{color} {color}

{color:#172b4d}   {color}

its simply like below:

 
{code:java}
{ stage ('SIT Deployment'){
  when { branch 'release' }
       steps {   
          script {"my deployment"
.....

{code}
 

{color:#ff8b00}To be honest I'm not really sure if Multibranch job is really appropriate in your use case either, what I'm hearing is:{color}

 
* {color:#ff8b00}release branch: sit deployment, uat deployment, prod deployment{color}
* {color:#ff8b00}other branches: scm checkout, build, unit testing, packaging{color}

{color:#ff8b00}It sounds like they are an entirely different jobs that sharing one Jenkinsfile might not be appopriate?{color}

wisen@ceilfors.com (JIRA)

unread,
Jun 24, 2019, 1:31:02 PM6/24/19
to jenkinsc...@googlegroups.com

I normally use job-dsl-plugin to manage all my jobs i.e. I won't have the pain of managing multiple jobs. Do check it out.

Alternatively, jira-trigger-plugin could support triggers DSL, but unfortunately I don't think I have the capacity to implement that at the moment. Feel free to contribute, the repository is community driven.

kshettihewa@gmail.com (JIRA)

unread,
Jun 25, 2019, 1:48:02 AM6/25/19
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages