This commit is contained in:
hiondal 2025-02-18 05:07:31 +09:00
parent ff8ba72690
commit 68330ded2e

View File

@ -25,7 +25,7 @@ podTemplate(
envVar(key: 'TESTCONTAINERS_RYUK_DISABLED', value: 'true')
]),
containerTemplate(name: 'git',
image: 'mikefarah/yq',
image: 'ghcr.io/chriswhong/git-yq:latest',
command: 'cat',
ttyEnabled: true)
],
@ -105,32 +105,31 @@ testcontainers.reuse.enable=true'''
usernameVariable: 'GIT_USERNAME',
passwordVariable: 'GIT_PASSWORD'
)]) {
// Git 설정
sh '''
git config --global user.email "jenkins@example.com"
git config --global user.name "Jenkins"
'''
// Manifest 저장소 클론
sh '''
// manifest 저장소를 https 프로토콜로 클론
sh """
rm -rf lifesub-manifest
git clone https://oauth2:${GIT_PASSWORD}@github.com/${manifestRepo}.git
'''
"""
dir('lifesub-manifest') {
services.each { service ->
def imagePath = "${props.registry}/${props.image_org}/${service}:${imageTag}"
sh """
# Update image tag
yq e '.spec.template.spec.containers[0].image = "${imagePath}"' -i lifesub/deployments/${service}-deployment.yaml
# deployment yaml 파일의 이미지 태그 업데이트
yq -i '.spec.template.spec.containers[0].image = "${imagePath}"' lifesub/deployments/${service}-deployment.yaml
"""
}
sh '''
sh """
git add .
git diff-index --quiet HEAD || git commit -m "Update backend services images to ${imageTag}"
git push origin ${manifestBranch}
'''
"""
}
}
}