2024-04-19 11:40:54 +02:00
|
|
|
pipeline {
|
|
|
|
agent any
|
|
|
|
|
2024-04-19 12:26:46 +02:00
|
|
|
parameters {
|
|
|
|
gitParameter(
|
|
|
|
branchFilter: 'origin/(.*)',
|
|
|
|
defaultValue: 'origin/main',
|
|
|
|
description: 'Branch to build',
|
|
|
|
name: 'BRANCH'
|
|
|
|
)
|
|
|
|
buildSelector(
|
|
|
|
defaultSelector: lastSuccessful(),
|
|
|
|
description: 'Build to extract artifacts from',
|
|
|
|
name: 'BUILD_SELECTOR'
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2024-04-19 11:40:54 +02:00
|
|
|
stages {
|
|
|
|
stage('Clone repository') {
|
|
|
|
steps {
|
|
|
|
checkout scm
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Copy artifacts') {
|
|
|
|
agent {
|
|
|
|
dockerfile {
|
|
|
|
filename 'Dockerfile'
|
|
|
|
reuseNode true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
steps {
|
2024-04-19 12:31:19 +02:00
|
|
|
script {
|
|
|
|
def projectName = "s464863-training/${params.BRANCH}".replace('origin/', '')
|
|
|
|
echo "Project name: ${projectName}"
|
|
|
|
def projectName2 = "z-s464863-create-dataset/${params.BRANCH}"
|
|
|
|
echo "Project name: ${projectName2}"
|
|
|
|
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)
|
|
|
|
}
|
2024-04-19 11:40:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Evaluate model') {
|
|
|
|
agent {
|
|
|
|
dockerfile {
|
|
|
|
filename 'Dockerfile'
|
|
|
|
reuseNode true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
steps {
|
|
|
|
sh "chmod +x ./predict.py"
|
|
|
|
sh "python3 ./predict.py"
|
2024-04-19 12:02:09 +02:00
|
|
|
archiveArtifacts artifacts: 'predictions.csv, metrics.csv, metrics.png', onlyIfSuccessful: true
|
2024-04-19 11:40:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|