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

Race condition can prevent setup wizard from initializing properly

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      The setup wizard initialization currently happens once the InitMilestone.COMPLETED is reached.

      On the first Jenkins startup, there is a risk that some code executed in another thread would call Jenkins#save before the setup wizard is initialized. Such code could be a groovy script, or in a third-party plugin.

      In such a case, the Setup Wizard would be initialized with state RESTART and the instance wouldn't be initialized as expected.

        Attachments

          Activity

          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Vincent Latombe
          Path:
          core/src/main/java/jenkins/model/Jenkins.java
          http://jenkins-ci.org/commit/jenkins/9f599911f6125cd69dc45718a4bbf79644be74e8
          Log:
          JENKINS-49401 Move Setup Wizard initialization logic to the init reactor. (#3282)

          This way, it is guaranteed Jenkins.save() has never been called before
          the SetupWizard is executed, and computation of the initial Setup Wizard
          state will be correct.

          Since the SetupWizard is now executed before reaching the COMPLETED
          milestone, a Jenkins.save() call has been added in order to persist any
          configuration change done in prior phases.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Vincent Latombe Path: core/src/main/java/jenkins/model/Jenkins.java http://jenkins-ci.org/commit/jenkins/9f599911f6125cd69dc45718a4bbf79644be74e8 Log: JENKINS-49401 Move Setup Wizard initialization logic to the init reactor. (#3282) This way, it is guaranteed Jenkins.save() has never been called before the SetupWizard is executed, and computation of the initial Setup Wizard state will be correct. Since the SetupWizard is now executed before reaching the COMPLETED milestone, a Jenkins.save() call has been added in order to persist any configuration change done in prior phases.
          Hide
          oleg_nenashev Oleg Nenashev added a comment -

          The fix has been integrated towards 2.114.

          Show
          oleg_nenashev Oleg Nenashev added a comment - The fix has been integrated towards 2.114.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Vincent Latombe
          Path:
          core/src/main/java/jenkins/model/Jenkins.java
          http://jenkins-ci.org/commit/jenkins/f5a2401c8a38b4c51e5dc5a7542326aa25343143
          Log:
          JENKINS-49401 Move Setup Wizard initialization logic to the init reactor. (#3282)

          This way, it is guaranteed Jenkins.save() has never been called before
          the SetupWizard is executed, and computation of the initial Setup Wizard
          state will be correct.

          Since the SetupWizard is now executed before reaching the COMPLETED
          milestone, a Jenkins.save() call has been added in order to persist any
          configuration change done in prior phases.

          (cherry picked from commit 9f599911f6125cd69dc45718a4bbf79644be74e8)

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Vincent Latombe Path: core/src/main/java/jenkins/model/Jenkins.java http://jenkins-ci.org/commit/jenkins/f5a2401c8a38b4c51e5dc5a7542326aa25343143 Log: JENKINS-49401 Move Setup Wizard initialization logic to the init reactor. (#3282) This way, it is guaranteed Jenkins.save() has never been called before the SetupWizard is executed, and computation of the initial Setup Wizard state will be correct. Since the SetupWizard is now executed before reaching the COMPLETED milestone, a Jenkins.save() call has been added in order to persist any configuration change done in prior phases. (cherry picked from commit 9f599911f6125cd69dc45718a4bbf79644be74e8)
          Hide
          hong yan-hong wang added a comment -

          Hello all,

          Since I upgrade from jenkins/jenkins:2.107.2-alpine to jenkins/jenkins:2.107.3-alpine, I met the error message in Jenkins log.

          $ kubectl logs jenkins-75854794bd-xwpjv --follow

          ....

          ....

          ....

          May 16, 2018 9:29:28 AM jenkins.install.SetupWizard init
          INFO:

          *************************************************************
          *************************************************************
          *************************************************************

          Jenkins initial setup is required. An admin user has been created and a password generated.
          Please use the following password to proceed to installation:

          40c3824c3c6e45739d616b18af590c19

          This may also be found at: /var/jenkins_home/secrets/initialAdminPassword

          *************************************************************
          *************************************************************
          *************************************************************

          May 16, 2018 9:29:32 AM hudson.model.UpdateCenter updateDefaultSite
          WARNING: Upgrading Jenkins. Failed to update the default Update Site 'default'. Plugin upgrades may fail.
          java.net.UnknownHostException: updates.jenkins.io
              at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)

          ...

          ...

          ...

          So is there any some way to skip SetupWizard?

          I tried to add 'RUN echo 2.0 > /usr/share/jenkins/ref/jenkins.install.UpgradeWizard.state' into Dockerfile.

          Or append 'instance.setInstallState( InstallState.INITIAL_SETUP_COMPLETED )' to my customized groovy file.

          It still didn't work......

          Now I could only still keep Jenkins in 2.107.2-alpine version.

           

          Thanks very much.

          Hong

          Show
          hong yan-hong wang added a comment - Hello all, Since I upgrade from jenkins/jenkins:2.107.2-alpine to jenkins/jenkins:2.107.3-alpine , I met the error message in Jenkins log. $ kubectl logs jenkins-75854794bd-xwpjv --follow .... .... .... May 16, 2018 9:29:28 AM jenkins.install.SetupWizard init INFO: ************************************************************* ************************************************************* ************************************************************* Jenkins initial setup is required. An admin user has been created and a password generated. Please use the following password to proceed to installation: 40c3824c3c6e45739d616b18af590c19 This may also be found at: /var/jenkins_home/secrets/initialAdminPassword ************************************************************* ************************************************************* ************************************************************* May 16, 2018 9:29:32 AM hudson.model.UpdateCenter updateDefaultSite WARNING: Upgrading Jenkins. Failed to update the default Update Site 'default'. Plugin upgrades may fail. java.net.UnknownHostException: updates.jenkins.io     at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184) ... ... ... So is there any some way to skip SetupWizard? I tried to add ' RUN echo 2.0 > /usr/share/jenkins/ref/jenkins.install.UpgradeWizard.state ' into Dockerfile . Or append ' instance.setInstallState( InstallState.INITIAL_SETUP_COMPLETED ) ' to my customized groovy file. It still didn't work...... Now I could only still keep Jenkins in  2.107.2-alpine version.   Thanks very much. Hong

            People

            • Assignee:
              vlatombe Vincent Latombe
              Reporter:
              vlatombe Vincent Latombe
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: