pipeline { agent any parameters { buildSelector ( defaultSelector: lastSuccessful(), description: 'Which build to use for copying artifacts', name: 'BUILD_SELECTOR' ) string ( name: 'EPOCHS', defaultValue: '35', description: 'Epochs to train' ) } stages { stage('Checkout repository') { steps { checkout scm } } stage('Copy artifacts') { steps { copyArtifacts fingerprintArtifacts: true, projectName: 'z-s464980-create-dataset', selector: buildParameter('BUILD_SELECTOR') } } stage("Training") { agent { dockerfile { filename 'Dockerfile' reuseNode true } } steps { sh "chmod +x ./train.py" sh "python ./train.py --epochs ${params.EPOCHS}" archiveArtifacts artifacts: 'model.keras', onlyIfSuccessful: true } } } }