pipeline { agent any parameters { buildSelector( defaultSelector: lastSuccessful(), description: 'Which build to use for copying artifacts', name: 'BUILD_SELECTOR') } stages { stage('copy artifacts') { steps { copyArtifacts fingerprintArtifacts: true, projectName: 's470607-create-dataset', selector: buildParameter('BUILD_SELECTOR') } } stage('stats') { steps { sh 'chmod +x dataset-stats.sh' } } stage('archive artifacts') { steps { archiveArtifacts 'stats.txt' } } } }