pipeline { agent any parameters { buildSelector( defaultSelector: lastSuccessful(), name: 'BUILD_SELECTOR', description: 'Which build to use for copying artifacts' ) } stages { stage("Script") { steps { copyArtifacts fingerprintArtifacts: true, projectName: 's444507-create-dataset', selector: lastSuccessful() sh " ./stats.sh" archiveArtifacts 'lines.txt' sh './stats.sh' archiveArtifacts artifacts: 'stats.txt' } } } }