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

Build environment not persisting for jobs on restart

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • Jenkins: v2.73
      Job Configuration History Plugin: v2.16
      Master OS: Amazon Linux AMI release 2017.03
      Slave OS: Amazon Linux AMI release 2017.09

      When I restart my Jenkins master server I have noticed that the Build Environment config for any jobs that have had that section updated since the last restart disappear, such as pre-SCM buildsteps and Artifactory dependency resolution. 

      I've tagged the Job Config History plugin as I've been using it to track the history of the files and whether the lost config can be easily restored, but bizarrely the config in question is nowhere to be found in any of those previous versions despite it being added and saved successfully before the last restart. 

      This appears to affect multiple project types; I've observed it in both Maven and Freestyle jobs.

       

       

          [JENKINS-48755] Build environment not persisting for jobs on restart

          Leo Brookes created issue -
          Leo Brookes made changes -
          Summary Original: On restart, build environment is lost for jobs New: Build environment not persisting for jobs on restart

          Oleg Nenashev added a comment -
          • Is there anything in System Logs when you try to save the job?
          • Do you see the sections in the Job's config.xml before the restart?
          • Do you see the sections in the Job's config.xml after the restart?
            *

          Oleg Nenashev added a comment - Is there anything in System Logs when you try to save the job? Do you see the sections in the Job's config.xml before the restart? Do you see the sections in the Job's config.xml after the restart? *
          Leo Brookes made changes -
          Description Original: When I restart my Jenkins master server I have noticed that the Build Environment config for any jobs that have had that section updated since the last restart disappear, such as pre-SCM buildsteps and Artifactory dependency resolution. I am aware that Jenkins runs a "reload configuration from disk" on restart which may explain why the configuration isn't persisted.

          I've tagged the Job Config History plugin as I've been using it to track the history of the files and whether the lost config can be easily restored, but bizarrely the config in question is nowhere to be found in any of those previous versions despite it being added and saved successfully before the last restart.

          This appears to affect multiple project types; I've observed it in both Maven and Freestyle jobs.

           

           
          New: When I restart my Jenkins master server I have noticed that the Build Environment config for any jobs that have had that section updated since the last restart disappear, such as pre-SCM buildsteps and Artifactory dependency resolution. I am aware that Jenkins runs a "reload configuration from disk" on restart which explains why the configuration isn't persisted.

          I've tagged the Job Config History plugin as I've been using it to track the history of the files and whether the lost config can be easily restored, but bizarrely the config in question is nowhere to be found in any of those previous versions despite it being added and saved successfully before the last restart. This leads me to believe that Jenkins is not saving 

          This appears to affect multiple project types; I've observed it in both Maven and Freestyle jobs.

           

           
          Leo Brookes made changes -
          Description Original: When I restart my Jenkins master server I have noticed that the Build Environment config for any jobs that have had that section updated since the last restart disappear, such as pre-SCM buildsteps and Artifactory dependency resolution. I am aware that Jenkins runs a "reload configuration from disk" on restart which explains why the configuration isn't persisted.

          I've tagged the Job Config History plugin as I've been using it to track the history of the files and whether the lost config can be easily restored, but bizarrely the config in question is nowhere to be found in any of those previous versions despite it being added and saved successfully before the last restart. This leads me to believe that Jenkins is not saving 

          This appears to affect multiple project types; I've observed it in both Maven and Freestyle jobs.

           

           
          New: When I restart my Jenkins master server I have noticed that the Build Environment config for any jobs that have had that section updated since the last restart disappear, such as pre-SCM buildsteps and Artifactory dependency resolution. I am aware that Jenkins runs a "reload configuration from disk" on restart which explains why the configuration isn't persisted.

          -I've tagged the Job Config History plugin as I've been using it to track the history of the files and whether the lost config can be easily restored, but bizarrely the config in question is nowhere to be found in any of those previous versions despite it being added and saved successfully before the last restart.- 

          This appears to affect multiple project types; I've observed it in both Maven and Freestyle jobs.

           

           

          Leo Brookes added a comment - - edited

          oleg_nenashev, please find my comments below:

          • No, nothing is output to the system log when the job is saved. What I do see, on Jenkins startup, is the following:
            INFO: Migrating project "<project name here>" with type hudson.model.FreeStyleProject
            Jan 02, 2018 12:24:13 PM jenkins.plugins.slack.config.AbstractProjectConfigMigrator migrate
            INFO: Configuration is already up to date for "<project name here>", skipping migration
            

            From what I understand from reading the source code, jenkins.plugins.slack.config.AbstractProjectConfigMigrator has no bearing over the build environment, so I don't believe this is related (and obviously since it's the Slack plugin).

          • The job configuration is persisting to config.xml before and after the restart from what I can see, just not appearing in the GUI view - I have just tested this by adding the configuration. I initially thought this wasn't the case but I have corrected the issue description.

          Leo Brookes added a comment - - edited oleg_nenashev , please find my comments below: No, nothing is output to the system log when the job is saved. What I do see, on Jenkins startup, is the following: INFO: Migrating project "<project name here>" with type hudson.model.FreeStyleProject Jan 02, 2018 12:24:13 PM jenkins.plugins.slack.config.AbstractProjectConfigMigrator migrate INFO: Configuration is already up to date for "<project name here>" , skipping migration From what I understand from reading the source code, jenkins.plugins.slack.config.AbstractProjectConfigMigrator has no bearing over the build environment, so I don't believe this is related (and obviously since it's the Slack plugin). The job configuration is persisting to config.xml before and after the restart from what I can see, just not appearing in the GUI view - I have just tested this by adding the configuration. I initially thought this wasn't the case but I have corrected the issue description.
          Leo Brookes made changes -
          Description Original: When I restart my Jenkins master server I have noticed that the Build Environment config for any jobs that have had that section updated since the last restart disappear, such as pre-SCM buildsteps and Artifactory dependency resolution. I am aware that Jenkins runs a "reload configuration from disk" on restart which explains why the configuration isn't persisted.

          -I've tagged the Job Config History plugin as I've been using it to track the history of the files and whether the lost config can be easily restored, but bizarrely the config in question is nowhere to be found in any of those previous versions despite it being added and saved successfully before the last restart.- 

          This appears to affect multiple project types; I've observed it in both Maven and Freestyle jobs.

           

           
          New: When I restart my Jenkins master server I have noticed that the Build Environment config for any jobs that have had that section updated since the last restart disappear, such as pre-SCM buildsteps and Artifactory dependency resolution. 

          -I've tagged the Job Config History plugin as I've been using it to track the history of the files and whether the lost config can be easily restored, but bizarrely the config in question is nowhere to be found in any of those previous versions despite it being added and saved successfully before the last restart.- 

          This appears to affect multiple project types; I've observed it in both Maven and Freestyle jobs.

           

           

          Leo Brookes added a comment -

          This may well be unrelated, but I've also noticed that jobs that are disabled prior to restart revert back to being enabled on a restart. Will raise this separately if needed but can't help but think there may be some correlation between the two issues.

          Leo Brookes added a comment - This may well be unrelated, but I've also noticed that jobs that are disabled prior to restart revert back to being enabled on a restart. Will raise this separately if needed but can't help but think there may be some correlation between the two issues.

          Daniel Beck added a comment -

          Would be helpful if you could monitor the config.xml file contents through the lifecycle of Jenkins to see what gets written when, and correlate with actions in Jenkins.

          Daniel Beck added a comment - Would be helpful if you could monitor the config.xml file contents through the lifecycle of Jenkins to see what gets written when, and correlate with actions in Jenkins.

          Daniel Beck added a comment -

          To clarify, on startup, Jenkins loads a different configuration than what's stored on disk?

          Daniel Beck added a comment - To clarify, on startup, Jenkins loads a different configuration than what's stored on disk?

            stefanbrausch Stefan Brausch
            bleloch Leo Brookes
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: