Browse Source

更新 '.drone.yml'

gogs 1 year ago
parent
commit
63b99d8dc0
1 changed files with 84 additions and 3 deletions
  1. 84 3
      .drone.yml

+ 84 - 3
.drone.yml

@@ -21,6 +21,59 @@ clone:
   depth: 1         # 定义git克隆的深度,这里只需要完整的克隆项目就行,之前的提交并不需要去克隆
   disable: false
   
+# CICD 常用插件说明 https://notes.lzwang.ltd/DevOps/CICD/drone_plugin_review/
+#  远程与运维¶
+#  git clone 仓库(默认启用): Drone Plugins - Git
+#  执行 git push 到指定仓库: Drone Plugins - Git Push
+#  执行 Ansible Playbook: Drone Plugins - Ansible
+#  SSH登录到远程主机: Drone Plugins - SSH
+#    制品上传下载与签名¶
+#  对制品进行GPG签名: Drone Plugins - GPG Sign
+#  上传制品到WebDAV服务器上: Drone Plugins - WebDAV
+#  上传制品到FTP服务器上: Drone Plugins - FTP(S)
+#  上传制品到SCP服务器上: Drone Plugins - SCP
+#  下载文件到本地用于此次构建: Drone Plugins - Download
+#    发布¶
+#  推送文件到Codecov进行覆盖率检查: Drone Plugins - Codecov
+#  发布镜像到Docker Registry: (1) Drone Plugins - Docker (2) Drone Plugins - Drone Buildah
+#  发布npm包到指定registry: Drone Plugins - NPM
+#  发布Python包到PyPi: Drone Plugins - PyPI
+#    GitHub相关¶
+#  发布静态页面到GitHub: Drone Plugins - GitHub Pages
+#  发布新的Release到GitHub: Drone Plugins - Github Release
+#  生成ChangeLog: Drone Plugins - Github-changelog-generator
+#  发布Comment到GitHub的Pull Request: Drone Plugins - Github Comment
+#    Gitea相关¶
+#  发布新的Release到Gitea: Drone Plugins - Gitea Release
+#  发布Comment到Gitea的Pull Request: Drone Plugins - Gitea Comment
+#    触发其他构建¶
+#  触发一组Drone下游构建: Drone Plugins - Downstream Build
+#  触发CircleCI构建: Drone Plugins - CircleCI
+#  触发GitlabCI构建: Drone Plugins - Gitlab-CI
+#  触发Jenkins构建: Drone Plugins - Jenkins
+#    消息通知¶
+#  发送Webhook消息: Drone Plugins - Webhook
+#  发送微信消息通知: Drone Plugins - Wechat
+#  发送企业微信消息通知: Drone Plugins - Wechat for Work
+#  发送邮件通知: Drone Plugins - Email
+#  发送丁丁消息通知: Drone Plugins - DingTalk
+#  发送及时达推送给微信用户通知: Drone Plugins - InstantAccess(即时达)
+#  发送Telegram消息通知: Drone Plugins - Telegram
+#    其他¶
+#  同步豆瓣标记的数据到csv、json或者Notion数据库: Drone Plugins - Doumark
+#    相关工具链¶
+#    Testspace¶
+#  云托管测试: Test Management Software - Testspace
+#  在Drone中配置: CI/CD Support | Testspace
+#    Codecov¶
+#  覆盖率检测: Codecov - The Leading Code Coverage Solution
+#  在Drone中配置: Drone Plugins - Codecov
+#    Badge¶
+#  自定义Badge: Shields.io: Quality metadata badges for open source projects
+#    参考¶
+#  Drone一直卡在pending状态FAQ: Builds are Stuck in Pending Status - FAQ - Drone
+#  Drone插件市场: Drone Plugins
+#  插件开发: Overview | Drone
 
 #######################################################
 ###### steps : https://drone.cool/pipeline/docker/syntax/steps/
@@ -40,8 +93,8 @@ clone:
 #    command_timeout: 5m
 #    script:
 #      - echo success
-#      - cd /home/pi/python/dnspod
-#      - git pull
+#      - cd /buildCache
+#      - chmod 777 run.sh
 #      - bash run.sh
 # 条件
 #  when:
@@ -85,6 +138,8 @@ clone:
 #- name: cache
 #  image: redis
 
+##################################### 编译 ##################################
+
 steps:    
 - name: 编译
   image: maven:3-jdk-11
@@ -94,7 +149,11 @@ steps:
     path: /root/.m2  
   commands:
   - mvn compile -DskipTests=true -Dmaven.javadoc.skip=true -B -V
-  - echo 'FINISHED!'
+#  - echo '[STATUS]: mvn package FINISHED!'
+#  - cp xxxxx.jar unionbuildCache
+#  - cp Dockerfile ...
+#  - cp run.sh build/run.sh
+  - echo '[STATUS]: ALL FINISHED!'
 
 
 #- name: build-java-app
@@ -240,6 +299,28 @@ steps:
     msg_url: ${DRONE_BUILD_LINK}
     btn_txt: bt
     
+- name: webhook
+  image: plugins/webhook
+  settings:
+    username: myusername
+    password: mypassword
+    urls: https://your.webhook/...
+    content_type: application/json
+    template: |
+        {
+          "msgtype": "markdown",
+          "markdown": {
+              "content": "{{#success build.status}}✅{{else}}❌{{/success}}**{{ repo.owner }}/{{ repo.name }}** (Build #{{build.number}})\n
+                          >**构建结果**: {{ build.status }}
+                          >**构建详情**: [点击查看]({{ build.link }})
+                          >**代码分支**: {{ build.branch }}
+                          >**提交标识**: {{ build.commit }}
+                          >**提交发起**: {{ build.author }}
+                          >**提交信息**: {{ build.message }}
+        "
+          }
+        }
+    
 volumes:
 - name: mvnCache
   host: