Quantcast

BitBucket Plugin for Jenkins doesn't fire release pipeline job likely because release pipeline script not in SCM, how to trick it?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

BitBucket Plugin for Jenkins doesn't fire release pipeline job likely because release pipeline script not in SCM, how to trick it?

David Karr
My enterprise uses BitBucket Server and Jenkins.  For my project, I wrote a pipeline script that is fully parameterized, and can properly build PR branches, release branches, and the master branch.  Several condition checks do different things depending on what the branch is.

I store the Jenkinsfile on the master branch. There has never been a need to branch it for any release branch.

BitBucket has a "Pull Request Notification" feature that lets me fire the correct URL to run the pipeline on the PR branch.

BitBucket has a "BitBucket Plugin for Jenkins" that lets me specify the Jenkins URL, but that's about all the control I have.  If something changes in the repo, it "does some magic" to make Jenkins run the jobs associated with that branch.  The problem is, it's just not smart enough, and the protocol that BitBucket and Jenkins are using to decide what job to run is not transparent to me.

In Jenkins, the main pipeline job can be run with different branch parameters, so for each of our currently pending releases, I have a separate pipeline job with a very short script that just fires the main pipeline with the correct branch parameter.  I don't store this pipeline script in SCM, as it's only three lines long.

When someone merges a PR to a release branch in BitBucket, I want one of these release pipeline jobs to run, but this doesn't work, and I'm guessing this is the case because the release pipeline job doesn't specify any SCM settings.

Is there some way I can "trick" Jenkins into associating this release pipeline job with the particular SCM and branch, so the protocol between BitBucket and Jenkins will result in the proper job being fired?

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/cb258727-c03b-4c7f-a459-2864ce7b9b85%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: BitBucket Plugin for Jenkins doesn't fire release pipeline job likely because release pipeline script not in SCM, how to trick it?

Jennifer Hofmeister

This may be a bit late, but in case anyone else has a similar issue, I can offer some experience with “Webhook to Jenkins for Bitbucket”, which may be the one you’re referring to. I can’t find a plugin named “Bitbucket plugin for Jenkins” in the plugin store.

 

So what the Jenkins Webhook plugin does to find the matching Jenkins job for a given repository, is to browse your Jenkins base URL (entered in the first field) for a Job that has a certain Git configuration. The parameter it checks for is the address string in the SCM --> Git field in the Job configuration, and then it matches the string it finds there against the URL that is entered in the Bitbucket plugin’s second field. This is case-sensitive and absolutely strict, the strings must be identical. I don’t use pipeline jobs, but I can’t think of an obvious reason why this shouldn’t work the same way. (Not to say there couldn’t be a hidden reason;)… )

If you use SSH like me, choosing the “SSH” option in the plugin’s address field may not work. I haven’t found out why… but as a little workaround, just choose “Custom” and enter the exact same SSH address into the field.

 

Hope this helps someone.

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of David Karr
Sent: Freitag, 14. April 2017 19:19
To: Jenkins Users
Subject: BitBucket Plugin for Jenkins doesn't fire release pipeline job likely because release pipeline script not in SCM, how to trick it?

 

My enterprise uses BitBucket Server and Jenkins.  For my project, I wrote a pipeline script that is fully parameterized, and can properly build PR branches, release branches, and the master branch.  Several condition checks do different things depending on what the branch is.

I store the Jenkinsfile on the master branch. There has never been a need to branch it for any release branch.

BitBucket has a "Pull Request Notification" feature that lets me fire the correct URL to run the pipeline on the PR branch.

BitBucket has a "BitBucket Plugin for Jenkins" that lets me specify the Jenkins URL, but that's about all the control I have.  If something changes in the repo, it "does some magic" to make Jenkins run the jobs associated with that branch.  The problem is, it's just not smart enough, and the protocol that BitBucket and Jenkins are using to decide what job to run is not transparent to me.

In Jenkins, the main pipeline job can be run with different branch parameters, so for each of our currently pending releases, I have a separate pipeline job with a very short script that just fires the main pipeline with the correct branch parameter.  I don't store this pipeline script in SCM, as it's only three lines long.

When someone merges a PR to a release branch in BitBucket, I want one of these release pipeline jobs to run, but this doesn't work, and I'm guessing this is the case because the release pipeline job doesn't specify any SCM settings.

Is there some way I can "trick" Jenkins into associating this release pipeline job with the particular SCM and branch, so the protocol between BitBucket and Jenkins will result in the proper job being fired?

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/cb258727-c03b-4c7f-a459-2864ce7b9b85%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAA587D532C45541B62417404F1D22030E8CDE7E%40you-exch1.younicos.local.
For more options, visit https://groups.google.com/d/optout.
Loading...