You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
134 lines
2.6 KiB
134 lines
2.6 KiB
kind: pipeline |
|
type: exec |
|
name: git |
|
|
|
clone: |
|
disable: true |
|
|
|
steps: |
|
- name: clone |
|
commands: |
|
- cd /data/projects/${DRONE_REPO_NAME} |
|
- git pull |
|
--- |
|
kind: pipeline |
|
type: exec |
|
name: zip_file |
|
clone: |
|
disable: true |
|
steps: |
|
- name: zip ${DRONE_REPO_NAME} |
|
commands: |
|
- cd /data/projects/${DRONE_REPO_NAME} |
|
- zip -vr -x=\.* dist.zip ./ |
|
when: |
|
event: |
|
- promote |
|
- push |
|
depends_on: |
|
- git |
|
|
|
--- |
|
kind: pipeline |
|
type: docker |
|
name: upload |
|
|
|
clone: |
|
disable: true |
|
steps: |
|
- name: upload to oss |
|
pull: never |
|
image: oss2:latest |
|
volumes: |
|
- name: files |
|
path: /files |
|
- name: scripts |
|
path: /scripts |
|
commands: |
|
- python3 /scripts/oss.py ${DRONE_REPO_NAME} backup |
|
- python3 /scripts/oss.py ${DRONE_REPO_NAME} upload |
|
when: |
|
event: |
|
- promote |
|
- push |
|
|
|
- name: restore to oss |
|
pull: never |
|
image: oss2:latest |
|
volumes: |
|
- name: files |
|
path: /files |
|
- name: scripts |
|
path: /scripts |
|
commands: |
|
- python3 /scripts/oss.py ${DRONE_REPO_NAME} restore |
|
when: |
|
event: |
|
- rollback |
|
|
|
- name: flush cdn |
|
pull: never |
|
image: oss2:latest |
|
volumes: |
|
- name: files |
|
path: /files |
|
- name: scripts |
|
path: /scripts |
|
commands: |
|
- sleep 3 |
|
- echo https://${DRONE_REPO_NAME}/ > /scripts/${DRONE_REPO_NAME} |
|
- cd /scripts && python3 /scripts/refresh.py -r ${DRONE_REPO_NAME} -t clear |
|
|
|
|
|
volumes: |
|
- name: files |
|
host: |
|
path: /data/projects/${DRONE_REPO_NAME} |
|
- name: scripts |
|
host: |
|
path: /home/devops/python_script/aliyun |
|
depends_on: |
|
- zip_file |
|
|
|
--- |
|
kind: pipeline |
|
type: docker |
|
name: send_msg |
|
clone: |
|
disable: true |
|
steps: |
|
- name: notify |
|
image: plugins/webhook |
|
settings: |
|
urls: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=b38cafb9-f7fb-4eec-93ba-81b95f8fae0e |
|
content_type: application/json |
|
template: | |
|
{ |
|
"msgtype": "markdown", |
|
"markdown": { |
|
"content": "{{#success build.status}}✅ {{else}}❌ {{/success}}**{{ repo.owner }}/{{ repo.name }}** (Build #{{build.number}})\n |
|
>**发布环境**: {{ build.deployTo }} |
|
>**构建结果**: {{ build.status }} |
|
>**构建详情**: [点击查看]({{ build.link }}) |
|
>**代码分支**: {{ build.branch }} |
|
>**提交标识**: {{ build.commit }} |
|
>**提交发起**: {{ build.author }} |
|
>**提交信息**: {{ build.message }} |
|
" |
|
} |
|
} |
|
|
|
trigger: |
|
event: |
|
- deployment |
|
- promote |
|
- push |
|
- rollback |
|
status: |
|
- success |
|
- failure |
|
|
|
depends_on: |
|
- git |
|
- zip_file |
|
- upload |