From 888d8a1fc657ab74c6b6436688cb2060b25b4e08 Mon Sep 17 00:00:00 2001 From: s444417 Date: Thu, 24 Mar 2022 18:21:38 +0100 Subject: [PATCH] add env var --- Jenkinsfile | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a5e290a..231bbb5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,9 +1,31 @@ pipeline { agent any stages { - stage("Hello") { - steps { - echo "Start.." + stage('Preparation') { + properties([ + parameters([ + string( + defaultValue: 'mikolaj2', + description: 'Kaggle username', + name: 'KAGGLE_USERNAME', + trim: false + ), + password( + defaultValue: '', + description: 'Kaggle token taken from kaggle.json file, as described in https://github.com/Kaggle/kaggle-api#api-credentials', + name: 'KAGGLE_KEY' + ) + string( + defaultValue: '', + description: 'Value for head command', + name: 'CUTOFF' + ) + ]) + ]) + environment { + KAGGLE_USERNAME="$params.KAGGLE_USERNAME" + KAGGLE_KEY="$params.KAGGLE_KEY" + CUTOFF="$params.CUTOFF" } } stage("Check out from version control") { @@ -11,10 +33,10 @@ pipeline { checkout scm } } - stage("Shell Script") { steps { sh "chmod u+x ./startscript.sh" + sh "KAGGLE_USERNAME=${KAGGLE_USERNAME} KAGGLE_KEY=${KAGGLE_KEY} CUTOFF=${CUTOFF} ./startscript.sh" archiveArtifacts 'data.txt' } }