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: 'z-s444510-create-dataset', selector: buildParameter('BUILD_SELECTOR') } } stage('Calculate Dataset Statistics') { steps { sh 'chmod +x dataset-stats.sh' sh './dataset-stats.sh' } post { always { archiveArtifacts artifacts: 'stats.txt.gz', fingerprint: true } } } } }