diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index 044190f..c142362 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -62,29 +62,27 @@ pipeline { sh 'git clone ${DEPLOY_REPO} --branch fluxcd' } } - - dir('user-microservice-deploy/apps/user-microservice') { - sh ''' - # Podmień tag obrazu w pliku deploy.yaml - awk -v commit="$GIT_COMMIT" ' - $0 ~ /name:[[:space:]]*api/ { in_api_container = 1; print; next } - in_api_container && $0 ~ /^[[:space:]]*image:[[:space:]]*/ { - sub(/:[^:[:space:]]+$/, ":" commit) - in_api_container = 0 - print - next - } - { print } - ' deploy.yaml > deploy.tmp && mv deploy.tmp deploy.yaml + sh 'cd user-microservice-deploy/apps/user-microservice' + sh ''' + # Podmień tag obrazu w pliku deploy.yaml + awk -v commit="$GIT_COMMIT" ' + $0 ~ /name:[[:space:]]*api/ { in_api_container = 1; print; next } + in_api_container && $0 ~ /^[[:space:]]*image:[[:space:]]*/ { + sub(/:[^:[:space:]]+$/, ":" commit) + in_api_container = 0 + print + next + } + { print } + ' deploy.yaml > deploy.tmp && mv deploy.tmp deploy.yaml ''' - sshagent(['gitea-deploy-key']) { - sh ''' - git add deploy.yaml - git diff-index --quiet HEAD || git commit -m "JENKINS: Changed deployed version to $GIT_COMMIT" - git push origin fluxcd - ''' - } + sshagent(['gitea-deploy-key']) { + sh ''' + git add deploy.yaml + git diff-index --quiet HEAD || git commit -m "JENKINS: Changed deployed version to $GIT_COMMIT" + git push origin fluxcd + ''' } } }