From ccf4efc8897e4ab8ce144601f5cf63b0ab8924b0 Mon Sep 17 00:00:00 2001 From: hanhxiao Date: Fri, 27 Sep 2019 18:55:17 +0800 Subject: [PATCH] fix(cd): fix trigger in cd pipeline --- .drone-cd.yml | 134 +++++++++++++------------------------------------- 1 file changed, 34 insertions(+), 100 deletions(-) diff --git a/.drone-cd.yml b/.drone-cd.yml index 7f5dfaa7..1f2bc871 100644 --- a/.drone-cd.yml +++ b/.drone-cd.yml @@ -54,49 +54,15 @@ steps: - export MSG_CONTENT="" - ./shell/push-wechatwork.sh -- name: notify the failure on wechat work - image: byrnedo/alpine-curl - environment: - BOT_URL: - from_secret: BOT_URL - commands: - - export MSG_LINK=$DRONE_BUILD_LINK - - export MSG_TITLE="❌🎁 fail to build docker image!" - - export MSG_CONTENT="please inform [$DRONE_COMMIT_AUTHOR]($DRONE_COMMIT_AUTHOR_EMAIL) to modify and fix [\`$DRONE_SOURCE_BRANCH\`]($DRONE_COMMIT_LINK). click the link below to see the details." - - ./shell/push-wechatwork.sh - when: - status: - - failure - -trigger: - branch: - - master - event: - - push - -volumes: -- name: docker - host: - path: /var/run/docker.sock - ---- - -kind: pipeline -name: release-docker-build - -clone: - depth: 50 - -steps: -- name: notify the start on wechat work +- name: notify the start on benchmark work image: byrnedo/alpine-curl environment: BOT_URL: from_secret: BOT_URL commands: - - export MSG_LINK=$DRONE_BUILD_LINK - - export MSG_TITLE="⌛🗳 Start to build docker image for new release \`$DRONE_SOURCE_BRANCH\`(\`${DRONE_TAG}\`)" - - export MSG_CONTENT="[tag link](https://github.com/gnes-ai/gnes/tree/${DRONE_TAG}), click the link below to see the status" + - export MSG_LINK=${DRONE_BUILD_LINK} + - export MSG_TITLE="🏎️🐎 Start to benchmark the new master \`$DRONE_SOURCE_BRANCH\`(\`${DRONE_BUILD_NUMBER}\`)" + - export MSG_CONTENT="click the link below to see the status" - ./shell/push-wechatwork.sh - name: build and push docker images @@ -105,6 +71,8 @@ steps: volumes: - name: docker path: /var/run/docker.sock + - name: cache + path: /workspace environment: TCLOUD_USER: from_secret: TCLOUD_USER @@ -122,8 +90,13 @@ steps: from_secret: GITHUB_USER GITHUB_PWD: from_secret: GITHUB_PWD + DO_BENCHMARK: + from_secret: DO_BENCHMARK + BENCHMARK_DIR: /workspace/benchmark/ + SHARED_HOST_PATH: /tmp/ commands: - - ./docker-build.sh + - ./benchmark-eval.sh + - docker system prune -a -f - name: notify the sucess on wechat work image: byrnedo/alpine-curl @@ -131,8 +104,8 @@ steps: BOT_URL: from_secret: BOT_URL commands: - - export MSG_LINK="https://github.com/gnes-ai/gnes/tree/${DRONE_TAG}" - - export MSG_TITLE="✅🎁 All images are successfully delivered!" + - export MSG_LINK="https://github.com/gnes-ai/benchmark" + - export MSG_TITLE="✅🏍️ New benchmark is updated!" - export MSG_CONTENT="" - ./shell/push-wechatwork.sh @@ -143,29 +116,34 @@ steps: from_secret: BOT_URL commands: - export MSG_LINK=$DRONE_BUILD_LINK - - export MSG_TITLE="❌🎁 fail to build docker image!" - - export MSG_CONTENT="[tag link](https://github.com/gnes-ai/gnes/tree/${DRONE_TAG}) please inform [$DRONE_COMMIT_AUTHOR]($DRONE_COMMIT_AUTHOR_EMAIL) to modify and fix [\`$DRONE_SOURCE_BRANCH\`]($DRONE_COMMIT_LINK). click the link below to see the details." + - export MSG_TITLE="❌🎁🏍️ fail to build and benchmark the docker image!" + - export MSG_CONTENT="please inform [$DRONE_COMMIT_AUTHOR]($DRONE_COMMIT_AUTHOR_EMAIL) to modify and fix [\`$DRONE_SOURCE_BRANCH\`]($DRONE_COMMIT_LINK). click the link below to see the details." - ./shell/push-wechatwork.sh when: status: - failure trigger: + branch: + - master event: - - tag + - push volumes: - name: docker host: path: /var/run/docker.sock +- name: cache + host: + path: /tmp/ --- kind: pipeline -name: master-docker-benchmark +name: release-docker-build clone: - depth: 10 + depth: 50 steps: - name: notify the start on wechat work @@ -174,9 +152,9 @@ steps: BOT_URL: from_secret: BOT_URL commands: - - export MSG_LINK=${DRONE_BUILD_LINK} - - export MSG_TITLE="🏎️🐎 Start to benchmark the new master \`$DRONE_SOURCE_BRANCH\`(\`${DRONE_BUILD_NUMBER}\`)" - - export MSG_CONTENT="click the link below to see the status" + - export MSG_LINK=$DRONE_BUILD_LINK + - export MSG_TITLE="⌛🗳 Start to build docker image for new release \`$DRONE_SOURCE_BRANCH\`(\`${DRONE_TAG}\`)" + - export MSG_CONTENT="[tag link](https://github.com/gnes-ai/gnes/tree/${DRONE_TAG}), click the link below to see the status" - ./shell/push-wechatwork.sh - name: build and push docker images @@ -185,8 +163,6 @@ steps: volumes: - name: docker path: /var/run/docker.sock - - name: cache - path: /workspace environment: TCLOUD_USER: from_secret: TCLOUD_USER @@ -204,13 +180,8 @@ steps: from_secret: GITHUB_USER GITHUB_PWD: from_secret: GITHUB_PWD - DO_BENCHMARK: - from_secret: DO_BENCHMARK - BENCHMARK_DIR: /workspace/benchmark/ - SHARED_HOST_PATH: /tmp/ commands: - - ./benchmark-eval.sh - - docker system prune -a -f + - ./docker-build.sh - name: notify the sucess on wechat work image: byrnedo/alpine-curl @@ -218,49 +189,12 @@ steps: BOT_URL: from_secret: BOT_URL commands: - - export MSG_LINK="https://github.com/gnes-ai/benchmark" - - export MSG_TITLE="✅🏍️ New benchmark is updated!" + - export MSG_LINK="https://github.com/gnes-ai/gnes/tree/${DRONE_TAG}" + - export MSG_TITLE="✅🎁 All images are successfully delivered!" - export MSG_CONTENT="" - ./shell/push-wechatwork.sh -- name: notify the failure on wechat work - image: byrnedo/alpine-curl - environment: - BOT_URL: - from_secret: BOT_URL - commands: - - export MSG_LINK="https://github.com/gnes-ai/benchmark" - - export MSG_TITLE="❌🏍 fail to benchmark GNES!" - - export MSG_CONTENT="please inform [$DRONE_COMMIT_AUTHOR]($DRONE_COMMIT_AUTHOR_EMAIL) to modify and fix [\`$DRONE_SOURCE_BRANCH\`]($DRONE_COMMIT_LINK). click the link below to see the details." - - ./shell/push-wechatwork.sh - when: - status: - - failure - -trigger: - branch: - - master - event: - - push - -volumes: -- name: docker - host: - path: /var/run/docker.sock -- name: cache - host: - path: /tmp/ - ---- - -kind: pipeline -name: release-docker-benchmark - -clone: - depth: 10 - -steps: -- name: notify the start on wechat work +- name: notify the start on benchmark work image: byrnedo/alpine-curl environment: BOT_URL: @@ -321,9 +255,9 @@ steps: BOT_URL: from_secret: BOT_URL commands: - - export MSG_LINK="https://github.com/gnes-ai/benchmark" - - export MSG_TITLE="❌🏍 fail to benchmark GNES!" - - export MSG_CONTENT="please inform [$DRONE_COMMIT_AUTHOR]($DRONE_COMMIT_AUTHOR_EMAIL) to modify and fix [\`$DRONE_SOURCE_BRANCH\`]($DRONE_COMMIT_LINK). click the link below to see the details." + - export MSG_LINK=$DRONE_BUILD_LINK + - export MSG_TITLE="❌🎁🏍️ fail to build and benchmark the docker image!" + - export MSG_CONTENT="[tag link](https://github.com/gnes-ai/gnes/tree/${DRONE_TAG}) please inform [$DRONE_COMMIT_AUTHOR]($DRONE_COMMIT_AUTHOR_EMAIL) to modify and fix [\`$DRONE_SOURCE_BRANCH\`]($DRONE_COMMIT_LINK). click the link below to see the details." - ./shell/push-wechatwork.sh when: status: