Jenkins Pipeline sh step hangs
Solution 1
I ended up reinstalling jenkins using apt-get --purge remove jenkins then apt-get install jenkins. Sadly everything must be configured again, but the problem has been solved.
Solution 2
After plugins update had the same issue with Jenkins k8s nodes, turns out that default workingDir value for default jnlp k8s node is now set to /home/jenkins/agent
, whereas for second container in pod I set it to /home/jenkins
.
Switching workingDir to /home/jenkins/agent
for the second container in pod fixed the problem.
Related videos on Youtube
Aesonus
Updated on September 18, 2022Comments
-
Aesonus over 1 year
I am currently having an issue with Jenkins running on Ubuntu 18.04. The sh pipeline step hangs and eventually times out with the following message:
[Pipeline] sh process apparently never started in /var/lib/jenkins/workspace/members-only-demo@tmp/durable-494a3b0d (running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer) Cannot contact : java.io.FileNotFoundException: File '/var/lib/jenkins/workspace/members-only-demo@tmp/durable-494a3b0d/output.txt' does not exist
Here is the thread dump:
Thread #6 at DSL.sh(completed process (code -2) in /var/lib/jenkins/workspace/members-only-demo@tmp/durable-494a3b0d; recurrence period: 15000ms; check task scheduled; cancelled? false done? false) at WorkflowScript.run(WorkflowScript:9) at DSL.stage(Native Method) at WorkflowScript.run(WorkflowScript:8) at DSL.node(running on ) at WorkflowScript.run(WorkflowScript:3)
The pipeline script is as follows:
#!/usr/bin/env groovy node { stage('Checkout') { checkout([$class: 'GitSCM', branches: [[name: '*/da-demo']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'TeamHub2', url: '[email protected]:digitalarchitects/projects/slender-man/repositories/git/members-only-app']]]) } stage('Create Build Dir') { sh label: '', returnStdout: true, script: 'rm --recursive --force ${env.WORKSPACE}/build/' sh 'mkdir --parents ${env.WORKSPACE}/build/coverage ${env.WORKSPACE}/build/logs ${env.WORKSPACE}/build/pdepend' } ... }
I am not really sure how to troubleshoot this issue. Can anyone help please?
-
CJCombrink over 4 yearsI had a similar issue but on a Windows node (yes using sh hung), the issue was that my workingDir was set to /temp (which is invalid on windows), after changing it to "C:\temp" it worked.
-
Scott - Слава Україні almost 4 yearsCan you provide more details? Please do not respond in comments; edit your answer to make it clearer and more complete.