Skip to content
Permalink
Browse files

ci(drone): add self hosted drone

  • Loading branch information...
hanxiao committed Aug 14, 2019
1 parent 079d0a1 commit a8700801514811baccc5fd4c1f06a89426a7721c
Showing with 85 additions and 8 deletions.
  1. +78 −1 .drone-cd.yml
  2. +7 −7 docker-build.sh
@@ -12,7 +12,7 @@ steps:
from_secret: BOT_URL
commands:
- export MSG_LINK=${DRONE_BUILD_LINK}
- export MSG_TITLE="⌛🗳 Start to build docker image \`$DRONE_SOURCE_BRANCH\`(\`${DRONE_BUILD_NUMBER}\`)"
- export MSG_TITLE="⌛🗳 Start to build docker image for latest master \`$DRONE_SOURCE_BRANCH\`(\`${DRONE_BUILD_NUMBER}\`)"
- export MSG_CONTENT="click the link below to see the status"
- ./shell/push-wechatwork.sh

@@ -69,6 +69,83 @@ trigger:
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
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_BUILD_NUMBER}\`)"
- export MSG_CONTENT="click the link below to see the status"
- ./shell/push-wechatwork.sh

- name: build and push docker images
image: gnes/dind
privileged: true
volumes:
- name: docker
path: /var/run/docker.sock
environment:
TCLOUD_USER:
from_secret: TCLOUD_USER
TCLOUD_PWD:
from_secret: TCLOUD_PWD
HUB_USER:
from_secret: HUB_USER
HUB_PWD:
from_secret: HUB_PWD
BADGE_WEBHOOK:
from_secret: BADGE_WEBHOOK
BOT_URL:
from_secret: BOT_URL
IS_RELEASE: true
commands:
- ./docker-build.sh

- name: notify the sucess on wechat work
image: byrnedo/alpine-curl
environment:
BOT_URL:
from_secret: BOT_URL
commands:
- export MSG_LINK=$DRONE_REPO_LINK
- export MSG_TITLE="✅🎁 All images is successfully updated!"
- 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:
event:
- tag

volumes:
- name: docker
host:
@@ -45,20 +45,20 @@ do
--build-arg VCS_REF=`git rev-parse --short HEAD` \
--rm --target $TARGET -t $IMAGE_TAG -f $DOCKER_FILE .

# if [[ -z "${TCLOUD_USER}" ]]; then
# printf "\$TCLOUD_USER not set, exit"
# exit 1
# else
# login_push ${TCLOUD_USER} ${TCLOUD_PWD} ccr.ccs.tencentyun.com ccr.ccs.tencentyun.com/gnes
# fi


if [[ -z "${HUB_USER}" ]]; then
printf "\$HUB_USER not set, exit"
exit 1
else
login_push ${HUB_USER} ${HUB_PWD} " " gnes
fi

if [[ -z "${TCLOUD_USER}" ]]; then
printf "\$TCLOUD_USER not set, exit"
exit 1
else
login_push ${TCLOUD_USER} ${TCLOUD_PWD} ccr.ccs.tencentyun.com ccr.ccs.tencentyun.com/gnes
fi
done


0 comments on commit a870080

Please sign in to comment.
You can’t perform that action at this time.