Skip to content

Commit 0ebef3f

Browse files
committed
add security scan
Signed-off-by: Riccardo Piccoli <rpiccoli@redhat.com>
1 parent af2a1e7 commit 0ebef3f

File tree

8 files changed

+64
-11
lines changed

8 files changed

+64
-11
lines changed

.github/workflows/release.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ jobs:
1010
build:
1111
env:
1212
context: "./"
13-
controlplane_image_name: "openshift-capi-agent-controlplane"
14-
bootstrap_image_name: "openshift-capi-agent-bootstrap"
13+
controlplane_image_name: "cluster-api-controlplane-provider-openshift-assisted"
14+
bootstrap_image_name: "cluster-api-bootstrap-provider-openshift-assisted"
1515
name: Release
1616
runs-on: ubuntu-latest
1717
steps:
@@ -26,8 +26,8 @@ jobs:
2626
- name: Set tags on manifests
2727
id: set_tag_manifests
2828
run: |
29-
sed -i "s,quay.io/edge-infrastructure/openshift-capi-agent-bootstrap:latest,${{ secrets.REGISTRY_SERVER }}/${{ secrets.REGISTRY_NAMESPACE }}/${{ env.bootstrap_image_name }}:${{env.VERSION}}," bootstrap-components.yaml
30-
sed -i "s,quay.io/edge-infrastructure/openshift-capi-agent-controlplane:latest,${{ secrets.REGISTRY_SERVER }}/${{ secrets.REGISTRY_NAMESPACE }}/${{ env.controlplane_image_name }}:${{env.VERSION}}," controlplane-components.yaml
29+
sed -i "s,quay.io/edge-infrastructure/cluster-api-bootstrap-provider-openshift-assisted:latest,${{ secrets.REGISTRY_SERVER }}/${{ secrets.REGISTRY_NAMESPACE }}/${{ env.bootstrap_image_name }}:${{env.VERSION}}," bootstrap-components.yaml
30+
sed -i "s,quay.io/edge-infrastructure/cluster-api-controlplane-provider-openshift-assisted:latest,${{ secrets.REGISTRY_SERVER }}/${{ secrets.REGISTRY_NAMESPACE }}/${{ env.controlplane_image_name }}:${{env.VERSION}}," controlplane-components.yaml
3131
- name: Login to Quay.io
3232
uses: docker/login-action@v3
3333
with:

.github/workflows/security-scan.yaml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: security-scan
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
jobs:
8+
build:
9+
name: Security scan
10+
runs-on: ubuntu-24.04
11+
env:
12+
CONTAINER_TAG: ${{ github.sha }}
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
- name: Build an image from Dockerfile
17+
run: make docker-build-all
18+
- name: Build an image from Dockerfile
19+
run: podman image ls
20+
- name: Run Trivy vulnerability scanner for controlplane
21+
uses: aquasecurity/trivy-action@0.30.0
22+
with:
23+
image-ref: 'quay.io/edge-infrastructure/cluster-api-controlplane-provider-openshift-assisted:${{ github.sha }}'
24+
format: 'sarif'
25+
ignore-unfixed: true
26+
vuln-type: 'os,library'
27+
severity: 'CRITICAL,HIGH'
28+
- name: Upload Trivy scan results to GitHub Security tab
29+
uses: github/codeql-action/upload-sarif@v3
30+
if: always()
31+
with:
32+
sarif_file: 'trivy-results.sarif'
33+
- name: Run Trivy vulnerability scanner for bootstrap
34+
uses: aquasecurity/trivy-action@0.28.0
35+
with:
36+
image-ref: 'quay.io/edge-infrastructure/cluster-api-bootstrap-provider-openshift-assisted:${{ github.sha }}'
37+
format: 'table'
38+
exit-code: '1'
39+
ignore-unfixed: true
40+
vuln-type: 'os,library'
41+
severity: 'CRITICAL,HIGH'

.trivy.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
scan:
2+
offline: true
3+
vulnerability:
4+
ignore-unfixed: true
5+
severity:
6+
- HIGH
7+
- CRITICAL
8+
format: 'sarif'
9+
pkg:
10+
types:
11+
- os
12+
- library

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# provider to build
22
PROVIDER ?= bootstrap
33
CONTAINER_REPOSITORY_ORG ?= edge-infrastructure
4-
CONTAINER_REPOSITORY ?= quay.io/$(CONTAINER_REPOSITORY_ORG)/openshift-capi-agent-$(PROVIDER)
4+
CONTAINER_REPOSITORY ?= quay.io/$(CONTAINER_REPOSITORY_ORG)/cluster-api-$(PROVIDER)-provider-openshift-assisted
55
CONTAINER_TAG ?= latest
66
DIST_DIR ?= ./dist
77
# Image URL to use all building/pushing image targets
@@ -102,11 +102,11 @@ run: manifests generate fmt vet ## Run a controller from your host.
102102

103103
.PHONY: provider-docker-build
104104
provider-docker-build:
105-
$(MAKE) docker-build-internal IMG=quay.io/$(CONTAINER_REPOSITORY_ORG)/openshift-capi-agent-$(PROVIDER):$(CONTAINER_TAG)
105+
$(MAKE) docker-build-internal IMG=quay.io/$(CONTAINER_REPOSITORY_ORG)/cluster-api-$(PROVIDER)-provider-openshift-assisted:$(CONTAINER_TAG)
106106

107107
.PHONY: provider-docker-push
108108
provider-docker-push:
109-
$(MAKE) docker-push-internal IMG=quay.io/$(CONTAINER_REPOSITORY_ORG)/openshift-capi-agent-$(PROVIDER):$(CONTAINER_TAG)
109+
$(MAKE) docker-push-internal IMG=quay.io/$(CONTAINER_REPOSITORY_ORG)/cluster-api-$(PROVIDER)-provider-openshift-assisted:$(CONTAINER_TAG)
110110

111111
.PHONY: bootstrap-docker-build
112112
bootstrap-docker-build:

bootstrap-components.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ spec:
927927
valueFrom:
928928
fieldRef:
929929
fieldPath: metadata.namespace
930-
image: quay.io/edge-infrastructure/openshift-capi-agent-bootstrap:latest
930+
image: quay.io/edge-infrastructure/cluster-api-bootstrap-provider-openshift-assisted:latest
931931
imagePullPolicy: Always
932932
livenessProbe:
933933
httpGet:

bootstrap/config/manager/kustomization.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
44
kind: Kustomization
55
images:
66
- name: controller
7-
newName: quay.io/edge-infrastructure/openshift-capi-agent-bootstrap
7+
newName: quay.io/edge-infrastructure/cluster-api-bootstrap-provider-openshift-assisted
88
newTag: latest

controlplane-components.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ spec:
10681068
- --leader-elect
10691069
command:
10701070
- /manager
1071-
image: quay.io/edge-infrastructure/openshift-capi-agent-controlplane:latest
1071+
image: quay.io/edge-infrastructure/cluster-api-controlplane-provider-openshift-assisted:latest
10721072
imagePullPolicy: Always
10731073
livenessProbe:
10741074
httpGet:

controlplane/config/manager/kustomization.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
44
kind: Kustomization
55
images:
66
- name: controller
7-
newName: quay.io/edge-infrastructure/openshift-capi-agent-controlplane
7+
newName: quay.io/edge-infrastructure/cluster-api-controlplane-provider-openshift-assisted
88
newTag: latest

0 commit comments

Comments
 (0)