Update Jenkinsfile

This commit is contained in:
Alicja Szulecka 2024-04-29 21:02:47 +02:00
parent bc60304c8a
commit 66d15ac8f4

27
Jenkinsfile vendored
View File

@ -11,38 +11,17 @@ pipeline {
checkout scm checkout scm
} }
} }
stage('Download dataset') { stage('Copy Artifacts') {
steps { steps {
withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}", "KAGGLE_KEY=${params.KAGGLE_KEY}"]) { copyArtifacts fingerprintArtifacts: true, projectName: 'z-s464914-create-dataset', selector: buildParameter('BUILD_SELECTOR')
sh 'pip install kaggle'
sh 'kaggle datasets download -d uciml/forest-cover-type-dataset'
sh 'unzip -o forest-cover-type-dataset.zip'
sh 'rm forest-cover-type-dataset.zip'
} }
} }
} stage('Train') {
stage('Build') {
steps {
script {
withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}",
"KAGGLE_KEY=${params.KAGGLE_KEY}" ]) {
def customImage = docker.build("custom-image")
customImage.inside {
sh 'python3 ./IUM_2.py'
archiveArtifacts artifacts: 'covtype.csv, forest_train.csv, forest_test.csv, forest_val.csv', onlyIfSuccessful: true
}
}
}
}
}
stage('Train and Predict') {
steps { steps {
script { script {
def customImage = docker.build("custom-image") def customImage = docker.build("custom-image")
customImage.inside { customImage.inside {
sh 'python3 ./model.py' sh 'python3 ./model.py'
sh 'python3 ./prediction.py'
archiveArtifacts artifacts: 'model.pth, predictions.txt', onlyIfSuccessful: true archiveArtifacts artifacts: 'model.pth, predictions.txt', onlyIfSuccessful: true
} }
} }