This commit is contained in:
Jakub Zaręba 2023-03-27 21:43:16 +02:00
parent e8348645a9
commit 23a869b2b8

111
Jenkinsfile vendored
View File

@ -1,45 +1,78 @@
node { pipeline {
stage('Preparation') { agent any
properties([
parameters([
string(
defaultValue: '',
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 '''
#!/bin/bash
pip install kaggle
kaggle datasets download nitishsharma01/olympics-124-years-datasettill-2020 stages {
stage('Preparation') {
unzip -o olympics-124-years-datasettill-2020.zip when { expression { true } }
steps {
echo "Processed Data" > output.txt script {
''' try {
properties([
parameters([
string(
defaultValue: '',
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'
)
])
])
} catch (err) {
error "Failed to set up parameters: ${err.message}"
}
}
}
} }
} stage('Build') {
when { expression { params.KAGGLE_USERNAME && params.KAGGLE_KEY } }
steps {
script {
try {
withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}",
"KAGGLE_KEY=${params.KAGGLE_KEY}" ]) {
sh 'echo KAGGLE_USERNAME: $KAGGLE_USERNAME'
sh '''
#!/bin/bash
pip install kaggle
stage('Clone Git Repository') { kaggle datasets download -d nitishsharma01/olympics-124-years-datasettill-2020
git 'https://git.wmi.amu.edu.pl/s487187/ium_487187.git'
} unzip -o olympics-124-years-datasettill-2020.zip
stage('End') { echo "Processed Data" > output.txt
echo 'Program ended!' '''
}
} catch (err) {
error "Failed to build: ${err.message}"
}
}
}
}
stage('Clone Git Repository') {
when { expression { params.KAGGLE_USERNAME && params.KAGGLE_KEY } }
steps {
script {
try {
git 'https://git.wmi.amu.edu.pl/s487187/ium_487187.git'
} catch (err) {
error "Failed to clone repository: ${err.message}"
}
}
}
}
stage('End') {
when { expression { params.KAGGLE_USERNAME && params.KAGGLE_KEY } }
steps {
echo 'Program ended!'
}
}
} }
post { post {