2023-03-25 13:47:27 +01:00
|
|
|
pipeline {
|
|
|
|
agent any
|
|
|
|
stages {
|
2023-06-30 20:59:38 +02:00
|
|
|
stage('Preparation') {
|
|
|
|
steps {
|
|
|
|
script {
|
|
|
|
properties([
|
|
|
|
parameters([
|
|
|
|
string(
|
|
|
|
defaultValue: 'tomaszkoszarek',
|
|
|
|
description: 'Kaggle username',
|
|
|
|
name: 'KAGGLE_USERNAME',
|
|
|
|
trim: false
|
|
|
|
),
|
|
|
|
password(
|
|
|
|
defaultValue: 'ac7b81c3063c249f931f6aabd4cca7ed',
|
|
|
|
description: 'Kaggle token taken from kaggle.json file, as described in https://github.com/Kaggle/kaggle-api#api-credentials',
|
|
|
|
name: 'KAGGLE_KEY'
|
|
|
|
),
|
|
|
|
string(
|
|
|
|
defaultValue: '',
|
|
|
|
description: 'Set cutoff',
|
|
|
|
name: 'CUTOFF',
|
|
|
|
trim: false
|
|
|
|
)
|
|
|
|
])
|
|
|
|
])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Kaggle') {
|
2023-03-25 13:47:27 +01:00
|
|
|
steps {
|
2023-06-30 20:59:38 +02:00
|
|
|
script {
|
|
|
|
withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}",
|
|
|
|
"KAGGLE_KEY=${params.KAGGLE_KEY}" ]) {
|
|
|
|
sh 'echo KAGGLE_USERNAME: $KAGGLE_USERNAME'
|
|
|
|
}
|
|
|
|
}
|
2023-03-25 13:47:27 +01:00
|
|
|
}
|
|
|
|
}
|
2023-06-30 20:59:38 +02:00
|
|
|
stage('Checkout') {
|
|
|
|
steps {
|
|
|
|
git branch: 'master', url: 'https://git.wmi.amu.edu.pl/s487174/ium_z487174.git'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Upgrade library') {
|
|
|
|
steps {
|
|
|
|
sh 'pip install --upgrade urllib3 chardet'
|
|
|
|
sh 'pip install --upgrade pyopenssl'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Download from kaggle') {
|
|
|
|
steps {
|
|
|
|
sh 'kaggle datasets download -d bartoszpieniak/poland-cars-for-sale-dataset > output.txt'
|
|
|
|
sh 'unzip -o archive.zip >> output.txt'
|
|
|
|
// przypisanie uprawnień
|
|
|
|
sh 'chmod +x Jenkinsfile_create_dataset'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Build image') {
|
|
|
|
steps {
|
|
|
|
//Tworzenie obrazu
|
|
|
|
sh 'docker build --no-cache -t ium -f dockerfile .'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Run scripts in container') {
|
|
|
|
steps {
|
|
|
|
script {
|
|
|
|
// Uruchamia instancje obrazu ium i uruchomienie skryptu w kontenerze
|
|
|
|
sh "docker run -e CUTOFF=${params.CUTOFF} ium python3 /app/Jenkinsfile_create_dataset >> output.txt"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Archive file') {
|
|
|
|
steps {
|
|
|
|
// Zapisanie zbioru danych i podziału danych na podzbiory jako artfefakty
|
|
|
|
sh "docker cp \$(docker ps -l -q):/app/data ${env.WORKSPACE}"
|
|
|
|
archiveArtifacts artifacts: 'output.txt, data/Car_sale_ads.csv', fingerprint: true
|
|
|
|
}
|
|
|
|
}
|
2023-03-25 13:43:53 +01:00
|
|
|
}
|
2023-06-30 20:59:38 +02:00
|
|
|
|
|
|
|
// post {
|
|
|
|
// success {
|
|
|
|
// build job: 'z-s487174-training/master', wait: false
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
}
|