ium_464863/evaluation/Jenkinsfile

59 lines
1.8 KiB
Groovy

pipeline {
agent any
parameters {
gitParameter(
branchFilter: 'origin/(.*)',
defaultValue: 'origin/main',
description: 'Branch to build',
name: 'BRANCH',
type: 'PT_BRANCH'
)
buildSelector(
defaultSelector: lastSuccessful(),
description: 'Build to extract model artifact from',
name: 'BUILD_SELECTOR'
)
}
stages {
stage('Clone repository') {
steps {
checkout scm
}
}
stage('Copy artifacts') {
agent {
dockerfile {
filename 'Dockerfile'
reuseNode true
}
}
steps {
script {
def projectName = "s464863-training/${params.BRANCH}".replace('origin/', '')
copyArtifacts(projectName: projectName, filter: 'models/model.pth', selector: buildParameter('BUILD_SELECTOR'))
copyArtifacts(projectName: 'z-s464863-create-dataset', filter: 'datasets/test.csv', selector: lastSuccessful())
copyArtifacts(projectName: 's464863-evaluation/main', filter: 'metrics.csv', selector: lastSuccessful(), optional: true)
}
}
}
stage('Evaluate model') {
agent {
dockerfile {
filename 'Dockerfile'
reuseNode true
}
}
steps {
sh "chmod +x ./predict.py"
sh "python3 ./predict.py"
archiveArtifacts artifacts: 'predictions.csv, metrics.csv, metrics.png', onlyIfSuccessful: true
}
}
}
}