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

Unreliable defaulting of Jenkins.workspaceDir

    Details

    • Similar Issues:

      Description

      Jenkins.workspaceDir is supposed to default to $JENKINS_HOME/workspace/ on new installations: the "modern" location, consistent with that of slaves. But if you do not save the Jenkins global configuration during the first startup, on the next startup $JENKINS_HOME/jobs/ exists yet $JENKINS_HOME/config.xml does not, so the "compatibility" code kicks in and the old location is used!

      Just setting this field to the new value in the instance initializer probably does not suffice, since installations upgraded from before the introduction of this field would be incorrectly switched to the new value.

      Probably suffices to adjust the check to also check for the existence of $JENKINS_HOME/config.xml, since most old installations would have saved this file at least once.

        Attachments

          Issue Links

            Activity

            Hide
            kerrhome Shannon Kerr added a comment - - edited

            Baptiste Mathus I'm seeing the same.  Do we know what needs to be done to correct this?  Per Jesse Glick on JENKINS-2111 this is not something we should ignore.

            Show
            kerrhome Shannon Kerr added a comment - - edited Baptiste Mathus I'm seeing the same.  Do we know what needs to be done to correct this?  Per Jesse Glick on JENKINS-2111 this is not something we should ignore.
            Hide
            batmat Baptiste Mathus added a comment - - edited

            I think we are going to try and look into this, but anyone feel free to give it a shot if you feel like it. See https://github.com/jenkinsci/jenkins/pull/3364 partly for hints, as it touches mainly the related code area.

            Fixing this should not be too hard for an experienced Java developer.

            *UPDATE: also, David Moles it would be very interesting if you can provide a GitHub repo for such a Docker image demonstrating the issue. Definitely should help fixing this more quickly.
            UPDATE2: as said by Jesse too, if you are seeing this, this would also mean you are building on the master node, which is generally strongly discouraged.*

            Show
            batmat Baptiste Mathus added a comment - - edited I think we are going to try and look into this, but anyone feel free to give it a shot if you feel like it. See https://github.com/jenkinsci/jenkins/pull/3364 partly for hints, as it touches mainly the related code area. Fixing this should not be too hard for an experienced Java developer. *UPDATE: also, David Moles it would be very interesting if you can provide a GitHub repo for such a Docker image demonstrating the issue. Definitely should help fixing this more quickly. UPDATE2: as said by Jesse too, if you are seeing this, this would also mean you are building on the master node, which is generally strongly discouraged.*
            Hide
            jglick Jesse Glick added a comment -

            My suggestion as of 2018-04-24 is to just toss out the partially broken compatibility code and only mention the recommended location in the code. Simpler and probably good enough.

            Show
            jglick Jesse Glick added a comment - My suggestion as of 2018-04-24 is to just toss out the partially broken compatibility code and only mention the recommended location in the code. Simpler and probably good enough.
            Hide
            integer Kanstantsin Shautsou added a comment - - edited

            Now it's impossible to run Jenkins on relative dir path. If i pass into jenkins rule target/somedir it fails because Jenkins instance itself can work without issues, but this check throws and fails.
            Fresh Jenkins object has no config.xml in JenkinsRule, then checks {{ checkRawBuildsDir(buildsDir);}} where buildDir is "${ITEM_ROOTDIR}/builds" by default
            (stacktrace from 2.176.4)

            08:51:16 org.jvnet.hudson.reactor.ReactorException: java.io.IOException: jenkins.model.InvalidBuildsDir: ${ITEM_ROOTDIR}/builds does not resolve to an absolute path
            08:51:16 	at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:282)
            08:51:16 	at jenkins.InitReactorRunner.run(InitReactorRunner.java:48)
            08:51:16 	at jenkins.model.Jenkins.executeReactor(Jenkins.java:1129)
            08:51:16 	at jenkins.model.Jenkins.<init>(Jenkins.java:936)
            08:51:16 	at hudson.model.Hudson.<init>(Hudson.java:85)
            08:51:16 	at org.jvnet.hudson.test.JenkinsRule.newHudson(JenkinsRule.java:675)
            08:51:16 	at org.jvnet.hudson.test.JenkinsRule.before(JenkinsRule.java:402)
            08:51:16 	at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:595)
            08:51:16 	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
            08:51:16 	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
            08:51:16 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            08:51:16 	at java.lang.Thread.run(Thread.java:748)
            08:51:16 Caused by: java.io.IOException: jenkins.model.InvalidBuildsDir: ${ITEM_ROOTDIR}/builds does not resolve to an absolute path
            08:51:16 	at jenkins.model.Jenkins.loadConfig(Jenkins.java:3050)
            08:51:16 	at jenkins.model.Jenkins.access$1200(Jenkins.java:310)
            08:51:16 	at jenkins.model.Jenkins$13.run(Jenkins.java:3145)
            08:51:16 	at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
            08:51:16 	at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:296)
            08:51:16 	at jenkins.model.Jenkins$5.runTask(Jenkins.java:1095)
            08:51:16 	at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:214)
            08:51:16 	at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
            08:51:16 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
            08:51:16 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
            08:51:16 	... 1 more
            08:51:16 Caused by: jenkins.model.InvalidBuildsDir: ${ITEM_ROOTDIR}/builds does not resolve to an absolute path
            08:51:16 	at jenkins.model.Jenkins.checkRawBuildsDir(Jenkins.java:3101)
            08:51:16 	at jenkins.model.Jenkins.loadConfig(Jenkins.java:3047)
            08:51:16 	... 10 more
            
            Show
            integer Kanstantsin Shautsou added a comment - - edited Now it's impossible to run Jenkins on relative dir path. If i pass into jenkins rule target/somedir it fails because Jenkins instance itself can work without issues, but this check throws and fails. Fresh Jenkins object has no config.xml in JenkinsRule, then checks {{ checkRawBuildsDir(buildsDir);}} where buildDir is "${ITEM_ROOTDIR}/builds" by default (stacktrace from 2.176.4) 08:51:16 org.jvnet.hudson.reactor.ReactorException: java.io.IOException: jenkins.model.InvalidBuildsDir: ${ITEM_ROOTDIR}/builds does not resolve to an absolute path 08:51:16 at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:282) 08:51:16 at jenkins.InitReactorRunner.run(InitReactorRunner.java:48) 08:51:16 at jenkins.model.Jenkins.executeReactor(Jenkins.java:1129) 08:51:16 at jenkins.model.Jenkins.<init>(Jenkins.java:936) 08:51:16 at hudson.model.Hudson.<init>(Hudson.java:85) 08:51:16 at org.jvnet.hudson.test.JenkinsRule.newHudson(JenkinsRule.java:675) 08:51:16 at org.jvnet.hudson.test.JenkinsRule.before(JenkinsRule.java:402) 08:51:16 at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:595) 08:51:16 at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298) 08:51:16 at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292) 08:51:16 at java.util.concurrent.FutureTask.run(FutureTask.java:266) 08:51:16 at java.lang. Thread .run( Thread .java:748) 08:51:16 Caused by: java.io.IOException: jenkins.model.InvalidBuildsDir: ${ITEM_ROOTDIR}/builds does not resolve to an absolute path 08:51:16 at jenkins.model.Jenkins.loadConfig(Jenkins.java:3050) 08:51:16 at jenkins.model.Jenkins.access$1200(Jenkins.java:310) 08:51:16 at jenkins.model.Jenkins$13.run(Jenkins.java:3145) 08:51:16 at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169) 08:51:16 at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:296) 08:51:16 at jenkins.model.Jenkins$5.runTask(Jenkins.java:1095) 08:51:16 at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:214) 08:51:16 at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117) 08:51:16 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 08:51:16 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 08:51:16 ... 1 more 08:51:16 Caused by: jenkins.model.InvalidBuildsDir: ${ITEM_ROOTDIR}/builds does not resolve to an absolute path 08:51:16 at jenkins.model.Jenkins.checkRawBuildsDir(Jenkins.java:3101) 08:51:16 at jenkins.model.Jenkins.loadConfig(Jenkins.java:3047) 08:51:16 ... 10 more
            Hide
            jglick Jesse Glick added a comment -

            A relative path for $JENKINS_HOME? I would not consider that supported. Please use absolute paths only.

            Show
            jglick Jesse Glick added a comment - A relative path for $JENKINS_HOME ? I would not consider that supported. Please use absolute paths only.

              People

              • Assignee:
                Unassigned
                Reporter:
                jglick Jesse Glick
              • Votes:
                5 Vote for this issue
                Watchers:
                15 Start watching this issue

                Dates

                • Created:
                  Updated: