Declarative script not archiving artefacts

12 views
Skip to first unread message

David Aldrich

unread,
Jan 18, 2018, 5:13:39 AM1/18/18
to jenkins...@googlegroups.com

Hi

 

I have a declarative script that is not archiving the build artefacts. The structure of the script is:

 

pipeline {

    agent { label "sim07" }

    options { buildDiscarder(logRotator(numToKeepStr: '20')) }

 

    triggers {

        pollSCM('H 20 * * 1-5')

    }

 

    stages {

        stage('build_and_test') {

            steps {

                sh '''

                    /usr/bin/python3 -u my_regression_test.py

                '''

            }

 

            post {

                success {

                     emailext (subject: "${env.JOB_NAME}: Fixed!",

                               body: '${DEFAULT_CONTENT}',

                               recipientProviders: [[$class: 'CulpritsRecipientProvider']],

                              to: <snip>)

                     }

                failure {

                    script{ emailext (subject: "${env.JOB_NAME}: Failure!",

                                      body: '${DEFAULT_CONTENT}',

                                      recipientProviders: [[$class: 'CulpritsRecipientProvider']],

                                      to: <snip>)

                    }

                }

                unstable {

                    script{ emailext (subject: "${env.JOB_NAME}: Unstable!",

                                      body: '${DEFAULT_CONTENT}',

                                      to: <snip>)

                    }

                }

                always {

                    archiveArtifacts artifacts: '$WORKSPACE/RegressionTests/**/*.zip'

                }

            }

        }

    }

}

 

On the console output I see:

 

[Pipeline] archiveArtifacts

Archiving artifacts

[Pipeline] script

[Pipeline] {

[Pipeline] emailext

Sending email to: <snip>

[Pipeline] }

 

But no artefact files are listed (but they are present in the build directory).

 

Have I structured the ‘post’ section incorrectly?

 

Best regards

 

David

 

Björn Pedersen

unread,
Jan 18, 2018, 7:26:38 AM1/18/18
to Jenkins Users

                always {

                    archiveArtifacts artifacts: '$WORKSPACE/RegressionTests/**/*.zip'


The artifacts should be  specified relative to the workspace, so the $WORKSPACE/ seems wrong. archiveArtifact will not archive files outside the current workspace
 
Björn

David Aldrich

unread,
Jan 18, 2018, 8:36:01 AM1/18/18
to jenkins...@googlegroups.com

Thanks Björn

 

Removing $WORKSPACE/ fixed it.

 

Best regards

 

David

 

--
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 jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/26229d4c-7cdc-46e5-b5c2-2b1221bcd69e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Click here to report this email as spam.

Reply all
Reply to author
Forward
0 new messages