From b000b5f2482c6f7a29f0c909cf66bcbecf10a014 Mon Sep 17 00:00:00 2001 From: Mateusz Kuc Date: Thu, 20 Apr 2023 17:45:07 +0200 Subject: [PATCH] updated Jenkinsfile - added kaggle and docker stages/steps --- Jenkinsfile | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c132349..2dcda53 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,10 +1,68 @@ pipeline { agent any + + parameters{ + string( + defaultValue: 'mattkrawl', + description: 'Kaggle username', + name: 'KAGGLE_USERNAME', + trim: false + ) + password( + defaultValue: '8e6132e627c5c176f7e19d880270d22e', + description: 'Kaggle token taken from kaggle.json file, as described in https://github.com/Kaggle/kaggle-api#api-credentials', + name: 'KAGGLE_KEY' + ) + string( + defaultValue: '500', + description: 'CUTOFF', + name: 'CUTOFF', + trim: false + ) + } stages { - stage('Stage 1') { + stage('clear_all') { steps { - echo 'Hello world from GitHub!' + sh 'rm -rf *' } } + + stage('Build'){ + steps{ + //cloning github + sh 'git clone https://git.wmi.amu.edu.pl/s458023/ium_458023' + + //running Build + withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}", + "KAGGLE_KEY=${params.KAGGLE_KEY}" ]) { + // downloading and unzipping kaggle dataset + sh 'kaggle datasets download -d arnabchaki/data-science-salaries-2023' + sh 'unzip data-science-salaries-2023.zip -d ./ium_458023' + + // removing zip file + sh 'rm data-science-salaries-2023.zip' + sh 'ls -a' + sh 'ls -a ./ium_458023' + + } + } + } + stage('Docker'){ + agent{ + dockerfile{ + filename 'Dockerfile' + dir 'ium_458023' + reuseNode true + } + } + steps{ + sh 'ls -a' + sh 'python .ium_458023/create_dataset.py' + archiveArtifacts 'salary_test.csv' + archiveArtifacts 'salary_dev.csv' + archiveArtifacts 'salary_train.csv' + } + } + } } \ No newline at end of file