3

I'm trying to build a pipeline to build a java maven project pipeline committed on github. I've installed jenkins on my windows machine. My pipeline is getting struck at below stage

Started by user Akshay Katti
Obtained Jenkinsfile from git C:\Users\ak186148\git\Kylo-Accelerator
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] node
Running on Jenkins in C:\Users\ak186148\.jenkins\workspace\Kylo-Promoter-CI-CD
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
 > git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git.exe config remote.origin.url C:\Users\ak186148\git\Kylo-Accelerator # timeout=10
Fetching upstream changes from C:\Users\ak186148\git\Kylo-Accelerator
 > git.exe --version # timeout=10
 > git.exe fetch --tags --progress C:\Users\ak186148\git\Kylo-Accelerator +refs/heads/*:refs/remotes/origin/*
 > git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
 > git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10
Checking out Revision e8ad0282a7fbd877461b3866a15f0116b2848065 (refs/remotes/origin/master)
 > git.exe config core.sparsecheckout # timeout=10
 > git.exe checkout -f e8ad0282a7fbd877461b3866a15f0116b2848065
Commit message: "Add initial Jenkinsfile"
 > git.exe rev-list --no-walk e8ad0282a7fbd877461b3866a15f0116b2848065 # timeout=10
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] sh
[C:\Users\ak186148\.jenkins\workspace\Kylo-Promoter-CI-CD] Running shell script
nohup: failed to run command 'sh': No such file or directory
process apparently never started in C:\Users\ak186148\.jenkins\workspace\Kylo-Promoter-CI-CD@tmp\durable-b24ab647
[Pipeline] sh
[C:\Users\ak186148\.jenkins\workspace\Kylo-Promoter-CI-CD] Running shell script
nohup: failed to run command 'sh': No such file or directory
process apparently never started in C:\Users\ak186148\.jenkins\workspace\Kylo-Promoter-CI-CD@tmp\durable-5e2947b3
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code -2
Finished: FAILURE

Please find attached my Jenkinsfile (i've changed from sh to bat)

pipeline {
    agent {
        docker {
            image 'maven:3-alpine' 
            args '-v /root/.m2:/root/.m2' 
        }
    }
    stages {
        stage('Build') 
        { 
            steps {
                bat 'mvn -B -DskipTests clean package' 
            }
        }
    }
}

Also please find below the error on blue ocean page blue_ocean_error

Please help.

Akshay Katti
  • 29
  • 1
  • 7
  • I'm getting this exact error, though my pipeline declaration is somewhat different. If you ever figured it out, it would help greatly if you could post the answer here, because even if I posted a new question, it would get closed as a duplicate of yours anyway. – Hakanai Oct 26 '18 at 01:13
  • Did you guys figure anything out? Seems to be an issue due to Jenkins->Docker interaction. I'm running Docker as a command, but it seems to be related to using a non-root user. https://medium.com/@garunski/how-to-set-up-a-local-pipeline-in-jenkins-and-kubernetes-10e9cf77f6fd – Dustin Oprea Jan 17 '19 at 05:12

2 Answers2

2

This 'process apparently never started' is a generic error that can have different causes, so:

  1. Check that you're using the latest DurableTask plugin for your Jenkins server version, because versions < 1.28 of that plugin can cause this specific error (more info) so let's eliminate that first suspect.
  2. If 1. is not applicable or did not work, as per the previous answer, the trick is to get more information on what actually causes the error, and for that you can:
    1. Execute org.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true in Jenkins's Script Console to debug (requires to be a Jenkins admin), and restart your job to see if there are useful new info in the job console output
    2. Activate the logs mentioned in the previous answer, but you don't need to restart Jenkins or have access to the server that hosts Jenkins, you only have to be a Jenkins Admin and use the 'System Logs' administration page to create a log recorder for org.jenkinsci.plugins.durabletask and restart your job to see if there are useful new info in your custom log recorder.

In my case, activating the LAUNCH_DIAGNOSTICS via System Console gave me the following error:

nohup: impossible d'exécuter la commande « sh »: Aucun fichier ou dossier de ce type

Clearly, something wrong with the PATH. This answer on a similar question then helped me notice that this was caused by the modification of the PATH environment variable in the System Configuration page.

cmousset
  • 625
  • 7
  • 21
0

I'm not sure that you can get it running on Windows (easily).

For me the issue was that the right nohup was not on PATH.

To debug the issue I've started java -Djava.util.logging.config.file=logging.properties -jar jenkins.war after I've created the file logging.properties with the content:

org.jenkinsci.plugins.durabletask.level=FINE
handlers= java.util.logging.ConsoleHandler

java.util.logging.ConsoleHandler.level=FINE
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter

After that I've added the nohup (and sh...) from C:\Program Files\Git\usr\bin to PATH.


Even after setting the drive C: as a shared drive in the Docker settings things didn't get any better.

$ docker run -t -d -u 197609:197121 \
-w C:\Users\A\.jenkins\workspace\Multibranch_pipeline_master@2 \
-v C:\Users\A\.jenkins\workspace\Multibranch_pipeline_master@2:C:\Users\A\.jenkins\workspace\Multibranch_pipeline_master@2:rw,z \
-v C:\Users\A\.jenkins\workspace\Multibranch_pipeline_master@2@tmp:C:\Users\A\.jenkins\workspace\Multibranch_pipeline_master@2@tmp:rw,z \
-e ******** ... \
maven:3.3.3 cat

java.io.IOException: Failed to run image 'maven:3.3.3'. 
  Error: docker: Error response from daemon: the working directory 
  'C:\Users\A\.jenkins\workspace\Multibranch_pipeline_master@2' is invalid, 
  it needs to be an absolute path.

So the paths used should be something like /C/... instead of C:\....

Andrei Damian-Fekete
  • 1,820
  • 21
  • 27