I am trying to build my project with Jenkins and pipeline plugin in docker container. My Jenkinsfile
looks like this:
node('docker') {
docker.image('build-node:1').inside {
stage 'scm checkout'
checkout scm
stage 'maven build'
sh "mvn -B clean > mvn.log"
}
}
In Jenkins log:
...
Entering stage maven build
Proceeding
[Pipeline] sh
[versioning] Running shell script
+ mvn -B clean
[Pipeline] }
$ docker stop ***
$ docker rm -f ***
[Pipeline] // withDockerContainer
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code -1
Finished: FAILURE
In mvn.log I see all is ok:
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: X.XXX s
[INFO] Finished at: 2016-XX-XXTXX:XX:XX+XX:XX
[INFO] Final Memory: XXM/XXXM
[INFO] ------------------------------------------------------------------------
Where is an error or how determine it?
My Jenkins server is docker container form docker hub, which using docker server as a node.
New check:
try {
sh 'mvn clean | tee mvn.log'
} catch (e) {
println "Maven failed : ${e}"
}
Output:
[versioning] Running shell script
+ mvn clean
+ tee mvn.log
[Pipeline] echo
Maven failed : hudson.AbortException: script returned exit code -1
mvn.log:
[INFO] BUILD SUCCESS