무중단 배포용 Jenkinsfile 생성
Some checks failed
Main-Build / build-and-push (push) Has been cancelled

This commit is contained in:
2025-12-09 09:39:26 +09:00
parent 320e64f929
commit 75b5328f27

14
Jenkinsfile vendored
View File

@@ -1,9 +1,10 @@
// Jenkinsfile — Kaniko build + K8s deploy (latest only)
// Jenkinsfile — Kaniko build + K8s deploy (빌드번호 태그 사용)
def L = 'kaniko-and-deploy'
def REG = 'harbor.sayinfo.co.kr'
def IMAGE = 'sayit-helpdesk/helpdesk-service' // Harbor 프로젝트/레포 이름에 맞게 유지 또는 수정
def APP_NS = 'sayit-helpdesk' // 실제 K8s 네임스페이스와 일치해야 함
def DEPLOY = 'sayit-helpdesk-service' // 실제 Deployment 이름과 일치해야 함
def IMAGE = 'sayit-helpdesk/helpdesk-service' // Harbor 프로젝트/레포 이름
def APP_NS = 'sayit-helpdesk' // 실제 K8s 네임스페이스
def DEPLOY = 'sayit-helpdesk-service' // 실제 Deployment 이름
def IMAGE_TAG = "${env.BUILD_NUMBER}"
podTemplate(
label: L,
@@ -104,7 +105,7 @@ spec:
/kaniko/executor \\
--context=. \\
--dockerfile=Dockerfile \\
--destination=${REG}/${IMAGE}:latest \\
--destination=${REG}/${IMAGE}:${IMAGE_TAG} \\
--snapshot-mode=redo \\
--skip-tls-verify \\
--cache=true \\
@@ -117,8 +118,7 @@ spec:
container('kubectl') {
sh """
set -eux
kubectl -n ${APP_NS} set image deploy/${DEPLOY} ${DEPLOY}=${REG}/${IMAGE}:latest
kubectl -n ${APP_NS} rollout restart deploy/${DEPLOY}
kubectl -n ${APP_NS} set image deploy/${DEPLOY} ${DEPLOY}=${REG}/${IMAGE}:${IMAGE_TAG}
kubectl -n ${APP_NS} rollout status deploy/${DEPLOY} --timeout=300s
kubectl -n ${APP_NS} get deploy ${DEPLOY} -o wide