95 lines
3.3 KiB
Groovy
95 lines
3.3 KiB
Groovy
pipeline {
|
|
agent any
|
|
|
|
parameters {
|
|
string(
|
|
defaultValue: '100',
|
|
description: 'The number of examples to keep in the dataset',
|
|
name: 'CUTOFF'
|
|
)
|
|
}
|
|
|
|
stages {
|
|
stage('Preparation') {
|
|
when { expression { true } }
|
|
steps {
|
|
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
|
|
|
|
kaggle datasets download -d nitishsharma01/olympics-124-years-datasettill-2020
|
|
|
|
unzip -o olympics-124-years-datasettill-2020.zip
|
|
|
|
echo "Processed Data" > output.txt
|
|
|
|
head -n ${params.CUTOFF} athlete_events.csv > athlete_events_cutoff.csv
|
|
|
|
mv athlete_events_cutoff.csv athlete_events.csv
|
|
'''
|
|
}
|
|
} 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 {
|
|
always {
|
|
archiveArtifacts 'output.txt'
|
|
}
|
|
}
|
|
} |