ium_z487175/Jenkinsfile

88 lines
3.1 KiB
Plaintext
Raw Permalink Normal View History

2023-04-15 11:14:16 +02:00
pipeline {
agent any
stages {
stage('Preparation') {
2023-04-15 11:16:02 +02:00
steps {
script {
properties([
parameters([
string(
defaultValue: 'nbrt10',
description: 'Kaggle username',
name: 'KAGGLE_USERNAME',
trim: false
),
password(
2023-04-18 07:36:22 +02:00
defaultValue: '',
2023-04-15 11:16:02 +02:00
description: 'Kaggle token taken from kaggle.json file, as described in https://github.com/Kaggle/kaggle-api#api-credentials',
name: 'KAGGLE_KEY'
2023-04-15 12:48:52 +02:00
),
string(
2023-04-18 07:45:47 +02:00
defaultValue: '',
2023-04-15 12:48:52 +02:00
description: 'Set cutoff',
name: 'CUTOFF',
trim: false
)
2023-04-15 11:16:02 +02:00
])
])
}
}
2023-04-15 11:14:16 +02:00
}
stage('Kaggle') {
steps {
2023-04-15 11:16:02 +02:00
script {
withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}",
"KAGGLE_KEY=${params.KAGGLE_KEY}" ]) {
sh 'echo KAGGLE_USERNAME: $KAGGLE_USERNAME'
}
2023-04-15 11:14:16 +02:00
}
}
}
2023-04-15 11:52:56 +02:00
stage('Checkout') {
2023-04-15 11:14:16 +02:00
steps {
git branch: 'master', url: 'https://git.wmi.amu.edu.pl/s487175/ium_z487175.git'
}
2023-06-06 08:34:37 +02:00
}
stage('Upgrade library') {
steps {
sh 'pip install --upgrade urllib3 chardet'
sh 'pip install --upgrade pyopenssl'
}
2023-04-15 11:14:16 +02:00
}
stage('Download from kaggle') {
2023-04-15 11:21:43 +02:00
steps {
2023-04-15 11:52:56 +02:00
sh 'kaggle datasets download -d shivam2503/diamonds > output.txt'
sh 'unzip -o diamonds.zip >> output.txt'
// przypisanie uprawnień
2023-04-15 11:24:34 +02:00
sh 'chmod +x s487175-create-dataset-script.py'
}
}
stage('Build image') {
steps {
2023-04-17 20:34:23 +02:00
//Tworzenie obrazu
2023-04-17 20:28:03 +02:00
sh 'docker build --no-cache -t ium -f dockerfile .'
}
}
2023-06-07 08:05:31 +02:00
stage('Run scripts in container') {
steps {
script {
2023-04-17 23:13:13 +02:00
// Uruchamia instancje obrazu ium i uruchomienie skryptu w kontenerze
2023-04-18 08:22:58 +02:00
sh "docker run -e CUTOFF=${params.CUTOFF} ium python3 /app/s487175-create-dataset-script.py >> output.txt"
2023-04-17 22:24:40 +02:00
}
2023-04-17 22:47:53 +02:00
}
}
2023-04-16 08:38:45 +02:00
stage('Archive file') {
steps {
2023-06-07 08:34:45 +02:00
// Zapisanie zbioru danych i podziału danych na podzbiory jako artfefakty
2023-06-07 18:37:00 +02:00
sh "docker cp \$(docker ps -l -q):/app/dane ${env.WORKSPACE}"
archiveArtifacts artifacts: 'output.txt, dane/diamonds.csv', fingerprint: true
}
2023-04-16 08:38:45 +02:00
}
2023-04-15 11:14:16 +02:00
}
post {
success {
build job: 'z-s487175-training/master', wait: false
}
}
2023-03-25 13:43:57 +01:00
}