Skip to content

Commit

Permalink
fix: add get tag step to backend jenkins pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
annleefores committed Nov 28, 2023
1 parent 576462a commit 2dced8d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion server/backend/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,22 @@ pipeline {
}
}

stage('get tag') {
steps{
script {
def backendVersion = sh(script: "git tag -l 'kodiko-backend-*' --sort='-version:refname' | head -n1 | awk -F'-' '{print \$3}'", returnStdout: true).trim()
echo "Current tag: ${backendVersion}"

// Set the version as an environment variable
env.VERSION = backendVersion

}
}
}

stage('build and push') {
environment {
DOCKER_IMAGE = "annleefores/kodiko-backend:${BUILD_NUMBER}-${GIT_COMMIT}"
DOCKER_IMAGE = "annleefores/kodiko-backend:${VERSION}"
}
steps{
container('kaniko') {
Expand Down

0 comments on commit 2dced8d

Please sign in to comment.