ium_487187/Jenkinsfile

89 lines
3.2 KiB
Plaintext
Raw Normal View History

2023-03-27 21:43:16 +02:00
pipeline {
agent any
stages {
stage('Preparation') {
when { expression { true } }
steps {
script {
try {
properties([
parameters([
string(
defaultValue: '',
description: 'Kaggle username',
name: 'KAGGLE_USERNAME',
trim: false
),
password(
defaultValue: '',
2023-03-27 21:48:47 +02:00
description: 'Kaggle token taken from kaggle.json file',
2023-03-27 21:43:16 +02:00
name: 'KAGGLE_KEY'
2023-03-27 22:10:49 +02:00
),
string(
defaultValue: '50',
description: 'number of examples in dataset',
name: 'CUTOFF'
2023-03-27 21:43:16 +02:00
)
])
])
} 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
2023-03-27 20:43:35 +02:00
2023-03-27 21:43:16 +02:00
kaggle datasets download -d nitishsharma01/olympics-124-years-datasettill-2020
2023-03-27 20:43:35 +02:00
2023-03-27 21:43:16 +02:00
unzip -o olympics-124-years-datasettill-2020.zip
2023-03-27 21:19:42 +02:00
2023-03-27 21:43:16 +02:00
echo "Processed Data" > output.txt
'''
2023-03-27 22:09:47 +02:00
sh "head -n ${params.CUTOFF} olympics-124-years-datasettill-2020/Athletes_summer_games.csv"
2023-03-27 22:05:15 +02:00
}
2023-03-27 21:43:16 +02:00
} catch (err) {
error "Failed to build: ${err.message}"
}
}
}
2023-03-27 21:22:53 +02:00
}
2023-03-27 20:54:26 +02:00
2023-03-27 21:43:16 +02:00
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!'
}
}
2023-03-27 21:33:08 +02:00
}
post {
always {
archiveArtifacts 'output.txt'
}
2023-03-27 20:43:35 +02:00
}
2023-03-22 14:52:10 +01:00
}