ium_487187/Jenkinsfile

95 lines
3.2 KiB
Plaintext
Raw Normal View History

2023-03-27 21:43:16 +02:00
pipeline {
agent any
2023-03-27 21:46:12 +02:00
parameters {
string(
2023-03-27 21:48:47 +02:00
defaultValue: '200',
description: 'number of examples in dataset',
2023-03-27 21:46:12 +02:00
name: 'CUTOFF'
)
}
2023-03-27 21:43:16 +02:00
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'
)
])
])
} 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 21:46:12 +02:00
2023-03-27 21:48:47 +02:00
head -n ${params.CUTOFF} Athletes_summer_games.csv > Athletes_summer_games_cutoff.csv
2023-03-27 21:46:12 +02:00
2023-03-27 21:48:47 +02:00
mv Athletes_summer_games_cutoff.csv Athletes_summer_games.csv
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
}