From 1ef2173f25f0438555ee242da5041472c07abcdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20=C5=81=C4=85czkowski?= Date: Wed, 3 Apr 2024 21:02:18 +0200 Subject: [PATCH] IUM_04 - update Jenkinsfile - fix --- Jenkinsfile | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b88a286..3f06f49 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,10 @@ pipeline { - agent any + agent { + dockerfile { + filename 'Dockerfile' + reuseNode true + } + } parameters { password ( @@ -20,24 +25,20 @@ pipeline { } stages { - stage('Clone repository') { + stage('Checkout repository') { steps { checkout scm } } - stage('Build Docker image') { - steps { - docker.build("create-dataset-s464863") - } - } - stage('Download dataset and preprocess data') { steps { - docker.image('create-dataset-s464863').withRun('"-e KAGGLE_USERNAME=${params.KAGGLE_USERNAME}"','"-e KAGGLE_KEY=${params.KAGGLE_KEY}"','"-e CUTOFF=${params.CUTOFF}"') { - sh "chmod +x ./download_dataset.py" - sh "python3 ./download_dataset.py ${params.CUTOFF}" - archiveArtifacts artifacts: 'datasets/*', onlyIfSuccessful: true + script { + withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}", "KAGGLE_KEY=${params.KAGGLE_KEY}"]) { + sh "chmod +x ./download_dataset.py" + sh "python3 ./download_dataset.py ${params.CUTOFF}" + archiveArtifacts artifacts: 'datasets/*', onlyIfSuccessful: true sh "python preprocess.py --cutoff ${params.CUTOFF}" + } } } }