Skip to content

Commit 00a433e

Browse files
Merge pull request #1455 from snyk/staging
RELEASE
2 parents 00ab5f1 + a2a1b69 commit 00a433e

File tree

13 files changed

+269
-124
lines changed

13 files changed

+269
-124
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ jobs:
166166
name: Notify Slack on failure
167167
when: on_fail
168168
working_directory: ~/kubernetes-monitor
169-
deploy_to_dev:
169+
prepare_to_deploy:
170170
docker:
171171
- auth:
172172
password: $DOCKERHUB_PASSWORD
@@ -176,7 +176,7 @@ jobs:
176176
- checkout
177177
- install_python_requests
178178
- run:
179-
command: ./scripts/circleci-jobs/deploy_to_dev.sh
179+
command: ./scripts/circleci-jobs/prepare_to_deploy.sh
180180
name: Deploy to dev
181181
- run:
182182
command: ./scripts/slack/notify_failure.py "${CIRCLE_BRANCH}" "${CIRCLE_JOB}" "${CIRCLE_BUILD_URL}" "${CIRCLE_PULL_REQUEST}" "${SLACK_WEBHOOK}"
@@ -1099,7 +1099,7 @@ workflows:
10991099
- build_and_upload_operator
11001100
- unit_tests
11011101
- system_tests
1102-
- deploy_to_dev:
1102+
- prepare_to_deploy:
11031103
context: team-container-integration
11041104
filters:
11051105
branches:

.circleci/config/@config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ workflows:
100100
# - integration_tests_helm
101101
# - integration_tests_proxy
102102
<<: *staging_branch_only_filter
103-
- deploy_to_dev:
103+
- prepare_to_deploy:
104104
context: team-container-integration
105105
requires:
106106
- tag_and_push

.circleci/config/jobs/deploy_to_dev.yml

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

1111
- run:
1212
name: Deploy to dev
13-
command: ./scripts/circleci-jobs/deploy_to_dev.sh
13+
command: ./scripts/circleci-jobs/prepare_to_deploy.sh
1414

1515
- run:
1616
name: Notify Slack on failure

package-lock.json

Lines changed: 10 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"packageurl-js": "^1.2.1",
5050
"sleep-promise": "^9.1.0",
5151
"snyk-config": "5.1.0",
52-
"snyk-docker-plugin": "^6.8.3",
52+
"snyk-docker-plugin": "^6.10.0",
5353
"source-map-support": "^0.5.21",
5454
"tunnel": "0.0.6",
5555
"typescript": "4.7.4",

scripts/circleci-jobs/deploy_to_dev.sh

Lines changed: 0 additions & 91 deletions
This file was deleted.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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}
7+
8+
# Config git
9+
git config --global user.email "[email protected]"
10+
git config --global user.name "K-M Deploy Bot"
11+
12+
# Clone repo
13+
git clone https://$GH_TOKEN@github.com/snyk/$KUBERNETES_MONITOR_DEPLOYER_REPO.git
14+
15+
# Copy contents from snyk-monitor/ folder into deployer helm/ folder in github
16+
cp -r snyk-monitor/* $KUBERNETES_MONITOR_DEPLOYER_REPO/helm
17+
18+
# Replace Chart.yaml with the Chart.yaml from the deployer repo
19+
cat $KUBERNETES_MONITOR_DEPLOYER_REPO/Chart.yaml > $KUBERNETES_MONITOR_DEPLOYER_REPO/helm/Chart.yaml
20+
21+
# Create environment values file(s)
22+
cat >$KUBERNETES_MONITOR_DEPLOYER_REPO/helm/values/$PRODUCTION_YAML_FILE_NAME.yaml <<EOF
23+
clusterName: "Production cluster"
24+
skip_k8s_jobs: true
25+
26+
requests:
27+
memory: "4Gi"
28+
29+
limits:
30+
memory: "4Gi"
31+
32+
policyOrgs:
33+
- $POLICY_ORG_PROD
34+
35+
image:
36+
tag: $LATEST_TAG
37+
38+
skopeo:
39+
compression:
40+
level: 1
41+
42+
workers:
43+
count: 5
44+
45+
metadata:
46+
annotations:
47+
github.com/project-slug: snyk/kubernetes-monitor
48+
github.com/team-slug: snyk/container-integration
49+
labels:
50+
$SNYK_OWNER_LABEL_KEY: $SNYK_OWNER_LABEL_VALUE
51+
$SNYK_LOG_DEST_LABEL_KEY: $SNYK_LOG_DEST_LABEL_VALUE
52+
53+
EOF
54+
55+
# Add extra values
56+
cat $KUBERNETES_MONITOR_DEPLOYER_REPO/extra-production-values.yaml >> $KUBERNETES_MONITOR_DEPLOYER_REPO/helm/values/$PRODUCTION_YAML_FILE_NAME.yaml
57+
58+
cd $KUBERNETES_MONITOR_DEPLOYER_REPO
59+
git commit --allow-empty -am "feat: deploy k-m $LATEST_TAG_WITH_V"
60+
git push origin main

src/scanner/images/index.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@ async function pullImageBySkopeoRepo(
2727
): Promise<IPullableImage> {
2828
// Scan image by digest if exists, other way fallback tag
2929
const scanId = imageToPull.imageWithDigest ?? imageToPull.imageName;
30-
await skopeoCopy(
30+
const { manifestDigest, indexDigest } = await skopeoCopy(
3131
scanId,
3232
imageToPull.fileSystemPath,
3333
imageToPull.skopeoRepoType,
3434
workloadName,
3535
);
36+
imageToPull.manifestDigest = manifestDigest;
37+
imageToPull.indexDigest = indexDigest;
3638
return imageToPull;
3739
}
3840

@@ -126,14 +128,23 @@ export async function scanImages(
126128
): Promise<IScanResult[]> {
127129
const scannedImages: IScanResult[] = [];
128130

129-
for (const { imageName, fileSystemPath, imageWithDigest } of images) {
131+
for (const {
132+
imageName,
133+
fileSystemPath,
134+
imageWithDigest,
135+
manifestDigest,
136+
indexDigest,
137+
} of images) {
130138
try {
131139
const archivePath = `docker-archive:${fileSystemPath}`;
132140

133141
const pluginResponse = await scan({
134142
path: archivePath,
135143
imageNameAndTag: imageName,
136-
imageNameAndDigest: imageWithDigest,
144+
digests: {
145+
manifest: manifestDigest,
146+
index: indexDigest,
147+
},
137148
});
138149

139150
if (

0 commit comments

Comments
 (0)