ium_440058/dvc/Jenkinsfile

76 lines
2.8 KiB
Plaintext
Raw Normal View History

2021-06-11 19:03:42 +02:00
pipeline {
2021-06-11 19:19:31 +02:00
agent {
dockerfile true
}
parameters{
2021-06-11 19:03:42 +02:00
buildSelector(
defaultSelector: lastSuccessful(),
description: 'Which build to use for copying artifacts',
name: 'WHICH_BUILD'
)
2021-06-11 19:19:31 +02:00
}
stages {
2021-06-11 19:23:23 +02:00
stage('One') {
properties([
parameters([
string(defaultValue: '',
description: 'Kaggle username',
name: 'KAGGLE_USERNAME',
trim: false),
password(defaultValue: '',
description: 'Kaggle token',
name: 'KAGGLE_KEY'),
string(defaultValue: '1000',
description: 'Data cutoff',
name: 'CUTOFF',
trim: false)
])
]
)
stage('Two') {
withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}",
"KAGGLE_KEY=${params.KAGGLE_KEY}", "CUTOFF=${params.CUTOFF}" ]) {
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[url: 'https://git.wmi.amu.edu.pl/s440058/ium_440058']]])
checkout scm
def image = docker.build("s440058/ium")
image.inside {
sh 'python3 ./pytorch-example.py > model.txt'
sh "chmod 777 ./bash.sh"
sh "./bash.sh"
archiveArtifacts "courses.data.dev"
archiveArtifacts "courses.data.test"
archiveArtifacts "courses.data.train"
archiveArtifacts 'model.txt'
}
2021-06-11 19:03:42 +02:00
}
}
2021-06-11 19:19:31 +02:00
stage('DVC') {
steps {
withCredentials([sshUserPrivateKey(credentialsId: '48ac7004-216e-4260-abba-1fe5db753e18', keyFileVariable: 'IUM_SFTP_KEY')]) {
copyArtifacts fingerprintArtifacts: true, projectName: 's440058-create-dataset', selector: buildParameter('WHICH_BUILD')
sh "dvc init -f"
sh "dvc remote add -d ium_ssh_remote ssh://ium-sftp@tzietkiewicz.vm.wmi.amu.edu.pl/ium-sftp"
sh "dvc remote modify --local ium_ssh_remote keyfile $IUM_SFTP_KEY"
sh "dvc pull"
sh "dvc reproduce"
}
2021-06-11 19:03:42 +02:00
}
}
}
2021-06-11 19:19:31 +02:00
2021-06-11 19:03:42 +02:00
post {
success {
2021-06-11 19:19:31 +02:00
build job: 's440058-dvc'
2021-06-11 19:03:42 +02:00
mail body: 'SUCCESS TRAINING', subject: 's440058', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms'
}
failure {
mail body: 'FAILURE TRAINING', subject: 's440058', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms'
}
}
}