Jenkins Pipeline's deleteDir() fails with java.nio.file.AccessDeniedException exception - jenkins

I have a Jenkins Pipeline job for building my Android project.
The basic steps are to checkout the project's repository, run docker container (map host's repository folder to appropriate folder in container), execute the script within the container and extract the artifacts.
The very first step deletes the workspace using deleteDir() function:
node("jenkins-slaves") {
deleteDir() // <-------------- HERE
stage('checkout repo') {
// REDACTED
}
// REDACTED
}
However, during one of the first attempts to run it, I've received the following error:
[Pipeline] node
Running on jenkins-slave14 in /home/jenkins/workspace/REDACTED
[Pipeline] {
[Pipeline] deleteDir
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.nio.file.AccessDeniedException: /home/jenkins/workspace/REDACTED/app/all-apk/apks
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.implDelete(UnixFileSystemProvider.java:244)
at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108)
at java.nio.file.Files.deleteIfExists(Files.java:1165)
at hudson.Util.tryOnceDeleteFile(Util.java:290)
at hudson.Util.deleteFile(Util.java:245)
at hudson.FilePath.deleteRecursive(FilePath.java:1211)
at hudson.FilePath.deleteContentsRecursive(FilePath.java:1220)
at hudson.FilePath.deleteRecursive(FilePath.java:1202)
at hudson.FilePath.deleteContentsRecursive(FilePath.java:1220)
at hudson.FilePath.deleteRecursive(FilePath.java:1202)
at hudson.FilePath.deleteContentsRecursive(FilePath.java:1220)
at hudson.FilePath.deleteRecursive(FilePath.java:1202)
at hudson.FilePath.access$1000(FilePath.java:197)
at hudson.FilePath$14.invoke(FilePath.java:1181)
at hudson.FilePath$14.invoke(FilePath.java:1178)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2750)
at hudson.remoting.UserRequest.perform(UserRequest.java:208)
at hudson.remoting.UserRequest.perform(UserRequest.java:54)
at hudson.remoting.Request$2.run(Request.java:360)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused: java.io.IOException: Unable to delete '/home/jenkins/workspace/REDACTED/app/all-apk/apks'. Tried 3 times (of a maximum of 3) waiting 0.1 sec between attempts.
at hudson.Util.deleteFile(Util.java:250)
at hudson.FilePath.deleteRecursive(FilePath.java:1211)
at hudson.FilePath.deleteContentsRecursive(FilePath.java:1220)
at hudson.FilePath.deleteRecursive(FilePath.java:1202)
at hudson.FilePath.deleteContentsRecursive(FilePath.java:1220)
at hudson.FilePath.deleteRecursive(FilePath.java:1202)
at hudson.FilePath.deleteContentsRecursive(FilePath.java:1220)
at hudson.FilePath.deleteRecursive(FilePath.java:1202)
at hudson.FilePath.access$1000(FilePath.java:197)
at hudson.FilePath$14.invoke(FilePath.java:1181)
at hudson.FilePath$14.invoke(FilePath.java:1178)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2750)
at hudson.remoting.UserRequest.perform(UserRequest.java:208)
at hudson.remoting.UserRequest.perform(UserRequest.java:54)
at hudson.remoting.Request$2.run(Request.java:360)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at ......remote call to jenkins-slave14(Native Method)
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1654)
at hudson.remoting.UserResponse.retrieve(UserRequest.java:311)
at hudson.remoting.Channel.call(Channel.java:905)
at hudson.FilePath.act(FilePath.java:987)
Caused: java.io.IOException: remote file operation failed: /home/jenkins/workspace/REDACTED at hudson.remoting.Channel#16d096ce:jenkins-slave14
at hudson.FilePath.act(FilePath.java:994)
at hudson.FilePath.act(FilePath.java:976)
at hudson.FilePath.deleteRecursive(FilePath.java:1178)
at org.jenkinsci.plugins.workflow.steps.DeleteDirStep$Execution.run(DeleteDirStep.java:77)
at org.jenkinsci.plugins.workflow.steps.DeleteDirStep$Execution.run(DeleteDirStep.java:69)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:49)
at hudson.security.ACL.impersonate(ACL.java:260)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:46)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE
What is the root cause of this problem and how can I solve that?

Delete error is generally caused because of either insufficient permissions or someone/something locks the file.
I've noticed that the folder that Jenkins unsuccessfully tried to delete was dynamically created in container by the build script. The folder and all the files beneath were created with root/root (user/group).
This helped me to understand the root cause of this problem - the pipeline is running with jenkins/jenkins (user/group) and unable to delete files/folders created with another user (root/root in my case).
The solution I came up with was to create the docker image with same user (belonging to same group) as the host system uses (my container OS is based on Alpine):
RUN addgroup -S -g 6002 jenkins
RUN adduser -S -u 6002 -G jenkins jenkins
USER jenkins
Note that the GID and UID (both equal 6002 in above example) have to match the ids in your host machine. In order to find them, you can use the following commands:
id -u jenkins
id -g jenkins
From documentation:
The USER instruction sets the user name (or UID) and optionally the
user group (or GID) to use when running the image and for any RUN, CMD
and ENTRYPOINT instructions that follow it in the Dockerfile.
Once this step performed, any files/folders that are being created by a build script within the container are using a matching host user - which allows host OS to manipulate/delete them without any issues.

Related

Jenkins pipeline stuck on Build

I have a few services running on a Kubernetes cluster on ibmcloud and I use Jenkins to deploy these services.
So, until yesterday everything was working fine, but today as I tried to re-deploy my services 2 of them got stuck on "BUILD", freezing Jenkins, and the only way to get Jenkins to work again was by running "systemctl restart jenkins" on the remote machine where jenkins is installed.
After restarting Jenkins I went into the failed build
The end of the console output was:
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (BUILD)
[Pipeline] sh
+ yarn build
yarn run v1.16.0
$ yarn clean && tsc
$ rm -rf dist/
Done in 7.25s.
[Pipeline] sh
+ yarn build:webpack
yarn run v1.16.0
$ webpack --config webpack.config.js
Resuming build at Fri Mar 13 23:00:58 UTC 2020 after Jenkins restart
[Pipeline] End of Pipeline
Global Slack Notifier try posting to slack. However some error occurred
TeamDomain :
Channel :build-info
Message :
java.lang.IllegalStateException: JENKINS-50407: no loaded shell in CpsFlowExecution[Owner[isa-v2/user-service/2:isa-v2/user-service #2]]
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:35)
at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:185)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:400)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$400(CpsThreadGroup.java:96)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:312)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:276)
at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:67)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Finished: FAILURE
I've tried to delete pipeline and create it again, updated jenkins but still no luck.
Truth is I don't really know much about Jenkins and I'm getting kind of desperate here! :x
It was working fine yesterday, no code was changed, no Jenkins configuration or pipeline changes eithe. It just seems to have started out of nowhere.
Could someone please help me figure out what is going on and how to fix it?

Stash/unstash causing failure java.io.IOException: Failed to extract MyWar.tar.gz

I want to stash one file from one machine and unstash it to other machine hence I've following pipeline code -
post {
success {
script {
stash allowEmpty: true, includes: 'Installer/My.war', name: 'MyWar', useDefaultExcludes: false
}
node(SERVER1) {
ws("workspace/RedmineAndReviewboardProject/SVNCheckout") {
script {
sh '''mkdir -p "Installer"'''
dir('/Installer') {
unstash 'MyWar'
}
}
}
}
}
}
In this stash code is executed on one machine and unstash on another machine.
But it results into following error -
java.io.IOException: Failed to extract MyWar.tar.gz
at hudson.FilePath.readFromTar(FilePath.java:2608)
at hudson.FilePath.access$500(FilePath.java:211)
at hudson.FilePath$UntarRemote.invoke(FilePath.java:585)
at hudson.FilePath$UntarRemote.invoke(FilePath.java:576)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3069)
at hudson.remoting.UserRequest.perform(UserRequest.java:211)
at hudson.remoting.UserRequest.perform(UserRequest.java:54)
at hudson.remoting.Request$2.run(Request.java:369)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to 192.168.136.30
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1741)
at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
at hudson.remoting.Channel.call(Channel.java:955)
at hudson.FilePath.act(FilePath.java:1069)
at hudson.FilePath.act(FilePath.java:1058)
at hudson.FilePath.untar(FilePath.java:571)
at org.jenkinsci.plugins.workflow.flow.StashManager.unstash(StashManager.java:165)
at org.jenkinsci.plugins.workflow.support.steps.stash.UnstashStep$Execution.run(UnstashStep.java:76)
at org.jenkinsci.plugins.workflow.support.steps.stash.UnstashStep$Execution.run(UnstashStep.java:63)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
... 4 more
Caused by: java.nio.file.AccessDeniedException: /Installer
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:3256)
at hudson.FilePath.readFromTar(FilePath.java:2592)
... 12 more
What has gone wrong here?
As #vinWin suggests, your problem seems to be related to accessing the Installer directory.
While on the pipeline you are creating a directory at workspace/RedmineAndReviewboardProject/SVNCheckout/Installer, on the dir command you are trying to access a different one /Installer
On one hand, where you trying to refer to $WORKSPACE on SERVER1 ? If so, on the ws command you should use $WORKSPACE/RedmineAndReviewboardProject/SVNCheckout. Otherwise, your will be working at $WORKSPACE/workspace/RedmineAndReviewboardProject/SVNCheckout
For the dir command, since you are already located at the root of the above defined workspace, using Installer, without the leading / will suffice.

Jenkins Pipepline is failing: Remote call on JNLP4-connect connection from XXX failed

My Jenkins pipeline is failing while checking out from svn. Below is the error.
Also: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from nobuild01.sdi.pvt/152.144.34.14:50396
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1741)
at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
at hudson.remoting.Channel.call(Channel.java:955)
at hudson.FilePath.act(FilePath.java:1036)
at hudson.FilePath.act(FilePath.java:1025)
at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:928)
at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:864)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:85)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:75)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
at hudson.security.ACL.impersonate(ACL.java:290)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
java.lang.NoClassDefFoundError: Could not initialize class jenkins.model.Jenkins
at hudson.scm.SubversionSCM.descriptor(SubversionSCM.java:2584)
at hudson.scm.SubversionSCM.createDefaultSVNOptions(SubversionSCM.java:1085)
at hudson.scm.SubversionSCM.createClientManager(SubversionSCM.java:1075)
at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:1002)
at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:979)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2918)
at hudson.remoting.UserRequest.perform(UserRequest.java:212)
at hudson.remoting.UserRequest.perform(UserRequest.java:54)
at hudson.remoting.Request$2.run(Request.java:369)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:93)
at java.lang.Thread.run(Thread.java:745)
Caused: java.io.IOException: Remote call on JNLP4-connect connection from nobuild01.sdi.pvt/152.144.219.14:50396 failed
at hudson.remoting.Channel.call(Channel.java:961)
at hudson.FilePath.act(FilePath.java:1036)
Caused: java.io.IOException: remote file operation failed: c:\Dev at hudson.remoting.Channel#4b1b30ed:JNLP4-connect connection from nobuild01.sdi.pvt/152.144.34.14:50396
at hudson.FilePath.act(FilePath.java:1043)
at hudson.FilePath.act(FilePath.java:1025)
at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:928)
at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:864)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:85)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:75)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
at hudson.security.ACL.impersonate(ACL.java:290)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Slave machine is running on openJDK, not Oracle java. so I used IcedTea to run .jnlp.
I checked my Jenkins service is running.
openjdkverion: java-1.8.0-openjdk-1.8.0.91-3
Also someone guild me where I can see the Jenkins log. I am running Jenkins master as a Docker container.
For Windows, go to Services (Start → Run: services.msc), find Jenkins and Jenkins Agent, right click → Restart.
If it does not help (UI is not responding) open the Windows Task Manager → Processes, kill the java.exe process, and restart the service once again.
ps -ef | grep jenkins
sudo kill -9 <pid>
This could be due to refSpec configuration on jenkins. In Source Code management, provide the SSH, github/any other git REPO URL .
Tap on Advanced Button and provide "refs/pull/:refs/remotes/origin/pr/" in RefSpec
In above configuration bold content might be creating problem, please remove and restart your jenkins.
In my case this solved problem for me.

Jenkins Artifactory Plugin not working with recent Artifactory version

We have the following steps in our Jenkinsfile (trying to upload artifacts to our Artifactory server):
def server = script.Artifactory.server("our-artifactory-server-id")
def uploadSpec = """{
"files": [
{
"pattern": "${sourcePath}",
"target": "${targetPath}"
}
]
}"""
server.upload(uploadSpec)
This used to work until we updated to a newer version of Artifactory. Ever since the update, we get the following error when running the build job:
java.io.IOException: Failed to deploy file. Status code: 400
at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.uploadFile(ArtifactoryBuildInfoClient.java:656)
at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.deployArtifact(ArtifactoryBuildInfoClient.java:343)
at org.jfrog.build.extractor.clientConfiguration.util.spec.SpecsHelper.deploy(SpecsHelper.java:291)
at org.jfrog.build.extractor.clientConfiguration.util.spec.SpecsHelper.uploadArtifactsBySpec(SpecsHelper.java:65)
at org.jfrog.hudson.generic.GenericArtifactsDeployer$FilesDeployerCallable.invoke(GenericArtifactsDeployer.java:189)
at org.jfrog.hudson.generic.GenericArtifactsDeployer$FilesDeployerCallable.invoke(GenericArtifactsDeployer.java:130)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2750)
at hudson.remoting.UserRequest.perform(UserRequest.java:181)
at hudson.remoting.UserRequest.perform(UserRequest.java:52)
at hudson.remoting.Request$2.run(Request.java:336)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at ......remote call to docker-bc26fb0b91c4(Native Method)
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1554)
at hudson.remoting.UserResponse.retrieve(UserRequest.java:281)
at hudson.remoting.Channel.call(Channel.java:839)
at hudson.FilePath.act(FilePath.java:987)
Caused: java.io.IOException: remote file operation failed: /home/jenkins/workspace/tration_feature_jenkinsfile-ANARWI2SDBPRVZNIYHCS6XKXIAD2SZ5ZTHM6DRXHYSARAQHPWEMQ at hudson.remoting.Channel#4c39a5aa:docker-bc26fb0b91c4
at hudson.FilePath.act(FilePath.java:994)
at hudson.FilePath.act(FilePath.java:976)
at org.jfrog.hudson.pipeline.executors.GenericUploadExecutor.execution(GenericUploadExecutor.java:52)
at org.jfrog.hudson.pipeline.steps.UploadStep$Execution.run(UploadStep.java:65)
at org.jfrog.hudson.pipeline.steps.UploadStep$Execution.run(UploadStep.java:46)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
at hudson.security.ACL.impersonate(ACL.java:260)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE
Some background regarding our setup:
Jenkins version 2.69
Artifactory version 5.8.4
Artifactory plugin version 2.14.0
the error started to appear with a recent update of Artifactory
the Artifactory log shows no output for the error
we are sitting behind a proxy, but no_proxy is set correctly, at least we can curl https://... to our Artifactory host
we have self-signed certificates for Artifactory, but they should be properly added to the java truststore and the system truststore, since we can open URLs in java apps as well as with curl without any issues.
Any idea how we could debug this issue?
I had a very similar issue and found the solution in the configuration of the Artifactory-Jenkins plugin (manage jenkins --> configure system --> artifactory).
What I did was changing the Artifactory server URL from:
https://<artifactorydomain.com>
to the new URL (adding the /artifactory):
https://<artifactorydomain.com>/artifactory
Hope this helps.

SBT Native Packager Plugin Docker Error

I have used the sbt docker plugin for one of my project and I get the following error when I ran:
sbt docker:publishLocal
Joes-MacBook-Pro:my-projects joe$ sbt docker:publishLocal
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=724M; support was removed in 8.0
[info] Loading project definition from /Users/joe/projects/my-projects/proj1/project
[info] Set current project to sally (in build file:/Users/joe/projects/my-projects/proj1/)
[info] Wrote /Users/joe/projects/my-projects/proj1/target/scala-2.11/sally_2.11-2.1.pom
java.io.IOException: Cannot run program "docker" (in directory "/Users/joe/projects/my-projects/proj1/target/docker/docker/stage"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at sbt.SimpleProcessBuilder.run(ProcessImpl.scala:349)
at sbt.AbstractProcessBuilder.run(ProcessImpl.scala:128)
at sbt.AbstractProcessBuilder$$anonfun$runBuffered$1.apply(ProcessImpl.scala:159)
at sbt.AbstractProcessBuilder$$anonfun$runBuffered$1.apply(ProcessImpl.scala:159)
at com.typesafe.sbt.packager.docker.DockerPlugin$$anon$1.buffer(DockerPlugin.scala:275)
at sbt.AbstractProcessBuilder.runBuffered(ProcessImpl.scala:159)
at sbt.AbstractProcessBuilder.$bang(ProcessImpl.scala:156)
at com.typesafe.sbt.packager.docker.DockerPlugin$.publishLocalDocker(DockerPlugin.scala:285)
at com.typesafe.sbt.packager.docker.DockerPlugin$$anonfun$projectSettings$14.apply(DockerPlugin.scala:106)
at com.typesafe.sbt.packager.docker.DockerPlugin$$anonfun$projectSettings$14.apply(DockerPlugin.scala:105)
at scala.Function4$$anonfun$tupled$1.apply(Function4.scala:35)
at scala.Function4$$anonfun$tupled$1.apply(Function4.scala:34)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
at sbt.std.Transform$$anon$4.work(System.scala:63)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
at sbt.Execute.work(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:248)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
at sbt.SimpleProcessBuilder.run(ProcessImpl.scala:349)
at sbt.AbstractProcessBuilder.run(ProcessImpl.scala:128)
at sbt.AbstractProcessBuilder$$anonfun$runBuffered$1.apply(ProcessImpl.scala:159)
at sbt.AbstractProcessBuilder$$anonfun$runBuffered$1.apply(ProcessImpl.scala:159)
at com.typesafe.sbt.packager.docker.DockerPlugin$$anon$1.buffer(DockerPlugin.scala:275)
at sbt.AbstractProcessBuilder.runBuffered(ProcessImpl.scala:159)
at sbt.AbstractProcessBuilder.$bang(ProcessImpl.scala:156)
at com.typesafe.sbt.packager.docker.DockerPlugin$.publishLocalDocker(DockerPlugin.scala:285)
at com.typesafe.sbt.packager.docker.DockerPlugin$$anonfun$projectSettings$14.apply(DockerPlugin.scala:106)
at com.typesafe.sbt.packager.docker.DockerPlugin$$anonfun$projectSettings$14.apply(DockerPlugin.scala:105)
at scala.Function4$$anonfun$tupled$1.apply(Function4.scala:35)
at scala.Function4$$anonfun$tupled$1.apply(Function4.scala:34)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
at sbt.std.Transform$$anon$4.work(System.scala:63)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
at sbt.Execute.work(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[error] (docker:publishLocal) java.io.IOException: Cannot run program "docker" (in directory "/Users/joe/projects/my-projects/proj1/target/docker/docker/stage"): error=2, No such file or directory
Check if docker is running? Try restarting the docker daemon. That should do the trick! Alternatively try setting the docker environment in every command line shell:
eval "$(docker-machine env default)"
where default is the name of the docker machine that you created. Make sure to replace with the one that you created.
Next, try giving the current user docker previliges:
sudo usermod -aG docker $USER

Resources