From 1185a707a927689ea284767ece4829a8f0ab6deb Mon Sep 17 00:00:00 2001 From: patrycjalazna Date: Fri, 14 May 2021 19:29:48 +0200 Subject: [PATCH] changed Jenkinsfiles filenames --- evaluation.Jenkinsfile | 68 ++++++++++++++++++++++++++++++++++++++++++ training.Jenkinsfile | 61 +++++++++++++++++++++++++++++++++++++ 2 files changed, 129 insertions(+) create mode 100644 evaluation.Jenkinsfile create mode 100644 training.Jenkinsfile diff --git a/evaluation.Jenkinsfile b/evaluation.Jenkinsfile new file mode 100644 index 0000000..01d9bc2 --- /dev/null +++ b/evaluation.Jenkinsfile @@ -0,0 +1,68 @@ +pipeline { + agent { + dockerfile true + } + + parameters { + buildSelector( + defaultSelector: lastSuccessful(), + description: 'Which build to use for copying data artifacts', + name: 'BUILD_SELECTOR_DATASET' + ) + + buildSelector( + defaultSelector: lastSuccessful(), + description: 'Which build to use for copying training artifacts', + name: 'BUILD_SELECTOR_TRAINING' + ) + + buildSelector( + defaultSelector: lastSuccessful(), + description: 'Which build to use for copying evaluation artifacts', + name: 'BUILD_SELECTOR_EVALUATION' + ) + + gitParameter branchFilter: 'origin/(.*)', defaultValue: 'master', name: 'BRANCH', type: 'PT_BRANCH' + + } + + stages { + + stage('copy artifacts') + { + steps + { + copyArtifacts(fingerprintArtifacts: true, projectName: 's434742-create-dataset', selector: buildParameter('BUILD_SELECTOR_DATASET')) + copyArtifacts(fingerprintArtifacts: true, projectName: 's434742-training/master', selector: buildParameter('BUILD_SELECTOR_TRAINING')) + copyArtifacts(fingerprintArtifacts: true, optional:true, projectName: 's434742-evaluation/master', selector: buildParameter('BUILD_SELECTOR_EVALUATION')) + } + } + + stage('evaluation') { + steps { + script { + + sh 'chmod +x avocado-evaluation.py' + sh 'python3 avocado-evaluation.py' + + } + } + } + + stage('archiveArtifacts') { + steps{ + archiveArtifacts 'eval_results.txt' + archiveArtifacts 'eval_plot.png' + } + } + + + stage('sendMail') { + steps{ + emailext body: currentBuild.result ?: 'SUCCESS', + subject: 's434742 evaluation', + to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms' + } + } + } +} diff --git a/training.Jenkinsfile b/training.Jenkinsfile new file mode 100644 index 0000000..75cfae5 --- /dev/null +++ b/training.Jenkinsfile @@ -0,0 +1,61 @@ +pipeline { + agent any; + + options { + copyArtifactPermission('s434742-evaluation_master'); + } + + parameters { + buildSelector( + defaultSelector: lastSuccessful(), + description: 'Which build to use for copying artifacts', + name: 'BUILD_SELECTOR' + ) + string( + defaultValue: '16', + description: 'batch size', + name: 'BATCH_SIZE' + ) + string( + defaultValue: '10', + description: 'epochs', + name: 'EPOCHS' + ) + } + stages { + stage('copyArtifacts') { + steps { + copyArtifacts fingerprintArtifacts: true, projectName: 's434742-create-dataset', selector: buildParameter('BUILD_SELECTOR') + } + } + + stage('docker-training') { + steps { + script { + def img = docker.build('patlaz/ium:1.0') + img.inside { + sh 'chmod +x avocado-training.py' + sh 'echo ${EPOCHS} ${BATCH_SIZE}' + sh 'python3 avocado-training.py ${EPOCHS} ${BATCH_SIZE}' + + } + } + } + } + + + stage('archiveArtifacts') { + steps{ + archiveArtifacts 'avocado_model.h5' + } + } + + stage('sendMail') { + steps{ + emailext body: currentBuild.result ?: 'SUCCESS', + subject: 's434742 training', + to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms' + } + } + } +} \ No newline at end of file