pipeline { agent any properties([parameters([ buildSelector( defaultSelector: lastSuccessful(), description: 'Which build to use for copying artifacts', name: 'BUILD_SELECTOR') ])]) stages { stage('Clone repository') { steps { git branch: 'master', url: 'https://git.wmi.amu.edu.pl/s487176/ium_487176' } } stage('Copy Artifacts') { steps { script { projectName: 'z-s487176-create-dataset', fingerprintArtifacts: true, selector: buildParameter('BUILD_SELECTOR') } } } stage('Run script') { steps { sh 'sh datastats.sh' } post { always { archiveArtifacts artifacts: 'stats.txt', allowEmptyArchive: true } } } } } }