Replaced dir block by 'cd' command

This commit is contained in:
Marcin-Ramotowski
2025-07-10 22:16:48 +02:00
parent c37d92a4cf
commit 2f0ab04997

40
.jenkins/Jenkinsfile vendored
View File

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