Skip to content

Commit 7c93774

Browse files
Merge pull request #1128 from snyk/chore/change-deploy-functionality
chore: change deploy to new internal deploy functionality
2 parents a9a364b + 0c577ea commit 7c93774

File tree

3 files changed

+42
-20
lines changed

3 files changed

+42
-20
lines changed

.circleci/config.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ commands:
2424
export NVM_DIR="/opt/circleci/.nvm"
2525
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
2626
nvm install v16
27-
npm install
27+
npm ci
2828
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
2929
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
3030
echo 'nvm alias default v16' >> $BASH_ENV
@@ -43,7 +43,7 @@ jobs:
4343
name: Create temp dir for logs
4444
- run:
4545
command: |
46-
npm install &&
46+
npm ci &&
4747
export KUBERNETES_MONITOR_IMAGE_NAME_AND_TAG=$(./scripts/circleci-jobs/setup-integration-tests.py)
4848
.circleci/do-exclusively --branch staging --job ${CIRCLE_JOB} npm run test:integration:aks:yaml
4949
name: Integration tests AKS
@@ -175,14 +175,7 @@ jobs:
175175
- checkout
176176
- install_python_requests
177177
- run:
178-
command: |
179-
LATEST_TAG_WITH_V=`git describe --abbrev=0 --tags ${CIRCLE_SHA1}` &&
180-
LATEST_TAG=${LATEST_TAG_WITH_V:1}-approved &&
181-
./scripts/slack/notify_deploy.py $LATEST_TAG dev &&
182-
curl -s --fail --show-error -i -H "Accept: application/json" -H "Content-Type: application/json" \
183-
-X POST -d "{\"docker_sha\":\"${LATEST_TAG}\", \
184-
\"commit_hash\":\"${CIRCLE_SHA1}\"}" \
185-
https://my.dev.snyk.io/${DEV_DEPLOY_TOKEN}
178+
command: ./scripts/circlci-jobs/deploy_to_dev.sh
186179
name: Deploy to dev
187180
- run:
188181
command: ./scripts/slack/notify_failure.py "${CIRCLE_BRANCH}" "${CIRCLE_JOB}" "${CIRCLE_BUILD_URL}" "${CIRCLE_PULL_REQUEST}" "${SLACK_WEBHOOK}"
@@ -268,7 +261,7 @@ jobs:
268261
name: Create temp dir for logs
269262
- run:
270263
command: |
271-
npm install &&
264+
npm ci &&
272265
export KUBERNETES_MONITOR_IMAGE_NAME_AND_TAG=$(./scripts/circleci-jobs/setup-integration-tests.py)
273266
.circleci/do-exclusively --branch staging --job ${CIRCLE_JOB} npm run test:integration:eks:yaml
274267
name: Integration tests EKS
@@ -986,7 +979,7 @@ jobs:
986979
- install_python_requests
987980
- run:
988981
command: |
989-
npm install &&
982+
npm ci &&
990983
docker login --username ${DOCKERHUB_USER} --password ${DOCKERHUB_PASSWORD} &&
991984
unset CIRCLE_PULL_REQUEST &&
992985
unset CI_PULL_REQUEST &&

.circleci/config/jobs/deploy_to_dev.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,7 @@ steps:
1010

1111
- run:
1212
name: Deploy to dev
13-
command: |
14-
LATEST_TAG_WITH_V=`git describe --abbrev=0 --tags ${CIRCLE_SHA1}` &&
15-
LATEST_TAG=${LATEST_TAG_WITH_V:1}-approved &&
16-
./scripts/slack/notify_deploy.py $LATEST_TAG dev &&
17-
curl -s --fail --show-error -i -H "Accept: application/json" -H "Content-Type: application/json" \
18-
-X POST -d "{\"docker_sha\":\"${LATEST_TAG}\", \
19-
\"commit_hash\":\"${CIRCLE_SHA1}\"}" \
20-
https://my.dev.snyk.io/${DEV_DEPLOY_TOKEN}
13+
command: ./scripts/circlci-jobs/deploy_to_dev.sh
2114

2215
- run:
2316
name: Notify Slack on failure
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#! /bin/bash
2+
set -e
3+
4+
# Getting latest released tag
5+
LATEST_TAG_WITH_V=`git describe --abbrev=0 --tags ${CIRCLE_SHA1}`
6+
LATEST_TAG=${LATEST_TAG_WITH_V:1}-approved
7+
8+
# Send Slack notification
9+
../slack/notify_deploy.py $LATEST_TAG dev
10+
11+
# Deploy to pre-prod
12+
git clone https://$GH_TOKEN@github.com/snyk/$KUBERNETES_MONITOR_DEPLOYER_REPO.git
13+
mkdir -p $KUBERNETES_MONITOR_DEPLOYER_REPO/helm/values/
14+
cat >$KUBERNETES_MONITOR_DEPLOYER_REPO/helm/values/pre-prod-mt.yaml <<EOF
15+
clusterName: "Development cluster"
16+
integrationApi: https://kubernetes-upstream.dev.snyk.io
17+
log_level: "DEBUG"
18+
skip_k8s_jobs: true
19+
20+
policyOrgs:
21+
- $POLICY_ORG_PRE_PROD
22+
23+
image:
24+
tag: $LATEST_TAG
25+
26+
skopeo:
27+
compression:
28+
level: 1
29+
30+
workers:
31+
count: 5
32+
33+
EOF
34+
cd $KUBERNETES_MONITOR_DEPLOYER_REPO &&
35+
git commit -am "feat: deploy to dev k-m $LATEST_TAG_WITH_V" &&
36+
git push origin main

0 commit comments

Comments
 (0)