diff --git a/.drone.yml b/.drone.yml index 19d2f44..00919a5 100644 --- a/.drone.yml +++ b/.drone.yml @@ -25,13 +25,6 @@ steps: commands: - go build ./... -- name: notify - image: pluie/alpine - commands: - - export msg=${DRONE_COMMIT_MESSAGE} - - export msg="${msg:0:10}" - - /bin/bash -c "curl -s -k -X POST https://zulip.meta-tech.academy/api/v1/messages -u drone-bot@zulip.meta-tech.academy:iIm8Hc2VuvK06iDxUODUIndlRu6As6bO --data-urlencode type=stream --data-urlencode 'to=\"gitea\"' --data-urlencode topic=build --data-urlencode content=\"build n° ${DRONE_BUILD_NUMBER} - ${DRONE_REPO}/${DRONE_REPO_BRANCH}/${DRONE_COMMIT} by ${DRONE_COMMIT_AUTHOR} > ${DRONE_BUILD_STATUS} < $${msg} ...\"" - # - name: deploy code # image: appleboy/drone-ssh # volumes: @@ -56,6 +49,25 @@ steps: - apk add --no-cache openssh - ssh -p21022 -o StrictHostKeyChecking=accept-new -i /root/.ssh/id_rsa.kubehost mtc@bosub-kub-int.metacoaching.pro "hostname" +- name: notify + image: pluie/alpine + environment: + ZULIP_HOST: https://zulip.meta-tech.academy + ZULIP_STREAM: gitea + ZULIP_TOPIC: build + ZULIP_STATUS: ":check:" + ZULIP_USER: + from_secret: ZULIP_BOT + ZULIP_TKN: + from_secret: ZULIP_TOKEN + GOARCH: amd64 + commands: + - if [ "${DRONE_BUILD_STATUS}" != "success" ]; then export ZULIP_STATUS=":prohibited:"; fi + - export SHORT_COMMIT="${DRONE_COMMIT:0:7}" + - export REMOTE_URL="${DRONE_REMOTE_URL:0:-4}" + - export ZULIP_MESSAGE=${DRONE_COMMIT_MESSAGE} + - curl -X POST ${ZULIP_HOST}/api/v1/messages -u ${ZULIP_USER}:${ZULIP_TKN} --data-urlencode type=stream --data-urlencode 'to="${ZULIP_STREAM}"' --data-urlencode topic=${ZULIP_TOPIC} --data content="${ZULIP_STATUS} **[build #${DRONE_BUILD_NUMBER}](${DRONE_BUILD_LINK})**%0A> **${DRONE_BUILD_EVENT}** event on **${DRONE_COMMIT_BRANCH}** branch *by* **${DRONE_COMMIT_AUTHOR}** ([${SHORT_COMMIT}](${REMOTE_URL}/commit/${DRONE_COMMIT}))%0A> ${ZULIP_MESSAGE}" + volumes: - name: deps temp: {}