75 lines
2.7 KiB
Groovy
75 lines
2.7 KiB
Groovy
pipeline {
|
|
agent any
|
|
stages {
|
|
stage('Preparation') {
|
|
steps {
|
|
script {
|
|
properties([
|
|
parameters([
|
|
string(
|
|
defaultValue: 'nbrt10',
|
|
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'
|
|
),
|
|
string(
|
|
defaultValue: '',
|
|
description: 'Set cutoff',
|
|
name: 'CUTOFF',
|
|
trim: false
|
|
)
|
|
])
|
|
])
|
|
}
|
|
}
|
|
}
|
|
stage('Kaggle') {
|
|
steps {
|
|
script {
|
|
withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}",
|
|
"KAGGLE_KEY=${params.KAGGLE_KEY}" ]) {
|
|
sh 'echo KAGGLE_USERNAME: $KAGGLE_USERNAME'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
stage('Checkout') {
|
|
steps {
|
|
git branch: 'master', url: 'https://git.wmi.amu.edu.pl/s487175/ium_z487175.git'
|
|
}
|
|
}
|
|
stage('Download from kaggle') {
|
|
steps {
|
|
sh 'kaggle datasets download -d shivam2503/diamonds > output.txt'
|
|
sh 'unzip -o diamonds.zip >> output.txt'
|
|
// przypisanie uprawnień
|
|
sh 'chmod +x s487175-create-dataset-script.py'
|
|
}
|
|
}
|
|
stage('Build image') {
|
|
steps {
|
|
//Tworzenie obrazu
|
|
sh 'docker build --no-cache -t ium -f dockerfile .'
|
|
}
|
|
}
|
|
stage('Run command in container') {
|
|
steps {
|
|
script {
|
|
// Uruchamia instancje obrazu ium i uruchomienie skryptu w kontenerze
|
|
sh "docker run -e CUTOFF=${params.CUTOFF} ium python3 /app/s487175-create-dataset-script.py >> output.txt"
|
|
}
|
|
}
|
|
}
|
|
stage('Archive file') {
|
|
steps {
|
|
sh "docker cp ium:/app/artifacts/diamonds.csv ${env.WORKSPACE}"
|
|
archiveArtifacts artifacts: 'output.txt, diamonds.csv', fingerprint: true
|
|
}
|
|
}
|
|
}
|
|
} |