Scan multibranch now builds every (also unchanged) job - jenkins

We have setup multiple multibranch pipeline projects. When clicking on the button 'Scan Multibranch Pipeline Now' all jobs are triggered and built again. It does not matter whether or not there are changes, every job will just start building.
When everything is build and manually scan again, it works as expected and only changed jobs are built.
Running on Jenkins 2.164.2.
Changes detected: master (null -> b95ffd48bf9fd032004e150ae4188cf48d3c28b2)
Scheduled build for branch: master
We expect only the changed branches will be built again.

We ran into the same issue some time ago, but then I found this issue:
https://issues.jenkins-ci.org/browse/JENKINS-57588
Can you check if you have the same version of that plugin (Branch API 2.5.0) running in your Jenkins instance?
Upgrading Branch API plugin the newest version 2.5.2 (already fixed in 2.5.1) fixed the problem.

Related

Branch disabled in multibranch pipeline and reopened with Scan event

We have one project configured as multibranch pipeline project with branch filtered master and development. After few hours the master branch is disabled with a strikethrough symbol across its name and build option not available .
When clicked on "Scan Multibranch Pipeline", it enabled the branch and pipeline logs show "Branch ReOpened".
Initially we assumed it would be because of Option "Exclude branches included in pull request" but enabling "All branches" too is disabling the master branch time and time again.
Pipeline Logs are not providing any clear indication of whats happening causing it to disable .Please help .
Old topic but I faced the same error today but the solution was different.
The error was in the configuration of branch discovery
Discover branches > Strategy. I was using Exclude branches that are also filed as PRs
And there was a PR targeting this branch. Change for All branches did the trick.
This looks like a bug to me. First I'll go to http://[jenkins]/log/all to see if there are any interesting logs there, then I would open an issue on https://issues.jenkins.io/secure/Dashboard.jspa
Also this issue might be happening after a recent upgrade of jenkins plugins or jenkins itself, I would downgrade everything to try to get my jenkins back to the way it was, then upgrade the plugins one by one or few by few to try to isolate what is causing the issue.
Finally, if you have jobdsl scripts, I would check these scripts to see if there is not a script that when executed is recreating the job and overrides the disabled status
Not sure if you're using Bitbucket Branch Source plugin for hook on Jenkins, but I had the same issue on 737.vdf9dc06105be version. Everytime I pushed a change to branch (not pull request) it got disabled (strikethrough). Scan multibranch pipeline was restoring it until next push notification on webhook was performed.
Upgrading the plugin to 751.vda_24678a_f781 version resolved the issues:)

Jenkins multi-branch pipeline missing a branch

I have a Jenkins system. It runs build jobs for our company. We run multibranch pipelines. Yesterday one of the builds mysteriously dropped the devel branch from the build.
I looked through the Pull Requests for the branch and I can not find anything that affected by the Jenkins file in the time frame where this branch drop occurred.
I have looked through the Jenkins system log and I do not see any errors. Here is a copy of the relevant parts of the scan repository log:
Examining Bo**a/pro-***-ter
Checking branches...
Getting remote branches...
Checking branch devel
Getting remote pull requests...
Checking branch master
‘Jenkinsfile’ found
Met criteria
I have validated that the devel branch has a Jenkinsfile and that the Jenkinsfile is valid.
I can't figure out how to solve this. Any suggestions would be great.
Some plugin information:
github 1.28.0
branch 2.0.11
docker-common 1.13
docker-pipeline 1.17
git 3.6.0
git client 2.7.0
git server 1.7
SCM API 2.2.3
Jenkins version 2.73.2
I had this same problem with BitBucket Server and Jenkins when using Blue Ocean (BitBucket Server plugins). The branch would not create in Jenkins. I noticed that the branch commit and the pull request (PR) had a successful build. It seems that if Jenkins detects a PR is opened for a branch, it will not create the branch on the Jenkins side. Once I deleted the pull request from BitBucket Server, Jenkins registered the branch and it showed up. Would be better if the branch showed up, had no builds and referenced the Pull request Jenkins job!
Sorry for taking so long to answer this:
I did a plugin upgrade to the latest version of all of the plugins in my Jenkins.
That solved my issue.
I think we might found an answer (or problem causer).
In our case we automatically restarted Jenkins once a day in either in the shut down or boot up process branches went missing.
The amount of missing branches declined significantly after keeping the Jenkins running all the time.
Detected unsupported subitem repo » develop, skipping
In my case I just deleted the develop pipeline(by clicking its link on scan branch log page) and rescan, all worked.
It seems while performing scan it probably point to an obsolete hash in Git preventing Jenkins job to scan correctly.

How to build tagged version commit on Jenkins using researchgate/gradle-release

I am using Jenkins, which is the only one allowed to publish to our maven repository, and gradle-release plugin to tag a version and move to new snapshot version. I noticed the tagged version wasn't getting built because the push happens after the new snapshot version is committed -- hence Jenkins builds the new snapshot version and skips the tagged version. Is there a way to configure the gradle-release plugin to first do a push after the tagged version and then do another push for the new snapshot version?
I looked into the source code of the plugin and installed it locally to see how it works. It turns out that the createReleaseTag task and commitNewVersion tasks actually perform separate pushes. I also checked the commits and found that they had different timestamps. I reckon that while our GitLab may have fired two calls to the Jenkins webhook, the short time in between the two commits is insignificant that by the time Jenkins pulls the changes for the one triggered by createReleaseTag, the newer commit created by commitNewVersion will have already been pulled along.
The solution I have in my mind now is to either create separate Jenkins jobs for the branches and tags, or to introduce some time delay in between createReleaseTag and commitNewVersion.
Update Jan 12, 2017
I settled on using the https://wiki.jenkins-ci.org/display/JENKINS/Release+Plugin where the Jenkins job pulled from both master and develop branches. The Jenkins release plugin added a Release page where the release version and next snapshot version can be inputted and submitted to do the ff:
Check out master
Run default job (which should run tests)
Run release task
Check out new tagged version
Run publish task

Jenkins master holding back slave results

There are five jobs in sequential order(1,2,3,4,5). Jobs 2,3,4,5 are built successfully(but they have not come out of the execution shell), since the job 1 is still compiling. If I abort job 1 then all the results of 2,3,4,5 are updated spontaneously to gerrit.
How can I change this configuration in Jenkins master?
This is a known bug in the Jenkins mailer plugin, you need to upgrade the plugin to the latest version.
Here you can find more details:
Github - [FIXED JENKINS-20867] Never wait for a prior build to
complete merely
Jenkins - Sending mail blocks on prior build

Jenkins schedules 3 builds on first build

I am creating a build that has 3 (sub builds) using the Parameterized Trigger Plugin to fire the builds I need built in a specific order.
The main build is using the Jenkins GIT plugin to monitor the repos I need so it can be triggered by a push to the branch I've declared.
The thing is, when I create the build at first (This is done through autojenkins) and trigger it to build, it builds but then in the middle of the first build a second build is scheduled and in the middle of the seconds build a third build is then scheduled, effectively building the same project 3 times in a row, although there has been no changes to the repos.
The reasons for build 2 and 3 are the same: Started by an SCM change but there is nothing to see in the polling log.
Can this behaviour be explained somehow?
Any help is greatly appreciated!
Here's some info on Jenkins:
Jenkins v 1.529 running on Ubuntu 12.04 on Amazon
Jenkins GIT plugin v 1.5.0
Parameterized Trigger Plugin v 2.20

Resources