Files
todo-frontend/.drone.yml
Agent f6e9c28f71
All checks were successful
continuous-integration/drone/push Build is passing
fix: 改用 kubectl set image 避免权限问题
2026-03-24 01:05:48 +00:00

113 lines
2.5 KiB
YAML

kind: pipeline
type: kubernetes
name: build-and-deploy-dev
volumes:
- name: node-cache
claim:
name: node-cache-pvc
service_account_name: drone-builder-sa
trigger:
event:
- push
branch:
- dev
steps:
- name: dev-install
image: ccr.ccs.tencentyun.com/violin/node:22-bookworm
commands:
- npm install
volumes:
- name: node-cache
path: /root/.npm
- name: dev-build
image: ccr.ccs.tencentyun.com/violin/node:22-bookworm
commands:
- npm run build:h5
volumes:
- name: node-cache
path: /root/.npm
- name: dev-build-image
# # # # #
image: ccr.ccs.tencentyun.com/violin/drone-kaniko:latest
settings:
repo: ccr.ccs.tencentyun.com/violin/todo-frontend
tags:
- latest
- ${DRONE_COMMIT_SHA:0:8}
dockerfile: Dockerfile
context: .
registry: ccr.ccs.tencentyun.com
username: 100024540033
password:
from_secret: docker_password
- name: dev-deploy
image: ccr.ccs.tencentyun.com/violin/kubectl:latest
cluster: kubernetes
namespace: drone
commands:
- kubectl set image deployment/todo-frontend todo-frontend=ccr.ccs.tencentyun.com/violin/todo-frontend:${DRONE_COMMIT_SHA:0:8} -n drone
- kubectl rollout restart deployment/todo-frontend -n drone
---
kind: pipeline
type: kubernetes
name: build-and-deploy-prod
volumes:
- name: node-cache
claim:
name: node-cache-pvc
trigger:
event:
- push
branch:
- master
steps:
- name: prod-install
image: ccr.ccs.tencentyun.com/violin/node:22-bookworm
commands:
- npm install
volumes:
- name: node-cache
path: /root/.npm
- name: prod-build
image: ccr.ccs.tencentyun.com/violin/node:22-bookworm
commands:
- npm run build:h5
volumes:
- name: node-cache
path: /root/.npm
- name: prod-build-image
image: ccr.ccs.tencentyun.com/violin/drone-kaniko:latest
settings:
repo: ccr.ccs.tencentyun.com/violin/todo-frontend
tags:
- v1.0.0
dockerfile: Dockerfile
context: .
registry: ccr.ccs.tencentyun.com
username: 100024540033
password:
from_secret: docker_password
- name: prod-deploy
image: ccr.ccs.tencentyun.com/violin/kubectl:latest
cluster: kubernetes
namespace: drone
commands:
- kubectl set image deployment/todo-frontend todo-frontend=ccr.ccs.tencentyun.com/violin/todo-frontend:v1.0.0
- kubectl rollout status deployment/todo-frontend