Page MenuHomePhabricator

Jenkins fails to checkout shared Groovy library integration/pipelinelib
Closed, ResolvedPublic

Description

Jenkins allows for the configuration of shared Groovy libraries to be made available to pipeline scripts as needed (see T196940: Establish shared library for pipeline code used in Jenkins). The Jenkins master must be able to checkout the library repo locally before serializing the pipeline job and sending it to an agent for execution.

However, the current workspace directory for our Jenkins master seems to be misconfigured due to recent changes in Jenkins configuration policies; it points to a non-existent directory and so the checkout of the shared library code fails.

Started by user dduvall
Running in Durability level: MAX_SURVIVABILITY
Loading library wikimedia-integration-pipelinelib@master
Attempting to resolve master from remote references...
 > git --version # timeout=10
 > git ls-remote -h https://gerrit.wikimedia.org/r/integration/pipelinelib # timeout=10
Found match: refs/heads/master revision de98e5e79abd435eaabe09b2538156216f5be212
Using checkout strategy: Specific revision
java.nio.file.AccessDeniedException: /srv/ssd/jenkins
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
	at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384)
	at java.nio.file.Files.createDirectory(Files.java:674)
	at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781)
	at java.nio.file.Files.createDirectories(Files.java:767)
	at hudson.FilePath.mkdirs(FilePath.java:3098)
	at hudson.FilePath.access$900(FilePath.java:209)
	at hudson.FilePath$Mkdirs.invoke(FilePath.java:1216)
	at hudson.FilePath$Mkdirs.invoke(FilePath.java:1212)
	at hudson.FilePath.act(FilePath.java:1042)
	at hudson.FilePath.act(FilePath.java:1025)
	at hudson.FilePath.mkdirs(FilePath.java:1208)
	at hudson.plugins.git.GitSCM.createClient(GitSCM.java:810)
	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1180)
	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113)
	at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.doRetrieve(SCMSourceRetriever.java:112)
	at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.retrieve(SCMSourceRetriever.java:84)
	at org.jenkinsci.plugins.workflow.libs.LibraryAdder.retrieve(LibraryAdder.java:153)
	at org.jenkinsci.plugins.workflow.libs.LibraryAdder.add(LibraryAdder.java:134)
	at org.jenkinsci.plugins.workflow.libs.LibraryDecorator$1.call(LibraryDecorator.java:125)
	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1065)
	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
	at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
	at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:133)
	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:127)
	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:557)
	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:518)
	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:290)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:429)
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: Loading libraries failed

1 error

	at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1085)
	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
	at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
	at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:133)
	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:127)
	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:557)
	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:518)
	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:290)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE

A fix for the buildsDir configuration—which was also effected by the Jenkins policy change—was implemented recently. (See {T199448#4434844}.) We should implement a similar fix for workspacesDir so that these shared libraries can be used.

Event Timeline

Change 449769 had a related patch set uploaded (by Dduvall; owner: Dduvall):
[operations/puppet@production] jenkins: add workspacesDir system property

https://gerrit.wikimedia.org/r/449769

I pinged the #jenkins folks on IRC and the author of the shared library plugin seems to think fixing workspacesDir is the right solution.

Change 449769 merged by Dzahn:
[operations/puppet@production] jenkins: add workspacesDir system property

https://gerrit.wikimedia.org/r/449769

The checkout of the shared integration/pipelinelib plugin is now working on integration.wikimedia.org.

Cloning repository https://gerrit.wikimedia.org/r/integration/pipelinelib
 > git init /srv/jenkins/workspace/blubber-test@libs/wikimedia-integration-pipelinelib # timeout=10
Fetching upstream changes from https://gerrit.wikimedia.org/r/integration/pipelinelib