JENKINS-55116 - Branch missing BranchJobProperty is unable to fix itself in a Multibranch pipeline - jenkins

When I restart Jenkins, randomly children jobs lose the config.xml, I have the last version of multibranch plugin. I tried everything even when I fix the branches manually it get lost again
Fix branches manually, upgrade plugins version

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:)

Scan multibranch now builds every (also unchanged) job

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.

Unable to understand scm sync pop up message on Jenkins

We are using Multi-branch pipeline Jenkins jobs with SCM sync
Configuration plugin installed. Since few days a warning is being popping up at the end of Jenkins console. Can anyone explain what it is trying to inform us.
Error: Delete jobs/wbe-middle-layer-inbound/branches/feature-LMS-4271-Release2.83lj1k
Here we in git we don't have branch feature-LMS-4271-Release2.83lj1k under wbe-middle-layer-inbound repo but having feature-LMS-4271-Release2.
Periodically the multi-branch pipeline job just scan your repo to determine if any of it's branches meet the criteria for a pipeline to be created for them. It also tells you the pipelines it deletes because the branch that it was matched to is no longer there. Could that be what you're seeing?

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.

Why did Jenkins forget about my job?

For posterity:
One of my Jenkins jobs disappeared after I upgraded some plugins.
I looked through the error log, and found that the Promoted Builds Plugin was failing while parsing the job config.
What went wrong?
It appears that the Promoted Builds Plugin release 2.9 broke in my scenario, which specified a promotion action to build a parameterized job. I removed the section of the job conf file pertaining to promoted builds, restarted Jenkins, and the job reappeared. Then I reconfigured the promotion action, and all seems fine.

Resources