Why did Jenkins forget about my job? - jenkins

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.

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 BlueOcean stuck at "Pipeline Creation Pending."

My pipeline creation is stuck at pending stage on Jenkins server. Nothing shows up on dashboard even after an hour. Tried multiple times but no luck.
When I try from my local Jenkins, it easily creates the pipeline for the same Git repository.
Solved this by updating Git API and Blueocean plugins in Jenkins to the latest version.

Jenkins missing Build Trigger section after upgrade

I've upgraded Jenkins version (now on 2.127) and plugins and now the UI of job configuration is different and I am missing the build triggers section, especially the Trigger Builds Remotely via authentication token. Where is it? Do I need to enable it explicitly? The changelog unfortunately does not mention anything about that and I even can't schedule builds periodically.
Finally found out: It seems that since the update, the Multibranch Pipeline does no longer have this section. So either choose Pipeline or set it in the Jenkinsfile via: https://github.com/jenkins-infra/jenkins.io/blob/c0828af5b8bd428815e23537c808cd0267017013/Jenkinsfile#L6
The webhook works without a token with the Generic Webhook Plugin.

Jenkinsfile not getting updated in jenkins workspace even though Git is updated

I am using Jenkins 2.73.2 with Blue ocean 1.3.1 in the Linux Redhat. I wanted to build maven project located at GitHub repository. I have created a JenkinsFile for a blue ocean pipeline and recently updated it with some changes which were saved successfully on GitHub repository. But when I am running the pipeline again it is still running the old JenkinsFile.
So I checked the workspace of Jenkins and found that the folder for that pipeline was not updated and has old JenkinsFile which is causing this issue. Now I am stuck and don't know where did I go wrong or what I have missed in configuration/settings?
As susmit says in a comment,
This issue got resolved when I used the option available in the jobs where we can clear the workspace before running any jobs.
to avoid this problem you can use the option "Clear Workspace before running job" available in the jobs parameters.

Jenkins deleting latest build when SCM polling is configured

I have a maven jenkins job which builds to a directory called 'build.x86_64'. All of the artifacts are built to this directory. For some reason if I enable SCM polling, this directory gets deleted after the build completes. I can't see anything in the console output which says it is deleting the target.
Jenkins does however keep the build artifacts in it's own configured directory
/var/lib/jenkins/jobs/[my job]/builds
I have a downstream job which needs the artifacts but they keep getting deleting.
If I turn off SCM polling and use the 'Build Now' option in the GUI, it doesn't delete the build directory. I can' see anything in the configuration which could cause this. The jenkins job is cloned from one with the same configuration. The problem does not occur in the job I cloned from.
This was caused by the misconfiguration of the Source Code Management section of the Jenkins config. Under the Additional Behaviours section I had added, Clean before checkout. It should have been set to Clean after checkout.

Resources