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.withRegistry('https://docker-registry.jalios.net/',
'docker-registry-reader-login') {
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
Running on jdocker.jalios.net in /home/jenkins/workspace/Core/JCMS
[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
00:00:59.050 Status: Downloaded newer image for
docker-registry.jalios.net/internal/build:latest
[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 + docker inspect -f .
docker-registry.jalios.net/internal/build:latest
00:02:05.223 .
[Pipeline] Run build steps inside a Docker container : Start
00:02:05.349 $ docker run -t -d -u 5001:5001 --link
f1eae2e5faaf7e5b1a62f38789eb046866275c238fcfd65589c56371b98b5719:db -w
/home/jenkins/workspace/Core/JCMS -v
/home/jenkins/workspace/Core/JCMS:/home/jenkins/workspace/Core/JCMS:rw -v
/home/jenkins/workspace/Core/JCMS@tmp:/home/jenkins/workspace/Core/JCMS@tmp:rw
-e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e
******** -e ******** -e ******** -e ******** -e ******** -e ******** -e
******** -e ******** -e ******** -e ******** -e ******** -e ********
docker-registry.jalios.net/internal/build:latest cat
[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>
--
Ludovic SMADJA
R&D engineer - build process and development
JALIOS SA
http://www.jalios.com
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/dd0d276f-6418-4d60-a659-39134ff9c92c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.