Hi everyone,
I've implemented new pipeline as code feature with a docker image as build environment.
I can do checkout, docker pull, docker run, etc. but my issue is about sh inside a docker run (via docker.inside).
My sh is executed but I don't have any console write from the sh (in my case an ANT Script). If I run the script manualy in the container, the logs are displayed on the console.
Is anything wrong in my pipeline, or do I miss something to get logs ?
Regards,
PS : Here's my pipeline and the build console (I removed some custom data)
<PIPELINE>
stage 'Build'
node('docker'){
checkout( ...)
buildImgName='internal/build:latest'
docker.image(buildImgName).pull()
}
try{
echo "start build container and execute ANT"
buildImg.inside( " --link ${DB_ID}:db ") {
// Run the ant build <<<<<<<<<<<<<<<<< here's the missing logs >>>>>>>>>>>>>>>>
sh '''#!/bin/bash
/tools/ant/latest/bin/ant -f /opt/build/build.xml build 2>&1'''
}
}
catch(all){
println("Exception "+all)
}
<PIPELINE>
<CONSOLE>
Started by user Ludovic Smadja
Entering stage Build
Proceeding
[Pipeline] Allocate node : Start
[Pipeline] node {
[Pipeline] General Build Wrapper : Start
[Pipeline] wrap {
[Pipeline] Set environment variables : Start
[Pipeline] withEnv {
[Pipeline] Sets up Docker registry endpoint : Start
[Pipeline] withDockerRegistry {
[Pipeline] sh
00:00:31.001 [JCMS] Running shell script
[Pipeline] echo
00:02:04.944 start build container and execute ANT
[Pipeline] sh
00:02:04.960 [JCMS] Running shell script
00:02:05.223 .
[Pipeline] Run build steps inside a Docker container : Start
[Pipeline] withDockerContainer {
[Pipeline] sh
00:02:05.931 [JCMS] Running shell script
00:02:06.578 Buildfile: /opt/build/build.xml
<<<<<<<<<<<<<<<<<<<<< no console logs from ANT Script >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[Pipeline] } //withDockerContainer
[Pipeline] Run build steps inside a Docker container : End
[Pipeline] echo
00:02:16.948 Exception hudson.AbortException: script returned exit code -1
[Pipeline] step
00:02:16.956 Archiving artifacts
00:02:17.061 Recording fingerprints
[Pipeline] step
00:02:17.152 Recording test results
[Pipeline] } //wrap
[Pipeline] General Build Wrapper : End
[Pipeline] } //node
[Pipeline] Allocate node : End
[Pipeline] End of Pipeline
ERROR: Aucun fichier de rapport de test n'a été trouvé. Erreur de configuration?
Finished: FAILURE
<CONSOLE>