Files
todo-backend/.drone.yml
Agent d68e0ba68b
Some checks failed
continuous-integration/drone/push Build is failing
fix: manually clone with credentials in commands
2026-03-21 15:04:18 +00:00

104 lines
2.6 KiB
YAML

kind: pipeline
type: kubernetes
name: build-and-deploy-dev
trigger:
event:
- push
branch:
- dev
steps:
- name: dev-clone
image: ccr.ccs.tencentyun.com/violin/git-alpine:latest
commands:
- git clone https://${git_username}:${git_password}@gitea.violin-work.online/sales/todo-backend.git /drone/src
- cd /drone/src
- git checkout dev
environment:
git_username:
from_secret: git_username
git_password:
from_secret: git_password
- name: dev-build
image: ccr.ccs.tencentyun.com/violin/maven:3.9-eclipse-temurin-22
commands:
- mvn clean package -DskipTests
when:
status:
- success
- name: dev-build-image
image: ccr.ccs.tencentyun.com/violin/docker:linux-amd64
settings:
repo: ccr.ccs.tencentyun.com/violin/todo-backend
tags:
- ${DRONE_COMMIT_SHA}
- latest
username:
from_secret: registry_username
password:
from_secret: registry_password
- 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
trigger:
event:
- push
branch:
- master
steps:
- name: prod-clone
image: ccr.ccs.tencentyun.com/violin/git-alpine:latest
commands:
- git clone https://${git_username}:${git_password}@gitea.violin-work.online/sales/todo-backend.git /drone/src
- cd /drone/src
- git checkout master
environment:
git_username:
from_secret: git_username
git_password:
from_secret: git_password
- name: prod-build
image: ccr.ccs.tencentyun.com/violin/maven:3.9-eclipse-temurin-22
commands:
- mvn clean package -DskipTests
- name: prod-build-image
image: ccr.ccs.tencentyun.com/violin/docker:linux-amd64
settings:
repo: ccr.ccs.tencentyun.com/violin/todo-backend
tags:
- ${DRONE_COMMIT_SHA}
- v1.0.0
username:
from_secret: registry_username
password:
from_secret: registry_password
- 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