Jenkins will not build after Git merge
I'm working on a DevOps solution that includes SQL Change Automation, Git, and Jenkins, but I can’t seem to get Git to reliably trigger a Jenkins build when doing a Git merge.
In Git, I have three “environment” branches (test, staging, master) plus a “feature” branch named feature1.
If I commit a change to feature1, a build is triggered.
If I then merge feature1 into another branch (e.g. test), GitHub does a push to Jenkins (I can see this in the GitHub Hook Log), but no build is triggered because Jenkins (or Git, not sure which) doesn’t think there were any changes:
Best Answer
-
tomslickers Posts: 40 Bronze 2This was solved using Jenkins multi-branch pipelines. Any Git branch will build now when a push or merge is done, and I only need one Jenkins project for each database.
Answers
In Jenkins go to the job and go to job configuration.
Once there find the Source Code Management under additional behaviors add a Calculate Changelog against a specific branch.
Then enter the names of the repos and branch.
This forces the comparison.
https://stackoverflow.com/questions/19283187/jenkins-does-not-build-branch-after-merging-with-another-one
https://github.community/t5/How-to-use-Git-and-GitHub/Trigger-Jenkins-job-when-a-pull-request-is-merged-to-a-branch/td-p/10190
https://stackoverflow.com/questions/41660240/jenkins-wont-trigger-build-after-merging-a-pull-request-in-githubThe only thing I can think of is create four Jenkins projects for each database; one to build the feature branches, and one each for Test/Staging/Production. This is not ideal because I have about 25 databases to deal with, but it would largely be a one-time setup.
I don't quite understand the Jenkins multi-branch pipelines but that might a more compact way to this.