From d83fc314341c8e1dc05def1c7048b15b32373ad9 Mon Sep 17 00:00:00 2001 From: s464953 Date: Wed, 20 Mar 2024 15:08:18 +0100 Subject: [PATCH] Jenkinsfile update --- Jenkinsfile | 54 ++++++++++++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1ab6ee0..ab8c194 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,29 +1,27 @@ -pipeline { - agent any - //Definijuemy parametry, które będzie można podać podczas wywoływania zadania - parameters { - string ( - defaultValue: 'Hello World!', - description: 'Tekst, którym chcesz przywitać świat', - name: 'INPUT_TEXT', - trim: false - ) - } - stages { - stage('Hello') { - steps { - //Wypisz wartość parametru w konsoli (To nie jest polecenie bash, tylko groovy!) - echo "INPUT_TEXT: ${INPUT_TEXT}" - //Wywołaj w konsoli komendę "figlet", która generuje ASCI-art - sh "figlet \"${INPUT_TEXT}\" | tee output.txt" - } - } - stage('Goodbye!') { - steps { - echo 'Goodbye!' - //Zarchiwizuj wynik - archiveArtifacts 'output.txt' - } - } - } +node { + stage('Preparation') { + properties([ + parameters([ + string( + defaultValue: 'tomaszzitkiewicz', + 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' + ) + ]) + ]) + } + stage('Build') { + // Run the maven build + withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}", + "KAGGLE_KEY=${params.KAGGLE_KEY}" ]) { + sh 'echo KAGGLE_USERNAME: $KAGGLE_USERNAME' + sh 'kaggle datasets list' + } + } } \ No newline at end of file