update jenkinsfile

This commit is contained in:
Maciej Czajka 2022-03-25 21:15:44 +01:00
parent f8f5eab816
commit 2733ccab0b

59
Jenkinsfile vendored
View File

@ -1,31 +1,25 @@
pipeline { pipeline {
agent any agent any
//Definiujemy parametry, które będzie można podać podczas wywoływania zadania
parameters { parameters {
string( string(
defaultValue: 'Hello World!', defaultValue: 'maciejczajka',
description: 'Tekst, którym chcesz przywitać świat', description: 'Kaggle username',
name: 'INPUT_TEXT', name: 'KAGGLE_USERNAME',
trim: false 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'
)
} }
stages { environment {
stage('Hello') { KAGGLE_USERNAME="$params.KAGGLE_USERNAME"
steps { KAGGLE_KEY="$params.KAGGLE_KEY"
//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'
}
} }
stages {
stage('Checkout'){ stage('Checkout'){
steps { steps {
checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[credentialsId: 's444356', url: 'https://git.wmi.amu.edu.pl/s444356/ium_444356.git']]]) checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[credentialsId: 's444356', url: 'https://git.wmi.amu.edu.pl/s444356/ium_444356.git']]])
@ -34,34 +28,15 @@ pipeline {
stage('Script'){ stage('Script'){
steps { steps {
sh './download.sh' script {
}
}
stage('Preparation') {
properties([
parameters([
string(
defaultValue: 'maciejczajka',
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}", withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}",
"KAGGLE_KEY=${params.KAGGLE_KEY}" ]) { "KAGGLE_KEY=${params.KAGGLE_KEY}" ]) {
sh 'echo KAGGLE_USERNAME: $KAGGLE_USERNAME' sh 'echo KAGGLE_USERNAME: $KAGGLE_USERNAME'
sh 'kaggle datasets list' sh 'kaggle datasets list'
} }
} }
sh './download.sh'
}
}
} }
} }