From b6c4c15a773f4d7c9ef15eb0ca0c6688aeadfc9d Mon Sep 17 00:00:00 2001 From: Alicja Szulecka <73056579+AliSzu@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:13:40 +0200 Subject: [PATCH] Update Jenkinsfile --- Jenkinsfile | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a122078..5170583 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,30 +1,31 @@ pipeline { - agent { + agent { dockerfile { args '-v /var/run/docker.sock:/var/run/docker.sock' } } parameters { - string(name: 'KAGGLE_USERNAME', defaultValue: 'alicjaszulecka', description: 'Kaggle username') - password(name: 'KAGGLE_KEY', defaultValue:'', description: 'Kaggle Key') - string(name: 'CUTOFF', defaultValue: '100', description: 'cut off number') + string(name: 'KAGGLE_USERNAME', defaultValue: 'alicjaszulecka', description: 'Kaggle username') + password(name: 'KAGGLE_KEY', defaultValue:'', description: 'Kaggle Key') + string(name: 'CUTOFF', defaultValue: '100', description: 'cut off number') } stages { stage('Git Checkout') { steps { - checkout scm + checkout scm } } - stage('Build') { - steps { - script { - def customImage = docker.build("464914", "--build-arg KAGGLE_USERNAME=${params.KAGGLE_USERNAME} --build-arg KAGGLE_KEY=${params.KAGGLE_KEY} .") - customImage.inside { - sh 'bash ./get_dataset.sh ${params.CUTOFF}' - } - } - archiveArtifacts artifacts: 'artifacts/*', onlyIfSuccessful: true - } - } - } -} + stage('Build') { + steps { + withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}", + "KAGGLE_KEY=${params.KAGGLE_KEY}" ]) { + def customImage = docker.build("test-image", "--build-arg KAGGLE_USERNAME=${params.KAGGLE_USERNAME} --build-arg KAGGLE_KEY=${params.KAGGLE_KEY} .") + customImage.inside ( + sh 'bash ./get_dataset.sh $CUTOFF' + archiveArtifacts artifacts: 'artifacts/*', onlyIfSuccessful: true + ) + } + } + } + } +} \ No newline at end of file