58 lines
1.2 KiB
YAML
58 lines
1.2 KiB
YAML
# drone 会按顺序执行 pipeline 配置中定义的任务
|
|
|
|
# main 分支在 build 和 PR 时执行的 pipeline
|
|
kind: pipeline
|
|
type: docker
|
|
name: main-pipeline
|
|
|
|
platform:
|
|
os: linux
|
|
arch: amd64
|
|
|
|
trigger:
|
|
branch:
|
|
include:
|
|
- main
|
|
event:
|
|
include:
|
|
- custom
|
|
- push
|
|
|
|
clone:
|
|
disable: true
|
|
|
|
steps:
|
|
- name: deploy-k8s-master
|
|
image: appleboy/drone-ssh
|
|
settings:
|
|
host:
|
|
from_secret: k8s_master
|
|
username: ubuntu
|
|
key:
|
|
from_secret: k8s_key
|
|
port: 22
|
|
script_stop: true
|
|
script:
|
|
- cd /var/www/pzx-web-api
|
|
- sudo git fetch
|
|
- sudo git reset --hard ${DRONE_COMMIT}
|
|
- sudo docker-compose down
|
|
- sudo docker-compose up -d --build --force-recreate
|
|
- sudo docker image prune -f
|
|
- name: deploy-k8s-worker
|
|
image: appleboy/drone-ssh
|
|
settings:
|
|
host:
|
|
from_secret: k8s_worker
|
|
username: ubuntu
|
|
key:
|
|
from_secret: k8s_key
|
|
port: 22
|
|
script_stop: true
|
|
script:
|
|
- cd /var/www/pzx-web-api
|
|
- sudo git fetch
|
|
- sudo git reset --hard ${DRONE_COMMIT}
|
|
- sudo docker-compose down
|
|
- sudo docker-compose up -d --build --force-recreate
|
|
- sudo docker image prune -f |