feat: HTTP 서버로 전환 + Kaniko 이미지 빌드/K8s 배포 파이프라인 추가
This commit is contained in:
Vendored
+48
-1
@@ -5,19 +5,66 @@ pipeline {
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
spec:
|
||||
serviceAccountName: jenkins-deployer
|
||||
containers:
|
||||
- name: gradle
|
||||
image: eclipse-temurin:21-jdk
|
||||
command: ["sleep"]
|
||||
args: ["99d"]
|
||||
- name: kaniko
|
||||
image: gcr.io/kaniko-project/executor:debug
|
||||
command: ["sleep"]
|
||||
args: ["99d"]
|
||||
volumeMounts:
|
||||
- name: docker-config
|
||||
mountPath: /kaniko/.docker
|
||||
- name: kubectl
|
||||
image: bitnami/kubectl:1.31
|
||||
command: ["sleep"]
|
||||
args: ["99d"]
|
||||
volumes:
|
||||
- name: docker-config
|
||||
secret:
|
||||
secretName: gitea-registry-cred
|
||||
items:
|
||||
- key: .dockerconfigjson
|
||||
path: config.json
|
||||
'''
|
||||
}
|
||||
}
|
||||
environment {
|
||||
IMAGE = "gitea.led.ectech.co.kr/ledmega/cstest:${env.BUILD_NUMBER}"
|
||||
}
|
||||
stages {
|
||||
stage('Build') {
|
||||
steps {
|
||||
container('gradle') {
|
||||
sh 'chmod +x gradlew && ./gradlew build --console=plain'
|
||||
sh 'chmod +x gradlew && ./gradlew build --console=plain -x test'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Image') {
|
||||
steps {
|
||||
container('kaniko') {
|
||||
sh '''
|
||||
/kaniko/executor \
|
||||
--context `pwd` \
|
||||
--dockerfile Dockerfile \
|
||||
--destination ${IMAGE}
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Deploy') {
|
||||
steps {
|
||||
container('kubectl') {
|
||||
sh '''
|
||||
sed "s#IMAGE_PLACEHOLDER#${IMAGE}#" k8s/deployment.yaml > /tmp/deployment.yaml
|
||||
kubectl apply -f /tmp/deployment.yaml
|
||||
kubectl apply -f k8s/service.yaml
|
||||
kubectl apply -f k8s/ingress.yaml
|
||||
kubectl -n apps rollout status deployment/cstest --timeout=90s
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user