File tree Expand file tree Collapse file tree 4 files changed +33
-15
lines changed Expand file tree Collapse file tree 4 files changed +33
-15
lines changed Original file line number Diff line number Diff line change @@ -192,13 +192,7 @@ jobs:
192192 - checkout
193193 - install_python_requests
194194 - run :
195- command : |
196- LATEST_TAG_WITH_V=`git describe --abbrev=0 --tags ${CIRCLE_SHA1}` &&
197- LATEST_TAG=${LATEST_TAG_WITH_V:1} &&
198- ./scripts/slack/notify_deploy.py $LATEST_TAG prod &&
199- curl -s --fail --show-error -i -H "Accept: application/json" -H "Content-Type: application/json" \
200- -X POST -d "{}" \
201- https://my.prod.snyk.io/${PROD_DEPLOY_TOKEN}
195+ command : ./scripts/circleci-jobs/deploy_to_prod.sh
202196 name : Deploy to prod
203197 - run :
204198 command : ./scripts/slack/notify_failure.py "${CIRCLE_BRANCH}" "${CIRCLE_JOB}" "${CIRCLE_BUILD_URL}" "${CIRCLE_PULL_REQUEST}" "${SLACK_WEBHOOK}"
Original file line number Diff line number Diff line change @@ -10,13 +10,7 @@ steps:
1010
1111 - run :
1212 name : Deploy to prod
13- command : |
14- LATEST_TAG_WITH_V=`git describe --abbrev=0 --tags ${CIRCLE_SHA1}` &&
15- LATEST_TAG=${LATEST_TAG_WITH_V:1} &&
16- ./scripts/slack/notify_deploy.py $LATEST_TAG prod &&
17- curl -s --fail --show-error -i -H "Accept: application/json" -H "Content-Type: application/json" \
18- -X POST -d "{}" \
19- https://my.prod.snyk.io/${PROD_DEPLOY_TOKEN}
13+ command : ./scripts/circleci-jobs/deploy_to_prod.sh
2014
2115 - run :
2216 name : Notify Slack on failure
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ git config --global user.name "K-M Deploy Boy"
1515
1616git clone https://$GH_TOKEN @github.com/snyk/$KUBERNETES_MONITOR_DEPLOYER_REPO .git
1717
18- cp -r snyk-monitor/ $KUBERNETES_MONITOR_DEPLOYER_REPO /
18+ cp -r snyk-monitor/* $KUBERNETES_MONITOR_DEPLOYER_REPO /helm
1919
2020# Create helm values for different envs
2121cat > $KUBERNETES_MONITOR_DEPLOYER_REPO /helm/values/pre-prod-mt.yaml << EOF
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+
4+ PIPELINE_ID=$( curl -s --fail --show-error \
5+ -H " Accept: application/json" \
6+ -H " Content-Type: application/json" \
7+ -H " Circle-Token: $CIRCLI_CI_API_TOKEN " \
8+ https://circleci.com/api/v2/project/github/snyk/" ${KUBERNETES_MONITOR_DEPLOYER_REPO} " /pipeline | jq -r .items[0].id)
9+
10+
11+ WORKFLOW_ID=$( curl -s --fail --show-error \
12+ -H " Accept: application/json" \
13+ -H " Content-Type: application/json" \
14+ -H " Circle-Token: $CIRCLI_CI_API_TOKEN " \
15+ https://circleci.com/api/v2/pipeline/" ${PIPELINE_ID} " /workflow | jq -r .items[0].id)
16+
17+ APPROVAL_REQUEST_ID=$( curl -s --fail --show-error \
18+ -H " Accept: application/json" \
19+ -H " Content-Type: application/json" \
20+ -H " Circle-Token: $CIRCLI_CI_API_TOKEN " \
21+ https://circleci.com/api/v2/workflow/" ${WORKFLOW_ID} " /job | jq -r ' .items[] | select(.name == "Approve Production deployment") | .approval_request_id' )
22+
23+ APPROVAL=$( curl -s --fail --show-error \
24+ -H " Accept: application/json" \
25+ -H " Content-Type: application/json" \
26+ -H " Circle-Token: $CIRCLI_CI_API_TOKEN " \
27+ -X POST -d " {}" \
28+ https://circleci.com/api/v2/workflow/" ${WORKFLOW_ID} " /approve/" ${APPROVAL_REQUEST_ID} " | jq -r .message)
29+
30+ [[ ${APPROVAL} == " Accepted." ]] && echo " Approved Production deployment!"
You can’t perform that action at this time.
0 commit comments