pipeline { agent { dockerfile true } parameters{ buildSelector( defaultSelector: lastSuccessful(), description: 'Which build to use for copying artifacts', name: 'WHICH_BUILD' ) } stages { stage('checkout') { steps { git 'https://git.wmi.amu.edu.pl/s440058/ium_440058.git' copyArtifacts fingerprintArtifacts: true, projectName: 's440058-create-dataset', selector: buildParameter('BUILD_SELECTOR') } } stage('sh: Shell Script') { steps { sh 'chmod +x ./bash2.sh' sh './bash2.sh' } } stage('DVC') { steps { withCredentials([sshUserPrivateKey(credentialsId: '48ac7004-216e-4260-abba-1fe5db753e18', keyFileVariable: 'IUM_SFTP_KEY')]) { copyArtifacts fingerprintArtifacts: true, projectName: 's440058-create-dataset', selector: buildParameter('WHICH_BUILD') sh "dvc init -f" sh "dvc remote add -d ium_ssh_remote ssh://ium-sftp@tzietkiewicz.vm.wmi.amu.edu.pl/ium-sftp" sh "dvc remote modify --local ium_ssh_remote keyfile $IUM_SFTP_KEY" sh "dvc pull -f" sh "dvc reproduce" } } } } post { success { build job: 's440058-dvc' mail body: 'SUCCESS TRAINING', subject: 's440058', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms' } failure { mail body: 'FAILURE DVC', subject: 's440058', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms' } } }