I tried to verify the correct operation of a Java encoded web server. I did it in the following way:
pipeline {
agent {
docker { image 'maven:3.3-jdk-8' }
}
options {
timeout(time: 10, unit: 'SECONDS')
ansiColor('xterm')
}
stages {
stage('Testing') {
steps {
sh 'nohup "mvn exec:java" &'
sh 'curl http://localhost:8066'
}
}
}
}
The process stops on the first sh and subsequently gives a timeout error. It seems that nohup doesn't work as expected.
With interactive terminal I get what I want, but with jenkins not.
docker run -it --rm --name my-project -v "$(pwd)":/usr/src/mymaven -w /usr/src/mymaven maven:3.3-jdk-8 nohup "mvn exec:java" & curl http://localhost:8066
Aucun commentaire:
Enregistrer un commentaire