[JIRA] (JENKINS-21942) Unreliable defaulting of Jenkins.workspaceDir

22 views
Skip to first unread message

jglick@cloudbees.com (JIRA)

unread,
Aug 23, 2016, 4:48:01 PM8/23/16
to jenkinsc...@googlegroups.com
Jesse Glick commented on Bug JENKINS-21942
 
Re: Unreliable defaulting of Jenkins.workspaceDir

Should be rechecked in 2.x after changes relating to the installation wizard, which might have forced a save.

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

dbeck@cloudbees.com (JIRA)

unread,
Aug 24, 2016, 6:09:01 AM8/24/16
to jenkinsc...@googlegroups.com

Well, there's always -Djenkins.install.runSetupWizard=false for the chefs among us.

keller_jens@gmx.de (JIRA)

unread,
Nov 30, 2016, 3:43:04 AM11/30/16
to jenkinsc...@googlegroups.com

this seems to be open for quite a long time - any updates?

batmat@batmat.net (JIRA)

unread,
Mar 22, 2018, 12:27:03 PM3/22/18
to jenkinsc...@googlegroups.com
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

batmat@batmat.net (JIRA)

unread,
Mar 22, 2018, 12:27:04 PM3/22/18
to jenkinsc...@googlegroups.com
Baptiste Mathus updated an issue
Change By: Baptiste Mathus
Sprint: Essentials - Milestone 1

batmat@batmat.net (JIRA)

unread,
Mar 22, 2018, 12:27:13 PM3/22/18
to jenkinsc...@googlegroups.com
Baptiste Mathus updated an issue
Change By: Baptiste Mathus
Labels: essentials upgrade workspace

batmat@batmat.net (JIRA)

unread,
Mar 23, 2018, 12:32:02 PM3/23/18
to jenkinsc...@googlegroups.com
Baptiste Mathus started work on Bug JENKINS-21942
 
Change By: Baptiste Mathus
Status: Open In Progress

batmat@batmat.net (JIRA)

unread,
Mar 23, 2018, 1:04:03 PM3/23/18
to jenkinsc...@googlegroups.com

Jesse Glick I couldn't reproduce either with 2.112, or a local build for https://github.com/jenkinsci/jenkins/pull/3364

I can confirm the config.xml gets created without any user interaction during Jenkins startup in any case now, even . Do we want to close this, do you still think it makes sense to do additional things here, like the admin monitor you're talking about? If so, care to clarify what you mean that monitor would do?

Unassigning myself, and removing from Essentials milestone 1 for now at least as AFAIU there's nothing to fix here.

Thanks!

batmat@batmat.net (JIRA)

unread,
Mar 23, 2018, 1:04:04 PM3/23/18
to jenkinsc...@googlegroups.com
Baptiste Mathus updated an issue
 
Jenkins / Bug JENKINS-21942
Unreliable defaulting of Jenkins.workspaceDir
Change By: Baptiste Mathus
Labels: essentials upgrade workspace

batmat@batmat.net (JIRA)

unread,
Mar 23, 2018, 1:04:04 PM3/23/18
to jenkinsc...@googlegroups.com
Baptiste Mathus assigned an issue to Unassigned
Change By: Baptiste Mathus
Assignee: Baptiste Mathus

batmat@batmat.net (JIRA)

unread,
Mar 23, 2018, 1:04:05 PM3/23/18
to jenkinsc...@googlegroups.com
Baptiste Mathus updated an issue
Change By: Baptiste Mathus
Sprint: Essentials - Milestone 1

jglick@cloudbees.com (JIRA)

unread,
Mar 26, 2018, 7:34:03 PM3/26/18
to jenkinsc...@googlegroups.com

Baptiste Mathus yes I already said it is not reproducible in interactive setup; my concern was about new installations created via Docker or config-as-code generally.

jglick@cloudbees.com (JIRA)

unread,
Apr 24, 2018, 10:13:02 AM4/24/18
to jenkinsc...@googlegroups.com

Baptiste Mathus in some ways this is actually worse after JENKINS-50164, because if for example you had a working instance and then deleted $JENKINS_HOME/config.xml (say, to fix a security lockout), Jenkins will quietly reset those values to

  <workspaceDir>${ITEM_ROOTDIR}/workspace</workspaceDir>
  <buildsDir>${ITEM_ROOTDIR}/builds</buildsDir>

and there is no way to fix the OLD_DEFAULT_WORKSPACES_DIR from the GUI.

Probably we should just throw out the old default and unconditionally default to DEFAULT_WORKSPACES_DIR. There is little real compatibility risk here even for installations that had been using the old location—they will have some stranded workspaces, and the first new build of each job will need a full SCM clone rather than update, but that seems a tolerable price to pay to fix this once and for all.

david.aldrich@emea.nec.com (JIRA)

unread,
Feb 25, 2019, 4:07:03 AM2/25/19
to jenkinsc...@googlegroups.com

Baptiste Mathus I see this message in our console log:

Feb 18, 2019 8:29:06 AM WARNING jenkins.branch.WorkspaceLocatorImpl getWorkspaceRoot
JENKINS-2111 path sanitization ineffective when using legacy Workspace Root Directory ‘${ITEM_ROOTDIR}/workspace’; switch to ‘${JENKINS_HOME}/workspace/${ITEM_FULL_NAME}’ as in JENKINS-8446 / JENKINS-21942

I don't understand the message. Please will you suggest how I can fix the problem in our Jenkins installation?

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

david.moles@ucop.edu (JIRA)

unread,
Apr 2, 2019, 1:36:01 PM4/2/19
to jenkinsc...@googlegroups.com

I'm seeing the same, in a Docker image configured with JCasC.

 

kerrhome (JIRA)

unread,
May 6, 2019, 11:33:03 AM5/6/19
to jenkinsc...@googlegroups.com

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.

kerrhome (JIRA)

unread,
May 6, 2019, 11:35:03 AM5/6/19
to jenkinsc...@googlegroups.com
Shannon Kerr edited a comment on Bug JENKINS-21942
[~batmat] I'm seeing the same.  Do we know what needs to be done to correct this?  Per [~jglick] on JENKINS-2111 this is not something we should ignore.

bmathus+ossjira@cloudbees.com (JIRA)

unread,
May 13, 2019, 4:02:05 AM5/13/19
to jenkinsc...@googlegroups.com
Baptiste Mathus stopped work on Bug JENKINS-21942
 
Change By: Baptiste Mathus
Status: In Progress Open

bmathus+ossjira@cloudbees.com (JIRA)

unread,
May 13, 2019, 4:06:01 AM5/13/19
to jenkinsc...@googlegroups.com

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.

bmathus+ossjira@cloudbees.com (JIRA)

unread,
May 13, 2019, 4:08:02 AM5/13/19
to jenkinsc...@googlegroups.com
Baptiste Mathus edited a comment on Bug JENKINS-21942
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, [~dmolesuc3] 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.*

jglick@cloudbees.com (JIRA)

unread,
Jun 4, 2019, 3:54:03 PM6/4/19
to jenkinsc...@googlegroups.com

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.

kanstantsin.sha@gmail.com (JIRA)

unread,
Oct 14, 2019, 12:18:03 PM10/14/19
to jenkinsc...@googlegroups.com

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

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
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

kanstantsin.sha@gmail.com (JIRA)

unread,
Oct 14, 2019, 12:19:04 PM10/14/19
to jenkinsc...@googlegroups.com
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)
{code:java}
{code}

jglick@cloudbees.com (JIRA)

unread,
Oct 16, 2019, 10:41:04 AM10/16/19
to jenkinsc...@googlegroups.com

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

sowasdummes@gmail.com (JIRA)

unread,
Apr 24, 2020, 4:22:04 PM4/24/20
to jenkinsc...@googlegroups.com
Martin M commented on Bug JENKINS-21942

Baptiste MathusJesse Glick what is the proposed solution for getting rid of this log message

[...]
jenkins.InitReactorRunner$1#onAttained: Completed initialization
WARNING    j.branch.WorkspaceLocatorImpl#getWorkspaceRoot: JENKINS-2111 path sanitization ineffective when using legacy Workspace Root Directory '${ITEM_ROOTDIR}/workspace'; switch to '${JENKINS_HOME}/workspace/${ITEM_FULL_NAME}' as in JENKINS-8446 / JENKINS-21942}

We have the following Docker image:

FROM jenkins/jenkins:2.190.3
USER root
# Install docker dependencies
RUN apt-get update && apt-get install --no-install-recommends -y libltdl7 && rm -rf /var/lib/apt/lists/*
USER jenkins

COPY plugins.txt /usr/share/jenkins/ref/plugins.txt
RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt

ENV JAVA_OPTS="-Djenkins.install.runSetupWizard=false -Dhudson.security.csrf.DefaultCrumbIssuer.EXCLUDE_SESSION_ID=true -Dhudson.model.UpdateCenter.never=true -Dhudson.slaves.WorkspaceList=_ -Dhudson.model.DirectoryBrowserSupport.CSP=\"default-src 'self'; style-src 'self' 'unsafe-inline';\""

COPY init.groovy.d/*.groovy /usr/share/jenkins/ref/init.groovy.d/

After running this container and running the init.d groovy scripts the log contains the above mentioned log message.

We don't run the wizard because we configure Jenkins with some Groovy init.d scripts. What is the way to get rid of this warning?

This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo

sowasdummes@gmail.com (JIRA)

unread,
Apr 24, 2020, 4:22:05 PM4/24/20
to jenkinsc...@googlegroups.com
Martin M edited a comment on Bug JENKINS-21942
[~batmat][~jglick] what is the proposed solution for getting rid of this log message

{code}

[...]
jenkins.InitReactorRunner$1#onAttained: Completed initialization
WARNING    j.branch.WorkspaceLocatorImpl#getWorkspaceRoot: JENKINS-2111 path sanitization ineffective when using legacy Workspace Root Directory '${ITEM_ROOTDIR}/workspace'; switch to '${JENKINS_HOME}/workspace/${ITEM_FULL_NAME}' as in JENKINS-8446 / JENKINS-21942}
{code}


We have the following Docker image:
{code}

FROM jenkins/jenkins:2.190.3
USER root
# Install docker dependencies
RUN apt-get update && apt-get install --no-install-recommends -y libltdl7 && rm -rf /var/lib/apt/lists/*
USER jenkins

COPY plugins.txt /usr/share/jenkins/ref/plugins.txt
RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt

ENV JAVA_OPTS="-Djenkins.install.runSetupWizard=false -Dhudson.security.csrf.DefaultCrumbIssuer.EXCLUDE_SESSION_ID=true -Dhudson.model.UpdateCenter.never=true -Dhudson.slaves.WorkspaceList=_ -Dhudson.model.DirectoryBrowserSupport.CSP=\"default-src 'self'; style-src 'self' 'unsafe-inline';\""

COPY init.groovy.d/*.groovy /usr/share/jenkins/ref/init.groovy.d/
{code}


After running this container and running the init.d groovy scripts the log contains the above mentioned log message.

We don't run the wizard because we configure Jenkins with some Groovy init.d scripts. What is the way to get rid of this warning?


Appreciate your help.

jglick@cloudbees.com (JIRA)

unread,
Apr 24, 2020, 5:19:04 PM4/24/20
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages