Skip to content

Commit b46ad96

Browse files
authored
Merge pull request #146 from snyk/feat/auto_deploy_dev
feat: auto deploy to dev
2 parents da87ff0 + 4b1ac20 commit b46ad96

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

.circleci/config.yml

+23
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,22 @@ jobs:
6363
NEW_VERSION=`cat ./package.json | jq -r '.version'` &&
6464
./scripts/approve-image.sh $NEW_VERSION ||
6565
( ./scripts/slack-notify-failure.sh "staging-release" && false )
66+
deploy_dev:
67+
working_directory: ~/kubernetes-monitor
68+
docker:
69+
- image: circleci/node:10
70+
steps:
71+
- checkout
72+
- run:
73+
name: DEPLOY DEV
74+
command: |
75+
LATEST_TAG_WITH_V=`git describe --abbrev=0 --tags ${CIRCLE_SHA1}` &&
76+
LATEST_TAG=${LATEST_TAG_WITH_V:1} &&
77+
./scripts/slack-notify-deploy.sh $LATEST_TAG dev &&
78+
curl -i -H "Accept: application/json" -H "Content-Type: application/json" \
79+
-X POST -d "{\"docker_sha\":\"${LATEST_TAG}\", \
80+
\"commit_hash\":\"${CIRCLE_SHA1}\"}" \
81+
https://my.dev.snyk.io/${DEV_DEPLOY_TOKEN}
6682
6783
######################## PR TO MASTER ########################
6884
prepublish:
@@ -128,6 +144,13 @@ workflows:
128144
branches:
129145
only:
130146
- staging
147+
- deploy_dev:
148+
requires:
149+
- tag_and_push
150+
filters:
151+
branches:
152+
only:
153+
- staging
131154

132155
# reserved for the "pre publish "
133156
# PR_TO_MASTER:

scripts/slack-notify-deploy.sh

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#! /bin/bash
2+
curl -X POST -H 'Content-Type:application/json' -d '{"attachments": [{"color": "warning", "fallback": "Build Notification: '$CIRCLE_BUILD_URL'", "title": "Kubernetes-Monitor Deploy Notification", "text": ":hatching_chick: Deploying Kubernetes-Monitor on `'$2'`: `'$1'` :hatching_chick:"}]}' $SLACK_WEBHOOK

0 commit comments

Comments
 (0)