ium_z487175/Jenkinsfile-evaluation

52 lines
1.7 KiB
Plaintext
Raw Normal View History

2023-06-08 08:12:42 +02:00
pipeline{
agent any
2023-06-08 09:01:31 +02:00
parameters {
gitParameter(
name: 'BRANCH',
type: 'branch',
defaultValue: 'master',
description: 'Select the branch of training'
)
2023-06-08 12:04:06 +02:00
buildSelector(
name: 'BUILD_SELECTOR',
description: 'Which build to use for copying artifacts',
defaultSelector: lastSuccessful()
)
2023-06-08 09:01:31 +02:00
}
2023-06-08 08:12:42 +02:00
stages{
stage('Copy model artifacts with test dataset') {
steps {
2023-06-08 10:51:51 +02:00
script {
2023-06-08 11:59:30 +02:00
// Biblioteka w Jenkis automatycznie dopisuje origin przed nazwą brancha
// dlatego wprowadziłem poniższe przekształcenie
def branchName = params.BRANCH ?: 'master'
2023-06-08 12:01:46 +02:00
branchName = branchName.replaceFirst('origin/', '')
2023-06-08 11:59:30 +02:00
def myProject = "z-s487175-training/${branchName}"
2023-06-08 10:51:51 +02:00
copyArtifacts(
projectName: myProject,
fingerprintArtifacts: true,
2023-06-08 12:07:38 +02:00
selector: build(name: params.BUILD_SELECTOR)
2023-06-08 10:51:51 +02:00
)
}
2023-06-08 08:12:42 +02:00
}
}
2023-06-08 11:38:03 +02:00
stage('Prediction'){
2023-06-08 08:12:42 +02:00
steps{
2023-06-08 11:47:06 +02:00
sh "docker run -v ${env.WORKSPACE}:/app ium chmod 777 /app/model_with_data.pickle"
sh "docker run -v ${env.WORKSPACE}:/app ium python3 /app/DL-prediction.py"
2023-06-08 08:12:42 +02:00
}
}
stage('Archive prediction results'){
steps{
sh "docker cp \$(docker ps -l -q):/app/results_prediction.csv ${env.WORKSPACE}"
archiveArtifacts artifacts: 'results_prediction.csv', fingerprint: true
}
}
}
}