Files
todo-backend/.drone.yml
Agent b19f09af24
Some checks failed
continuous-integration/drone/push Build is failing
simplify: share workspace between steps
2026-03-22 05:33:16 +00:00

91 lines
2.2 KiB
YAML

kind: pipeline
type: kubernetes
name: build-and-deploy-dev
volumes:
- name: maven-cache
emptyDir: {}
trigger:
event:
- push
branch:
- dev
steps:
- name: dev-build
image: ccr.ccs.tencentyun.com/violin/maven:3.9-eclipse-temurin-22
commands:
- mvn clean package -DskipTests
volumes:
- name: maven-cache
mountPath: /root/.m2
- name: dev-build-image
image: ccr.ccs.tencentyun.com/violin/kaniko-project-executor:latest
environment:
DOCKER_CONFIG:
from_secret: docker_config
commands:
- >-
/kaniko/executor
--context .
--destination ccr.ccs.tencentyun.com/violin/todo-backend:${DRONE_COMMIT_SHA}
--destination ccr.ccs.tencentyun.com/violin/todo-backend:latest
- name: dev-deploy
image: ccr.ccs.tencentyun.com/violin/kubectl:latest
commands:
- kubectl set image deployment/todo-backend todo-backend=ccr.ccs.tencentyun.com/violin/todo-backend:${DRONE_COMMIT_SHA} -n drone
- kubectl rollout status deployment/todo-backend -n drone
environment:
KUBECONFIG:
from_secret: kubeconfig
---
kind: pipeline
type: kubernetes
name: build-and-deploy-prod
volumes:
- name: maven-cache
emptyDir: {}
trigger:
event:
- push
branch:
- master
steps:
- name: prod-build
image: ccr.ccs.tencentyun.com/violin/maven:3.9-eclipse-temurin-22
commands:
- mvn clean package -DskipTests
volumes:
- name: maven-cache
mountPath: /root/.m2
- name: prod-build-image
image: ccr.ccs.tencentyun.com/violin/kaniko-project-executor:latest
environment:
DOCKER_CONFIG:
from_secret: docker_config
commands:
- >-
/kaniko/executor
--context .
--destination ccr.ccs.tencentyun.com/violin/todo-backend:${DRONE_COMMIT_SHA}
--destination ccr.ccs.tencentyun.com/violin/todo-backend:v1.0.0
- name: prod-deploy
image: ccr.ccs.tencentyun.com/violin/kubectl:latest
commands:
- kubectl set image deployment/todo-backend todo-backend=ccr.ccs.tencentyun.com/violin/todo-backend:${DRONE_COMMIT_SHA} -n drone
- kubectl rollout status deployment/todo-backend -n drone
environment:
KUBECONFIG:
from_secret: kubeconfig