ci: 模板

This commit is contained in:
2025-04-26 18:15:37 +08:00
parent c376a10f2b
commit 5ce31f978c

View File

@@ -6,7 +6,11 @@ platform:
os: linux os: linux
arch: arm64 arch: arm64
template:
path: .drone/notify_template.yaml
vars:
NOTIFY_WX_URL:
from_secret: notify_wx_url
steps: steps:
- name: build-jar - name: build-jar
image: 10.7.127.190:38080/maven:3.8.5-openjdk-17 image: 10.7.127.190:38080/maven:3.8.5-openjdk-17
@@ -47,33 +51,33 @@ steps:
- kubectl apply -f deployment.yml -n metis --kubeconfig=/app/config/base-taishan-kubectl.yml - kubectl apply -f deployment.yml -n metis --kubeconfig=/app/config/base-taishan-kubectl.yml
- name: notify # - name: notify
image: 10.7.127.190:38080/plugins/webhook:latest # image: 10.7.127.190:38080/plugins/webhook:latest
environment: # environment:
NOTIFY_WX_URL: # NOTIFY_WX_URL:
from_secret: notify_wx_url # from_secret: notify_wx_url
when: # when:
status: [ success,failure ] # status: [ success,failure ]
settings: # settings:
urls: # urls:
from_secret: notify_wx_url # from_secret: notify_wx_url
content_type: application/json # content_type: application/json
template: | # template: |
{ # {
"msgtype": "markdown", # "msgtype": "markdown",
"markdown": { # "markdown": {
"content": "{{#success build.status}}<font color=\"green\">✅ 构建成功</font>{{else}}<font color=\"red\">❌ 构建失败</font>{{/success}} # "content": "{{#success build.status}}<font color=\"green\">✅ 构建成功</font>{{else}}<font color=\"red\">❌ 构建失败</font>{{/success}}
>**项目名称**: #{{ repo.name }} # >**项目名称**: #{{ repo.name }}
>**构建编号**: #{{build.number}} # >**构建编号**: #{{build.number}}
>**构建状态**: {{build.status}} # >**构建状态**: {{build.status}}
>**代码分支**: {{build.branch}} # >**代码分支**: {{build.branch}}
>**提交哈希**: {{build.commit}} # >**提交哈希**: {{build.commit}}
>**提交作者**: {{build.author}} # >**提交作者**: {{build.author}}
>**提交信息**: {{build.message}} # >**提交信息**: {{build.message}}
>[查看构建详情]({{build.link}}) # >[查看构建详情]({{build.link}})
>{{^success build.status}}[查看失败日志]({{build.link}}/logs){{/success}}" # >{{^success build.status}}[查看失败日志]({{build.link}}/logs){{/success}}"
} # }
} # }
volumes: volumes: