gradle-jenkins-jobdsl-plugin icon indicating copy to clipboard operation
gradle-jenkins-jobdsl-plugin copied to clipboard

Failed to create a temporary directory in /tmp/jenkinsTests.tmp

Open sschuberth opened this issue 6 years ago • 2 comments

If the (Linux) machine from which dslUpdateJenkins is run itself runs a(nother) Jenkins instance, which is not the one the job is deployed to, I sometimes get

java.io.IOException: Failed to create a temporary directory in /tmp/jenkinsTests.tmp
        at org.jvnet.hudson.test.TemporaryDirectoryAllocator.allocate(TemporaryDirectoryAllocator.java:71)
        at org.jvnet.hudson.test.HudsonHomeLoader$1.allocate(HudsonHomeLoader.java:57)
        at org.jvnet.hudson.test.JenkinsRule.newHudson(JenkinsRule.java:613)
        at org.jvnet.hudson.test.JenkinsRule.before(JenkinsRule.java:390)
        at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:543)
        at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
        at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: Permission denied
        at java.io.UnixFileSystem.createFileExclusively(Native Method)
        at java.io.File.createTempFile(File.java:2024)
        at org.jvnet.hudson.test.TemporaryDirectoryAllocator.allocate(TemporaryDirectoryAllocator.java:65)
        ... 8 more

So it seems the Gradle plugin is using the same temporary directory as a running Jenkins instance, resulting in a (permission) conflict. I believe the plugin should use it's own temporary directory to resolve this.

sschuberth avatar Sep 06 '18 09:09 sschuberth

Unfortunately this directory is hard coded in the jenkins-test-harness, so it seems we cannot change it: https://github.com/jenkinsci/jenkins-test-harness/blob/master/src/main/java/org/jvnet/hudson/test/TemporaryDirectoryAllocator.java#L53

But I wonder why a running Jenkins instance would use this directory.

This ticket is slightly related: https://issues.jenkins-ci.org/browse/JENKINS-44940

mnonnenmacher avatar Sep 06 '18 13:09 mnonnenmacher

Unfortunately this directory is hard coded in the jenkins-test-harness

You could still temporarily override the java.io.tmpdir system property, or?

But I wonder why a running Jenkins instance would use this directory.

Well, I guess that directory in simply not used by the test harness only.

sschuberth avatar Sep 06 '18 13:09 sschuberth