ium_s449288/lab7/Jenkinsfile_eval
Kacper 8e3e206cca
Some checks failed
s449288-evaluation/pipeline/head There was a failure building this commit
s449288-training/pipeline/head There was a failure building this commit
split everything into per-lab repos
2022-05-12 22:30:38 +02:00

62 lines
2.6 KiB
Plaintext

pipeline {
agent {
dockerfile {
dir 'lab7'
}
}
parameters {
gitParameter branchFilter: 'origin/(.*)', defaultValue: 'master', name: 'BRANCH', type: 'PT_BRANCH'
buildSelector(
defaultSelector: lastSuccessful(),
description: 'Which build to use for copying artifacts',
name: 'BUILD_SELECTOR'
)
}
stages {
stage('Stage 1') {
steps {
git branch: "${params.BRANCH}", url: 'https://git.wmi.amu.edu.pl/s449288/ium_s449288.git'
sh 'chmod u+x ./lab7/evaluate.py'
echo 'Copying datasets from the create-dataset job...'
copyArtifacts filter: 'lab7/lego_sets_clean_test.csv', projectName: 's449288-create-dataset'
echo 'Datasets copied'
echo 'Copying model from the training job...'
copyArtifacts filter: 'lab7/lego_reg_model.tar.gz', projectName: "s449288-training/${BRANCH}/", selector: buildParameter('BUILD_SELECTOR')
echo 'Model copied'
sh 'tar xvzf lab7/lego_reg_model.tar.gz'
echo 'Optional copying of the metrics file from previous build...'
copyArtifacts filter: 'lab7/eval_results.txt', projectName: 's449288-evaluation/master/', optional: true
echo 'Metrics file copied if it did not exist'
echo 'Evaluating model...'
sh 'python3 lab7/evaluate.py'
echo 'Model evaluated. Metrics saved. Plot saved.'
sh 'head lab7/eval_results.txt'
sh 'file lab7/error_plot.jpg'
echo 'Archiving metrics file...'
archiveArtifacts 'lab7/eval_results.txt'
echo 'File archived'
script {
LAST_MAE = sh (
script: 'tail -1 lab7/eval_results.txt',
returnStdout: true
).trim()
}
}
}
}
post {
success {
emailext body: "SUCCESS - ${LAST_MAE} MAE", subject: 's449288-evaluation build status', to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms'
}
failure {
emailext body: "FAILURE - ${LAST_MAE} MAE", subject: 's449288-evaluation build status', to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms'
}
unstable {
emailext body: "UNSTABLE - ${LAST_MAE} MAE", subject: 's449288-evaluation build status', to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms'
}
changed {
emailext body: "CHANGED - ${LAST_MAE} MAE", subject: 's449288-evaluation build status', to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms'
}
}
}