Skip to content

Commit 74d58bc

Browse files
authored
Merge pull request #4473 from RADAR-base/ci/operator-updates-snyk-scan
ci/operator-updates-snyk-scan
2 parents 75bb3ba + b6f76fd commit 74d58bc

File tree

3 files changed

+32
-10
lines changed

3 files changed

+32
-10
lines changed

.github/bin/external_docker_image_matrix

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,21 @@ cleanup
3131
for chart in $INCLUDE_CHARTS
3232
do
3333
echo Analyzing chart $chart ...
34-
helm template ../$chart 2> /dev/null | grep -oP "(?<=image: ).*" | tr -d \" >> $location.tmp
34+
helm template ../$chart 2> /dev/null | grep -oP "(?<=image: ).*" | tr -d \" >> images.tmp
35+
done
36+
37+
echo
38+
39+
# Add the images that derived by the INCLUDE_IMAGES environment variable.
40+
for image in $INCLUDE_IMAGES
41+
do
42+
echo Adding hard coded image $image ...
43+
echo $image >> images.tmp
3544
done
3645

3746
# Add a docker.io prefix to images without a registry.
38-
cat charts.tmp | grep ".*\/.*\/.*" > images.tmp2
39-
cat charts.tmp | grep -v ".*\/.*\/.*" | sed "s/^/docker.io\//g" > images.tmp3
47+
cat images.tmp | grep ".*/.*/.*" > images.tmp2
48+
cat images.tmp | grep -v ".*/.*/.*" | sed "s/^/docker.io\//g" > images.tmp3
4049
cat images.tmp2 images.tmp3 | sort | uniq > images.txt
4150

4251
# Exclude images refs that match any of the patterns passed in with the EXCLUDE_IMAGE_PATTERNS environment variable.

.github/workflows/scheduled-snyk-docker.yaml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,22 @@ jobs:
3434
# - busybox: init container
3535
# - alpine: init container
3636
# - linuxserver/yq: init container
37-
EXCLUDE_IMAGE_PATTERNS: bats busybox docker.io/alpine linuxserver/yq
37+
EXCLUDE_IMAGE_PATTERNS: bats
38+
busybox
39+
docker.io/alpine
40+
linuxserver/yq
3841
# In this action we only scan 'external' dependencies of the RADAR-base deployment.
3942
# RADAR-base services are scanned in the respective GitHub repositories.
40-
# Note on missing charts:
43+
# Notes on charts:
4144
# - elasticsearch:
4245
# FIXME: the elasticsearch image gives sarif related errors, so it is excluded for now.
4346
# we need a better way to handle this.
4447
INCLUDE_CHARTS: charts/cc-schema-registry-proxy
4548
charts/cert-manager-lets-encrypt
4649
charts/kube-prometheus-stack
47-
charts/radar-cloudnative-postgresql
48-
charts/radar-cloudnative-timescaledb
4950
charts/radar-grafana
5051
charts/radar-hydra
5152
charts/radar-kratos
52-
charts/radar-postgresql
53-
charts/radar-timescaledb
5453
charts/radar-s3-proxy
5554
charts/velero-s3-deployment
5655
external/cloudnativepg-operator
@@ -61,6 +60,18 @@ jobs:
6160
external/mongodb
6261
external/nifi
6362
external/redis
63+
external/strimzi-kafka-operator
64+
external/strimzi-registry-operator
65+
# Any image that matches any of these patterns will be included for scanning.
66+
# Reasons:
67+
# - ghcr.io/cloudnative-pg/postgresql:16: deployed via operator so image tag not specifies in the chart in this repo.
68+
# - timescale/timescaledb-ha:pg16-ts2.15: deployed via operator so image tag not specified in the chart in this repo.
69+
# - quay.io/strimzi/kafka:0.46.0-kafka-3.9.0: deployed via operator so image tag not specified in the chart in this repo.
70+
# - confluentinc/cp-schema-registry:7.2.1: deployed via operator so image tag not specified in the chart in this repo.
71+
INCLUDE_IMAGES: ghcr.io/cloudnative-pg/postgresql:16
72+
timescale/timescaledb-ha:pg16-ts2.15
73+
quay.io/strimzi/kafka:0.46.0-kafka-3.9.0
74+
confluentinc/cp-schema-registry:7.2.1
6475
run: .github/bin/external_docker_image_matrix
6576

6677
- name: Commit and push if docker-images-matrix.json changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,9 @@ parent chart being available in the Helm repository.
139139
examples.
140140
2. Add helm chart as a new `update-<chart-name>` section in the `Makefile`.
141141
3. Register the new chart in the `.github/workflows/scheduled-snyk-docker.yaml` for vulnerability scanning by adding the
142-
chart name to the `INCLUDE_CHARTS` environmental variable in the _set-matrix_ step.
142+
chart name to the `INCLUDE_CHARTS` environmental variable in the _set-matrix_ step. When the docker image is not directly
143+
listed in the _deployment.yaml_ file (i.e., when the image is deployed via an Operator), add the image name to the
144+
`INCLUDE_IMAGES` environmental variable.
143145

144146
#### Updating external charts
145147

0 commit comments

Comments
 (0)