pipeline { agent any parameters { string( defaultValue: 'z-s487177-create-dataset', description: 'Name of the project to copy artifacts from', name: 'PROJECT_NAME', trim: true ) buildSelector( description: 'Which build to use for copying artifacts', name: 'BUILD_SELECTOR', defaultSelector: 'lastSuccessful()' ) } stages { stage('Copy artifacts') { steps { copyArtifacts( fingerprintArtifacts: true, projectName: "${params.PROJECT_NAME}", selector: buildSelector("${params.BUILD_SELECTOR}") ) } } stage('Run script') { steps { sh ''' chmod +x dataset_stats.sh ./dataset_stats.sh > stats.txt ''' archiveArtifacts artifacts: 'stats.txt', fingerprint: true } } } }