5

I am running Jenkins version 2.85 on Kubernetes as pod(Affinity set to one workernode). I am creating Jobs using Salt Jenkins module by passing XML to this module.

I am using Jenkins Global Library for preforming job execution.

My Job config looks like thisenter image description here enter image description hereenter image description here

I am calling GobalLibrary with my parameters like repoURL, componet etc..,

Things goes well for weeks and now I landed to a weird situation where my job configurations(config.xml) gets updated/revert automatically.

Intermittently my "Build with parameter" options disappears and I can see only "Build now" in Jenkins GUI. Initially I thought someone is doing this, so to track the config changes I installed Job config history plugin in Jenkins and what I find is strange. Someone with "SYSTEM" username is making/reverting changes.

This is how it looks

enter image description here

and what I find is SYSTEM user revert only JOB config changes, not the PIPELINE.

enter image description here enter image description here

I am not sure what's going wrong behind the scenes and how to stop or fix this. This is my Production instance so I am more worried.

I can see a SYSTEM user in my Jenkins

enter image description here

but I can not delete that user

enter image description here

Few relevant Question I find for this but with no answers

Configuration of Jobs getting updated by System user on Jenkins

Jenkins SYSTEM user removes custom workspace configuration

I am not sure if this Jenkins Bug or some plugin is playing with my soul.

Need help! :(

Vaibhav Jain
  • 2,155
  • 5
  • 27
  • 41
  • Issue created on Jenkins: JENKINS-51160 - SYSTEM user changing/reverting configurations of Parameterised job used with Jenkins Global pipeline library – Vaibhav Jain May 06 '18 at 14:48

3 Answers3

3

Okay I find the answer to this problem.

I have used properties in my Jekins Global Library something like this

// Disable concurrent builds
//properties([disableConcurrentBuilds()])

which overrides my external job configuration(done via salt).

Hint I get from this blog: https://st-g.de/2016/12/parametrized-jenkins-pipelines

Vaibhav Jain
  • 2,155
  • 5
  • 27
  • 41
0

I also had this problem. For me it was solved when I changed the Build triggers -> Build Periodically settings from 'H 23 * * *' to '00 23 * * *'. (As I want my build to execute every night at 23:00.) Where H lets Jenkins decide when to run the job somewhere between 23:00 and 23:59 to spread load evenly. It seems Jenkins sometimes decided that it would be best to run my job on a different server and changed the parameters automatically.

Nex
  • 17
  • 3
0

In my case the issue was that the Jenkinsfile was removing the parameters I added to the pipeline from Jenkins console. Adding the same parameters in the JenkinSfile (stage -> script -> properties -> parameters) solved the issue.

In a nutshell, make sure that your Pipeline script is using the same configuration that your pipeline uses.

Jenkins documentation on parameters: https://www.jenkins.io/doc/book/pipeline/syntax/#parameters