pipeline { agent { dockerfile true } parameters{ string( defaultValue: 's444417', description: 'JENKINS username', name: 'JENKINS_USERNAME' ) password( defaultValue: '', description: 'JENKINS password', name: 'JENKINS_KEY' ) } stages { stage('Copy prev build artifact') { steps { script { if (currentBuild.previousBuild) { try { copyArtifacts(projectName: currentBuild.projectName, selector: specific("${currentBuild.previousBuild.number}")) def previousFile = readFile(file: "trainResults.csv") echo("The current build is ${currentBuild.number}") echo("The previous build artifact was: ${previousFile}") } catch(err) { // ignore error } } } } } stage('Copy') { steps { copyArtifacts projectName: 's444417-training/master' sh 'python3 ./src/evalScript.py' archiveArtifacts 'trainResults.csv' sh "ls -la" } } } post { always { emailext body: "${currentBuild.currentResult}", subject: 's444417-evaluation build status', to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms' } } }