Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
ci(drone): add self hosted drone
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhxiao committed Aug 14, 2019
1 parent 079d0a1 commit a870080
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 8 deletions.
79 changes: 78 additions & 1 deletion .drone-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down
14 changes: 7 additions & 7 deletions docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit a870080

Please sign in to comment.