Skip to content

Commit 18d5fb7

Browse files
committed
chore: circleci job to deploy to shared sysdig cluster for testing
This is done every time a new version of the monitor is prepared (i.e. on merge to staging). This gives us the opportunity to test the integration before releasing a new version publicly.
1 parent c34f987 commit 18d5fb7

File tree

3 files changed

+96
-0
lines changed

3 files changed

+96
-0
lines changed

.circleci/config.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,47 @@ jobs:
201201
name: Notify Slack on failure
202202
when: on_fail
203203
working_directory: ~/kubernetes-monitor
204+
deploy_sysdig_integration_cluster:
205+
docker:
206+
- auth:
207+
password: $DOCKERHUB_PASSWORD
208+
username: $DOCKERHUB_USER
209+
image: cimg/base:stable
210+
steps:
211+
- checkout
212+
- run:
213+
command: |
214+
LATEST_KUBECTL_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt)
215+
curl -LO "https://dl.k8s.io/release/${LATEST_KUBECTL_VERSION}/bin/linux/amd64/kubectl"
216+
curl -LO "https://dl.k8s.io/${LATEST_KUBECTL_VERSION}/bin/linux/amd64/kubectl.sha256"
217+
echo "$(<kubectl.sha256) kubectl" | sha256sum --check
218+
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
219+
# Ensure the kubectl command is runnable
220+
kubectl version --client
221+
# Prepare kubeconfig to point to the cluster
222+
mkdir ~/.kube || true
223+
printf "%s" "${SYSDIG_KUBECONFIG}" | base64 -d > ~/.kube/config
224+
name: Install and prepare kubectl
225+
- run:
226+
command: |
227+
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
228+
chmod 700 get_helm.sh
229+
./get_helm.sh
230+
# Ensure the Helm command is runnable
231+
helm version
232+
name: Install Helm
233+
- run:
234+
command: |
235+
LATEST_TAG_WITH_V=`git describe --abbrev=0 --tags ${CIRCLE_SHA1}`
236+
LATEST_TAG=${LATEST_TAG_WITH_V:1}-approved
237+
./scripts/slack/notify_deploy.py $LATEST_TAG sysdig-integration-cluster
238+
helm upgrade --install snyk-monitor ./snyk-monitor --namespace snyk-monitor --set image.tag=${LATEST_TAG} --set clusterName="Sysdig cluster" --set sysdig.enabled=true
239+
name: Deploy to shared Sysdig cluster
240+
- run:
241+
command: ./scripts/slack/notify_failure.py "${CIRCLE_BRANCH}" "${CIRCLE_JOB}" "${CIRCLE_BUILD_URL}" "${CIRCLE_PULL_REQUEST}" "${SLACK_WEBHOOK}"
242+
name: Notify Slack on failure
243+
when: on_fail
244+
working_directory: ~/kubernetes-monitor
204245
eks_integration_tests:
205246
machine:
206247
docker_layer_caching: true
@@ -1133,6 +1174,13 @@ workflows:
11331174
- staging
11341175
requires:
11351176
- tag_and_push
1177+
- deploy_sysdig_integration_cluster:
1178+
filters:
1179+
branches:
1180+
only:
1181+
- staging
1182+
requires:
1183+
- tag_and_push
11361184
MONTHLY:
11371185
jobs:
11381186
- operator_upgrade_tests

.circleci/config/@config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ workflows:
101101
requires:
102102
- tag_and_push
103103
<<: *staging_branch_only_filter
104+
- deploy_sysdig_integration_cluster:
105+
requires:
106+
- tag_and_push
107+
<<: *staging_branch_only_filter
104108

105109
MERGE_TO_MASTER:
106110
jobs:
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
docker:
2+
- image: cimg/base:stable
3+
auth:
4+
username: $DOCKERHUB_USER
5+
password: $DOCKERHUB_PASSWORD
6+
working_directory: ~/kubernetes-monitor
7+
steps:
8+
- checkout
9+
10+
- run:
11+
name: Install and prepare kubectl
12+
command: |
13+
LATEST_KUBECTL_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt)
14+
curl -LO "https://dl.k8s.io/release/${LATEST_KUBECTL_VERSION}/bin/linux/amd64/kubectl"
15+
curl -LO "https://dl.k8s.io/${LATEST_KUBECTL_VERSION}/bin/linux/amd64/kubectl.sha256"
16+
echo "$(<kubectl.sha256) kubectl" | sha256sum --check
17+
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
18+
# Ensure the kubectl command is runnable
19+
kubectl version --client
20+
# Prepare kubeconfig to point to the cluster
21+
mkdir ~/.kube || true
22+
printf "%s" "${SYSDIG_KUBECONFIG}" | base64 -d > ~/.kube/config
23+
24+
- run:
25+
name: Install Helm
26+
command: |
27+
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
28+
chmod 700 get_helm.sh
29+
./get_helm.sh
30+
# Ensure the Helm command is runnable
31+
helm version
32+
33+
- run:
34+
name: Deploy to shared Sysdig cluster
35+
command: |
36+
LATEST_TAG_WITH_V=`git describe --abbrev=0 --tags ${CIRCLE_SHA1}`
37+
LATEST_TAG=${LATEST_TAG_WITH_V:1}-approved
38+
./scripts/slack/notify_deploy.py $LATEST_TAG sysdig-integration-cluster
39+
helm upgrade --install snyk-monitor ./snyk-monitor --namespace snyk-monitor --set image.tag=${LATEST_TAG} --set clusterName="Sysdig cluster" --set sysdig.enabled=true
40+
41+
- run:
42+
name: Notify Slack on failure
43+
when: on_fail
44+
command: ./scripts/slack/notify_failure.py "${CIRCLE_BRANCH}" "${CIRCLE_JOB}" "${CIRCLE_BUILD_URL}" "${CIRCLE_PULL_REQUEST}" "${SLACK_WEBHOOK}"

0 commit comments

Comments
 (0)