Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-55088

Jenkins Home config.xml reset upon restart

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I am using Jenkins 2.141 and am trying to configure the Jenkins oic-auth plugin.  However every time I restart my Jenkins server instance the config.xml file in reset.

      I've applied changes through the web interface and by manually updating the config.xml.  If I select "reload from disk" the changes will keep.  However, if I restart the Jenkins using the "<jenkinsurl>/restart"  or via systemd - systemctl restart command the file is reset.

      I've also tried changing something simple like setting "<denyAnonymousReadAccess>" to true.

      I need this configuration to be persistent.

        Attachments

          Activity

          Hide
          drodspike David Rodriguez added a comment - - edited

          Found my problem.  Our instance is using the configuration-as-code plugin (CASC) that's used to configure Jenkins. 

          When modifying the jenkins configuration or adding a job through the GUI,  the JENKINS_HOME/config.xml is correctly updated  but the CASC_JENKINS_CONFIG/jenkins.yaml file, used to configure jenkins,  is NOT updated with the change.  So when jenkins is restarted, the configuration-as-code plugin uses the CASC/jenkins.yaml  file to configure jenkins which DOES NOT have the change.

          So the configuration-as-code plugins is the culprit.  If the changes are manually added to the CASC/jenkins.yaml  file and then jenkins is restarted, the change persist.

          Also note that when I removed the CASC plugin, modify the configuration through the GUI and then did a restart, the change persisted.

          Is it possible whenever the jenkins configuration is modified through the GUI, that both JENKINS_HOME/config.xml and the CASC/jenkins.yaml are updated with the change?  Or the plugin has to do this?

           

          Show
          drodspike David Rodriguez added a comment - - edited Found my problem.  Our instance is using the configuration-as-code plugin ( CASC)  that's used to configure Jenkins.  https://plugins.jenkins.io/configuration-as-code/ When modifying the jenkins configuration or adding a job through the GUI,  the JENKINS_HOME/config.xml is correctly updated  but the CASC_JENKINS_CONFIG/jenkins.yaml file, used to configure jenkins,  is NOT updated with the change.  So when jenkins is restarted, the configuration-as-code plugin uses the  CASC/jenkins.yaml   file to configure jenkins which DOES NOT have the change. So the configuration-as-code plugins is the culprit.  If the changes are manually added to the CASC/jenkins.yaml   file and then jenkins is restarted, the change persist. Also note that when I removed the CASC plugin , modify the configuration through the GUI and then did a restart, the change persisted. Is it possible whenever the jenkins configuration is modified through the GUI, that both  JENKINS_HOME/config.xml  and the  CASC/jenkins.yaml  are updated with the change?  Or the plugin has to do this?  
          Hide
          batmat Baptiste Mathus added a comment -

          What you're talking about ends up being unrelated to the filed bug I believe. I recommend you raise it to the JCasC channels/team: cf. https://www.jenkins.io/projects/jcasc/ for various entrypoints.

           

          Show
          batmat Baptiste Mathus added a comment - What you're talking about ends up being unrelated to the filed bug I believe. I recommend you raise it to the JCasC channels/team: cf. https://www.jenkins.io/projects/jcasc/ for various entrypoints.  
          Hide
          drodspike David Rodriguez added a comment -

          Agree. Thanks for your response.

          Show
          drodspike David Rodriguez added a comment - Agree. Thanks for your response.
          Hide
          pbogapur Prashant B added a comment -

          Baptiste Mathus,

          Hey i do not use CASC plugin to configure AD auth. instead i'm using groovy script to configure authentication and authorization. but upon relaunch or re initiating master, previous config is getting wiped out. thus i end up fixing them manually. is there any way i can stop jenkins to set authorization to "FullControlOnceLoggedInAuthorizationStrategy()" upon relaunch. 

          Show
          pbogapur Prashant B added a comment - Baptiste Mathus , Hey i do not use CASC plugin to configure AD auth. instead i'm using groovy script to configure authentication and authorization. but upon relaunch or re initiating master, previous config is getting wiped out. thus i end up fixing them manually. is there any way i can stop jenkins to set authorization to " FullControlOnceLoggedInAuthorizationStrategy() " upon relaunch. 
          Hide
          roberthorne Robert Horne added a comment -

           I may have found a solution if you are in a similar edge case to me:

          I found that on my instance of Jenkins (running on docker, although I think this is irrelevant) had an initialization script.

          Under the $JEKINS_HOME / init.groovy.d directory: security.groovy.

          This file was forcing a security realm strategy and other security settings like authorization strategy.

           

           

          Perhaps check that out, hope it helps!

          Show
          roberthorne Robert Horne added a comment -  I may have found a solution if you are in a similar edge case to me: I found that on my instance of Jenkins (running on docker, although I think this is irrelevant) had an initialization script . Under the $JEKINS_HOME  / init.groovy.d directory: security.groovy . This file was forcing a security realm strategy and other security settings like authorization strategy.     Perhaps check that out, hope it helps!

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            wand3r3r Michael Schneider
            Votes:
            5 Vote for this issue
            Watchers:
            17 Start watching this issue

              Dates

              Created:
              Updated: