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 jenkinsci-users+unsubscr...@googlegroups.com.
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 via email to