Add Jenkinsfile3
This commit is contained in:
parent
753f2286e2
commit
d82f45e1ee
71
Jenkinsfile3
Normal file
71
Jenkinsfile3
Normal file
@ -0,0 +1,71 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
parameters {
|
||||
string(
|
||||
defaultValue: 'jakubbg',
|
||||
description: 'Kaggle username',
|
||||
name: 'KAGGLE_USERNAME',
|
||||
trim: false
|
||||
)
|
||||
password(
|
||||
defaultValue: 'e42b293c818e4ecd7b9365ee037af428',
|
||||
description: 'Kaggle token taken from kaggle.json file, as described in https://github.com/Kaggle/kaggle-api#api-credentials',
|
||||
name: 'KAGGLE_KEY'
|
||||
)
|
||||
string(
|
||||
defaultValue: '100',
|
||||
description: 'CUTOFF parameter',
|
||||
name: 'CUTOFF',
|
||||
trim: false
|
||||
)
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Build image'){
|
||||
checkout scm
|
||||
//Pierwszy argument to tag, który zostania nadany zbudowanemu obrazowi
|
||||
//Jeśli chcemy użyć Dockerfile z innej ścieżki niż ./Dockerfile, możemy ją podać jako drugi argument
|
||||
def testImage = docker.build("test-image", "./Dockerfile")
|
||||
}
|
||||
stage('Build') {
|
||||
steps {
|
||||
// Run the maven build
|
||||
withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}",
|
||||
"KAGGLE_KEY=${params.KAGGLE_KEY}" ]) {
|
||||
sh 'echo KAGGLE_USERNAME: $KAGGLE_USERNAME'
|
||||
sh 'kaggle datasets list'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Run in container'){
|
||||
docker.image('test-image').inside {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
// Krok: Sklonowanie repozytorium git
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
stage('Execute Shell Script') {
|
||||
steps {
|
||||
withEnv(["CUTOFF=${params.CUTOFF}" ]) {
|
||||
// Krok: Wywołanie skryptu shella
|
||||
script {
|
||||
sh 'chmod +x data_processing_script.sh' // Nadaj uprawnienia do wykonania skryptu
|
||||
sh './data_processing_script.sh $CUTOFF' // Wykonaj skrypt
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archive Artifacts') {
|
||||
steps {
|
||||
// Krok: Zarchiwizowanie artefaktów
|
||||
archiveArtifacts artifacts: 'processed_data.csv', fingerprint: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user