Jenkins pipeline files present in sh blocks not present in later steps

23 views
Skip to first unread message

Berndt Jung

unread,
May 10, 2017, 7:52:04 AM5/10/17
to Jenkins Users

I'm pretty new at this, but I'm stumped.


Here is my stage block

stage('Test') {
            steps {
                echo 'Testing ${env.JOB_NAME}:${env.BUILD_ID} on ${env.JENKINS_URL}..'
                sh """
                    docker run -v /tmp/work/report:/report ${env.REPO}:${env.BUILD_ID} ./manage.py jenkins --enable-coverage --output-dir=/report
                    ls /work/report
                    cat /work/report/*.xml
                """
                archiveArtifacts artifacts: '/work/report/*.xml'
                // junit '/work/report/*.xml'
            }
        }

The files are present in the 'sh' block, as the output of the ls and cat show. However, in the next step 'archiveArtifacts' and (if I enable it) junit, the files are not found. What am I missing?


Thanks in advance,


Berndt

Cuong Tran

unread,
May 10, 2017, 1:17:30 PM5/10/17
to Jenkins Users
The docs says you can only archive files in your workspace.  Try to write to the workspace instead:

    --output-dir=${WORKSPACE}/report
Reply all
Reply to author
Forward
0 new messages