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