ium_444417/Jenkinsfile.eval

55 lines
2.0 KiB
Plaintext
Raw Normal View History

2022-05-03 20:47:24 +02:00
pipeline {
2022-05-21 12:23:28 +02:00
agent {
docker {
image 'mikolajk/ium:mlflow'
args '-v /mlruns:/mlruns'
}
2022-05-03 22:12:57 +02:00
}
2022-05-04 15:54:17 +02:00
parameters{
2022-05-07 11:15:37 +02:00
gitParameter branchFilter: 'origin/(.*)', defaultValue: 'master', name: 'BRANCH', type: 'PT_BRANCH'
2022-05-07 11:14:13 +02:00
buildSelector(
defaultSelector: lastSuccessful(),
description: 'Which build to use for copying artifacts',
name: 'BUILD_SELECTOR'
)
2022-05-04 15:54:17 +02:00
}
2022-05-03 20:47:24 +02:00
stages {
2022-05-03 22:54:23 +02:00
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
}
}
}
}
}
2022-05-03 20:47:24 +02:00
stage('Copy') {
steps {
2022-05-04 16:49:47 +02:00
copyArtifacts projectName: 's444417-create-dataset'
2022-05-07 11:14:13 +02:00
copyArtifacts projectName: "s444417-training/${params.BRANCH}/", selector: buildParameter('BUILD_SELECTOR'), optional: true
2022-05-03 22:16:47 +02:00
sh 'python3 ./src/evalScript.py'
2022-05-07 12:12:25 +02:00
archiveArtifacts 'trainResults.csv, metrics.png'
2022-05-07 12:01:19 +02:00
script {
2022-05-21 12:23:28 +02:00
metric = sh (
2022-05-07 12:07:02 +02:00
script: 'tail -1 trainResults.csv',
2022-05-07 12:00:05 +02:00
returnStdout: true
2022-05-21 12:23:28 +02:00
).trim()
2022-05-07 12:01:19 +02:00
}
2022-05-07 11:56:13 +02:00
}
}
2022-05-03 20:47:24 +02:00
}
post {
always {
2022-05-07 11:56:13 +02:00
emailext body: "${currentBuild.currentResult}, (number, loss): ${metric}", subject: 's444417-evaluation build status', to: 'e19191c5.uam.onmicrosoft.com@emea.teams.ms'
2022-05-03 20:47:24 +02:00
}
}
}