Update Jenkinsfile3

This commit is contained in:
s464903 2024-03-30 11:22:43 +01:00
parent 696f04ae7d
commit 51236af46f

View File

@ -23,16 +23,26 @@ pipeline {
stages { stages {
stage('Build image'){ stage('Build image'){
steps{ steps {
script {
checkout scm checkout scm
//Pierwszy argument to tag, który zostania nadany zbudowanemu obrazowi // First argument is the tag assigned to the built image
//Jeśli chcemy użyć Dockerfile z innej ścieżki niż ./Dockerfile, możemy ją podać jako drugi argument // If you want to use a Dockerfile from a different path than ./Dockerfile, you can specify it as the second argument
def testImage = docker.build("test-image", "./Dockerfile") def testImage = docker.build("test-image", ".")
} }
} }
}
stage('Run in container'){ stage('Run in container'){
steps{ steps {
script {
docker.image('test-image').inside { docker.image('test-image').inside {
stage('Checkout') {
steps {
// Step: Clone the git repository
checkout scm
}
}
stage('Build') { stage('Build') {
steps { steps {
@ -44,35 +54,28 @@ pipeline {
} }
} }
} }
stage('Checkout') {
steps {
// Krok: Sklonowanie repozytorium git
checkout scm
}
}
stage('Execute Shell Script') { stage('Execute Shell Script') {
steps { steps {
withEnv(["CUTOFF=${params.CUTOFF}" ]) { withEnv(["CUTOFF=${params.CUTOFF}" ]) {
// Krok: Wywołanie skryptu shella // Step: Invoke the shell script
script { script {
sh 'chmod +x data_processing_script.sh' // Nadaj uprawnienia do wykonania skryptu sh 'chmod +x data_processing_script.sh' // Grant permissions to execute the script
sh './data_processing_script.sh $CUTOFF' // Wykonaj skrypt sh './data_processing_script.sh $CUTOFF' // Execute the script
} }
} }
} }
} }
stage('Archive Artifacts') { stage('Archive Artifacts') {
steps { steps {
// Krok: Zarchiwizowanie artefaktów // Step: Archive artifacts
archiveArtifacts artifacts: 'processed_data.csv', fingerprint: true archiveArtifacts artifacts: 'processed_data.csv', fingerprint: true
} }
} }
} }
} }
} }
} }
}
} }