[JIRA] (JENKINS-40279) Disabling of Jenkins setup wizard not working as expected

326 views
Skip to first unread message

thomas.wikstrom@tieto.com (JIRA)

unread,
Dec 7, 2016, 8:38:02 AM12/7/16
to jenkinsc...@googlegroups.com
Thomas Wikström created an issue
 
Jenkins / Bug JENKINS-40279
Disabling of Jenkins setup wizard not working as expected
Issue Type: Bug Bug
Assignee: Unassigned
Components: core
Created: 2016/Dec/07 1:37 PM
Environment: - Docker version 1.10.3, build 20f81dd
- CentOS Linux release 7.2.1511 (Core)
- Java(TM) SE Runtime Environment, 1.8.0_45-b14
- Tomcat 8.5.5
- Jenkins 2.19.1, -Djenkins.runSetupWizard=false
Priority: Major Major
Reporter: Thomas Wikström

We are deploying and installing Jenkins for customers using a framework of ours, where we are packaging Tomcat, Jenkins, plugins and other maintenance tools to have a full server up and running.

To be able to do this in a controlled manner for the customer, in for example an upgrade situation, we want to disable the setup wizard.

https://wiki.jenkins-ci.org/display/JENKINS/Features+controlled+by+system+properties
jenkins.install.runSetupWizard: "Set to false to skip install and upgrade wizards."

We are setting the system property jenkins.install.runSetupWizard to false to skip both install and upgrade wizards.

JAVA_OPTS:
-Xms500m -Xmx500m -XX:MetaspaceSize=128M -XX:MaxMetaspaceSize=1024M -XX:+HeapDumpOnOutOfMemoryError -XX:+UseCompressedOops -XX:+UseG1GC -XX:MaxGCPauseMillis=400 -XX:GCPauseIntervalMillis=8000 -Djava.awt.headless=true -Dhudson.model.ParametersAction.keepUndefinedParameters=true -Djenkins.install.runSetupWizard=false -javaagent:./dist/ssl/sys-props-agent.jar=props:./dist/ssl/private/syspropsagent.properties -XX:HeapDumpPath=/<path-to-logs>/logs/

But still the setup wizard is appearing when upgrading like below.

Going from:
Tomcat 7.0.50, Jenkins 1.651.3
Going to:
Tomcat 8.5.5, Jenkins 2.19.1, -Djenkins.runSetupWizard=false

Upgrading in our terms means:
/usr/<old-installation-of-framework-incl-tomcat-7-and-jenkins-1.651.3>
/usr/<new-installation-of-framework-incl-tomcat-8-and-jenkins-2.19.1>
/usr/in_production/<link-to-active-installation>
/proj/jenkins_home/ [ JENKINS_HOME is kept separated from installation; plugins, jobs, customer data etc ]

Stop old Tomcat/Jenkins, install new Tomcat/Jenkins in parallel, change symlinks (old->new installation), start new Tomcat/Jenkins.
And yes, we understand we might be doing a (parallel) install in your terms, when we perform the above "upgrade".

1) We simply can't understand under which situations this system property is supposed to DISABLE the setup wizard? Is it not supposed to be working when running Jenkins in Tomcat? It IS described to "skip install and upgrade wizards".

As we somehow needed to get this to work we have done extensive googling and trying out several approaches where users seem to have struggling with this as well. One workaround tested was this:
https://github.com/geerlingguy/ansible-role-jenkins/issues/50

Where we ONLY are adding the mentioned file with the value of "2.0" (no newline)
[ TEST THIS - ONLY the file, NOT the runSetupWizard=false option ]

Create the file JENKINS_HOME/jenkins.install.UpgradeWizard.state with one line, 2.0
( echo -n 2.0 > $JENKINS_HOME/jenkins.install.UpgradeWizard.state )
VOILA, no setup wizard appearing after login to upgraded Jenkins!

2) Is this a supported, recommended way of disabling the wizard? Are there any pitfalls going this way? Or are we simply working around a bug here?

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

dbeck@cloudbees.com (JIRA)

unread,
Dec 7, 2016, 9:29:02 PM12/7/16
to jenkinsc...@googlegroups.com
Daniel Beck commented on Bug JENKINS-40279
 
Re: Disabling of Jenkins setup wizard not working as expected

Huh. Seems I got this one wrong when documenting it.

Try adding -Djenkins.install.UpgradeWizard.show=false to disable the upgrade wizard. IIUC this is the one you're concerned about.

thomas.wikstrom@tieto.com (JIRA)

unread,
Dec 8, 2016, 2:32:01 AM12/8/16
to jenkinsc...@googlegroups.com
Thomas Wikström updated an issue
 
Change By: Thomas Wikström
Environment:
- Docker version 1.10.3, build 20f81dd
- CentOS Linux release 7.2.1511 (Core)
- Java(TM) SE Runtime Environment, 1.8.0_45-b14
- Tomcat 8.5.5
- Jenkins 2.19.1, -Djenkins. install. runSetupWizard=false

thomas.wikstrom@tieto.com (JIRA)

unread,
Dec 8, 2016, 2:33:03 AM12/8/16
to jenkinsc...@googlegroups.com
Thomas Wikström updated an issue
We are deploying and installing Jenkins for customers using a framework of ours, where we are packaging Tomcat, Jenkins, plugins and other maintenance tools to have a full server up and running.

To be able to do this in a controlled manner for the customer, in for example an upgrade situation, we want to disable the setup wizard.

https://wiki.jenkins-ci.org/display/JENKINS/Features+controlled+by+system+properties
jenkins.install.runSetupWizard: "_Set to false to skip install and upgrade wizards._"

We are setting the system property *jenkins.install.runSetupWizard* to false to skip both install and upgrade wizards.

{panel}

JAVA_OPTS:
-Xms500m -Xmx500m -XX:MetaspaceSize=128M -XX:MaxMetaspaceSize=1024M  -XX:+HeapDumpOnOutOfMemoryError -XX:+UseCompressedOops -XX:+UseG1GC -XX:MaxGCPauseMillis=400 -XX:GCPauseIntervalMillis=8000 -Djava.awt.headless=true -Dhudson.model.ParametersAction.keepUndefinedParameters=true -Djenkins.install.runSetupWizard=false -javaagent:./dist/ssl/sys-props-agent.jar=props:./dist/ssl/private/syspropsagent.properties -XX:HeapDumpPath=/<path-to-logs>/logs/
{panel}


But still the setup wizard is appearing when upgrading like below.


Going from:
Tomcat 7.0.50, Jenkins 1.651.3
Going to:
Tomcat 8.5.5, Jenkins 2.19.1, -Djenkins. install. runSetupWizard=false


Upgrading in our terms means:
/usr/<old-installation-of-framework-incl-tomcat-7-and-jenkins-1.651.3>
/usr/<new-installation-of-framework-incl-tomcat-8-and-jenkins-2.19.1>
/usr/in_production/<link-to-active-installation>
/proj/jenkins_home/ [ JENKINS_HOME is kept separated from installation; plugins, jobs, customer data etc ]

Stop old Tomcat/Jenkins, install new Tomcat/Jenkins in parallel, *change symlinks (old->new installation)*, start new Tomcat/Jenkins.
And yes, we understand we might be doing a (parallel) install in your terms, when we perform the above "upgrade".

1) We simply can't understand under which situations this system property is supposed to DISABLE the setup wizard? Is it not supposed to be working when running Jenkins in Tomcat? It IS described to "skip install *and* upgrade wizards".


As we somehow needed to get this to work we have done extensive googling and trying out several approaches where users seem to have struggling with this as well. One workaround tested was this:
https://github.com/geerlingguy/ansible-role-jenkins/issues/50

Where we ONLY are adding the mentioned file with the value of "2.0" (no newline)
[ TEST THIS - ONLY the file, NOT the runSetupWizard=false option ]

Create the file JENKINS_HOME/jenkins.install.UpgradeWizard.state with one line, 2.0
( echo -n 2.0 > $JENKINS_HOME/jenkins.install.UpgradeWizard.state )
VOILA, no setup wizard appearing after login to upgraded Jenkins!

2) Is this a supported, recommended way of disabling the wizard? Are there any pitfalls going this way? Or are we simply working around a bug here?

thomas.wikstrom@tieto.com (JIRA)

unread,
Dec 8, 2016, 8:51:02 AM12/8/16
to jenkinsc...@googlegroups.com
Thomas Wikström commented on Bug JENKINS-40279
 
Re: Disabling of Jenkins setup wizard not working as expected

Hi Daniel, and thanks for your quick attention to our issues!

To be clear about what we are trying to achieve, it is not to only to hide the wizard, but to stop it from executing at all.

We tried adding the system property -Djenkins.install.UpgradeWizard.show=false , both this property alone and in conjunction with -Djenkins.install.runSetupWizard=false ,unfortunately with no effect. The setup wizard still appears.

We had a quick look at the implementation and it seems like the method reading out the value from jenkins.install.UpgradeWizard.show is never called. Or did we miss something here?

When this didn't work we dug deeper to find a workable solution for our issue. In the below file we found the handling of the runSetupWizard option a bit strange.
https://github.com/jenkinsci/jenkins/blob/stable-2.19/core/src/main/java/jenkins/install/InstallUtil.java
If creating file jenkins.install.InstallUtil.lastExecVersion either with value "0.0" or "1.0" you will jump into the part of the code where the handling of jenkins.install.runSetupWizard=false is implemented. And allowing us to bypass the execution of the wizard like we wanted.

After bypassing the setup wizard the file jenkins.install.InstallUtil.lastExecVersion is updated with the current Jenkins version. When performing future upgrades of Jenkins the file will be used and versions (current and future) compared in part of the code where it is unable to skip the setup wizard. If we do not reset the value to "0.0" (or "1.0") prior to the upgrade. Is it really the intention?

Is this a better work around of our issue than the previous one mentioned (jenkins.install.UpgradeWizard.state)?

Thanks in advance!

dbeck@cloudbees.com (JIRA)

unread,
Dec 8, 2016, 10:15:01 AM12/8/16
to jenkinsc...@googlegroups.com

unfortunately with no effect. The setup wizard still appears

Please confirm that this is about the Setup Wizard (which takes over the Jenkins UI), and not the Upgrade Wizard (which is a banner).

Also, after Jenkins is available, go to the /systemInfo URL and confirm the System properties are correctly passed to Jenkins. Not sure how that works with Tomcat.

thomas.wikstrom@tieto.com (JIRA)

unread,
Dec 8, 2016, 10:38:01 AM12/8/16
to jenkinsc...@googlegroups.com

No, sorry for the confusion: the Upgrade Wizard (the banner) still appears.
We aren't either interested in the Setup Wizard being executed, but that is perhaps not the case if the Upgrade Wizard is disabled?

Yes, they both showed up correctly among the System Properties and Environment Variables (JAVA_OPTS).
(don't have a screen shot right now)

dbeck@cloudbees.com (JIRA)

unread,
Dec 8, 2016, 11:49:01 AM12/8/16
to jenkinsc...@googlegroups.com

Seems I misread the source code. It's not a system property but related to the session. Very unusual.

It looks like there's no support way to skip the upgrade wizard entirely. It's not coming up in usual programmatic situations, so apparently the idea was that it's not too difficult to refuse/go through the wizard and remove the plugins afterwards if undesired.

I'll fix the documentation to match reality. Sorry about the confusion.

thomas.wikstrom@tieto.com (JIRA)

unread,
Dec 9, 2016, 10:25:05 AM12/9/16
to jenkinsc...@googlegroups.com

Sorry, but we're not only after documentation fixes, Daniel. We think we have two real bugs right now:

1) Disabling the Setup Wizard doesn't work as expected when using system property -Djenkins.install.runSetupWizard=false

Problematic code part we think should be reviewed.

https://github.com/jenkinsci/jenkins/blob/stable-2.19/core/src/main/java/jenkins/install/InstallUtil.java
...
    // tests need this to be 1.0
    private static final VersionNumber NEW_INSTALL_VERSION = new VersionNumber("1.0");
    private static final VersionNumber FORCE_NEW_INSTALL_VERSION = new VersionNumber("0.0");
...
        VersionNumber lastRunVersion = new VersionNumber(getLastExecVersion());

        // Neither the top level config or the lastExecVersionFile have a version
        // stored in them, which means it's a new install.
        if (FORCE_NEW_INSTALL_VERSION.equals(lastRunVersion) || lastRunVersion.compareTo(NEW_INSTALL_VERSION) == 0) {      <=== When does this case normally happen?
            Jenkins j = Jenkins.getInstance();
            
            // Allow for skipping			<=== If-clause working as expected when reached
            if(shouldNotRun) {
                try {
                    InstallState.INITIAL_SETUP_COMPLETED.initializeState();
                    return j.getInstallState();
                } catch (RuntimeException e) {
                    throw e;
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
...
        }

Similar issues where this issue have been touched upon/mentioned/seen:
https://issues.jenkins-ci.org/browse/JENKINS-34007
https://issues.jenkins-ci.org/browse/JENKINS-34035

2) Suppressing the Upgrade Wizard doesn't work using "session variable" -Djenkins.install.UpgradeWizard.show=false
Unfortunately this approach number two given to us didn't help us forward. We set it the ordinary way using JAVA_OPTS, right or wrong?
As mentioned earlier, we can't find the methods accessing this "session variable" being called.

Do you want us to file a separate ticket on this?

dbeck@cloudbees.com (JIRA)

unread,
Dec 9, 2016, 5:03:01 PM12/9/16
to jenkinsc...@googlegroups.com

When does this case normally happen?

Note that this method never returns INITIAL_SECURITY_SETUP without passing the shouldNotRun, so that shouldn't matter.

But the condition you point to evaluates to true iff the .last_exec_version file is empty or contains the version 0.0 OR the JENKINS_HOME/config.xml doesn't exist or contains the version 1.0, indicating the global configuration has never before been saved. The latter is a heuristic to determine whether it's a new install or an existing one, and assumes that all actual Jenkins use involved someone clicking 'Save' on Configure Jenkins at least once (and if not, they're probably not too opposed to seeing a wizard once).

Similar issues where this issue have been touched upon/mentioned/seen:

One motivated implementing support for the system property you're setting to skip the install wizard, the other is about restoring an accidentally closed upgrade wizard. Neither is really relevant here.

2) Suppressing the Upgrade Wizard doesn't work using "session variable" -Djenkins.install.UpgradeWizard.show=false

Well, yes, because it doesn't check the system property by that name, so setting it doesn't do anything. This feature simply does not exist, period, and both the documentation and me were wrong. Feel free to file a New Feature request for this.

craig@2ndquadrant.com (JIRA)

unread,
Jun 6, 2019, 3:24:03 AM6/6/19
to jenkinsc...@googlegroups.com

I've also been utterly stumped by this, trying incantations with derivative Docker images of the official jenkins/jenkins:lts image like

{{RUN echo $JENKINS_VERSION | tee \
/usr/share/jenkins/ref/jenkins.install.UpgradeWizard.state \
/usr/share/jenkins/ref/jenkins.install.InstallUtil.lastExecVersion}}

and

ENV JAVA_OPTS "Djenkins.install.runSetupWizard=false ${JAVA_OPTS:}"

But for some reason passing `--env JAVA_OPTS="-Djenkins.install.runSetupWizard=false"` to `docker run` did work.

This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

craig@2ndquadrant.com (JIRA)

unread,
Jun 6, 2019, 3:25:02 AM6/6/19
to jenkinsc...@googlegroups.com
Craig Ringer edited a comment on Bug JENKINS-40279
I've also been utterly stumped by this, trying incantations with derivative Docker images of the official {{jenkins/jenkins:lts}} image like

{{RUN echo $JENKINS_VERSION | tee \
    /usr/share/jenkins/ref/jenkins.install.UpgradeWizard.state \
    /usr/share/jenkins/ref/jenkins.install.InstallUtil.lastExecVersion}}

and

{{ENV JAVA_OPTS "-Djenkins.install.runSetupWizard=false ${JAVA_OPTS:-}"}}


But for some reason passing `--env JAVA_OPTS="-Djenkins.install.runSetupWizard=false"` to `docker run` did work.
Reply all
Reply to author
Forward
0 new messages