Skip to content

Commit ba1fa18

Browse files
committed
ci: enhance security scanning workflow with build matrix and permissions adjustments
Signed-off-by: Robert Waffen <rw@betadots.de>
1 parent 8d8c99b commit ba1fa18

1 file changed

Lines changed: 20 additions & 18 deletions

File tree

.github/workflows/security_scanning.yml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,51 +9,52 @@ on:
99
branches:
1010
- main
1111

12+
concurrency:
13+
group: security-scanning-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
16+
permissions:
17+
contents: read # minimal required permissions to clone repo
18+
1219
jobs:
1320
setup-matrix:
1421
runs-on: ubuntu-latest
1522
outputs:
16-
matrix: ${{ steps.set-matrix.outputs.matrix }}
23+
build_matrix: ${{ steps.set-build-matrix.outputs.build_matrix }}
1724
steps:
1825
- name: Source checkout
1926
uses: actions/checkout@v6
2027

2128
- name: 'Setup yq'
2229
uses: dcarbone/install-yq-action@v1.3.1
2330

24-
- id: set-matrix
25-
run: echo "matrix=$(yq -o json build_versions.yaml | jq -c)" >> $GITHUB_OUTPUT
31+
- id: set-build-matrix
32+
run: echo "build_matrix=$(bash matrix.sh build)" >> $GITHUB_OUTPUT
2633

2734
scan_ci_container:
28-
name: 'Scan CI container'
29-
runs-on: ubuntu-latest
35+
name: 'Scan ${{ matrix.platform }} CI container'
36+
runs-on: ${{ matrix.runner }}
3037
permissions:
3138
actions: read
3239
contents: read
3340
security-events: write
3441
needs: setup-matrix
3542
strategy:
36-
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
43+
fail-fast: false
44+
matrix: ${{ fromJson(needs.setup-matrix.outputs.build_matrix) }}
3745
steps:
3846
- name: Checkout repository
3947
uses: actions/checkout@v6
4048

41-
- name: Extract version number
42-
id: extract_version
43-
uses: actions/github-script@v9
44-
with:
45-
script: |
46-
const agentVersion = '${{ matrix.agent_version }}';
47-
const version = agentVersion.split('-')[0];
48-
core.setOutput('version', version);
49-
50-
- name: Build CI container
49+
- name: Build ${{ matrix.platform }} CI container
5150
uses: docker/build-push-action@v7
5251
with:
53-
tags: 'ci/openvoxagent:${{ steps.extract_version.outputs.version }}'
52+
tags: ci/openvoxagent:${{ matrix.agent_semver }}-${{ matrix.platform }}
5453
context: .
5554
file: Containerfile
55+
load: true
5656
push: false
57+
platforms: linux/${{ matrix.platform }}
5758
build-args: |
5859
OPENVOX_RELEASE=${{ matrix.release }}
5960
OPENVOXAGENT_VERSION=${{ matrix.agent_version }}
@@ -62,7 +63,7 @@ jobs:
6263
uses: anchore/scan-action@v7
6364
id: scan
6465
with:
65-
image: 'ci/openvoxagent:${{ steps.extract_version.outputs.version }}'
66+
image: 'ci/openvoxagent:${{ matrix.agent_semver }}-${{ matrix.platform }}'
6667
fail-build: false
6768

6869
- name: Inspect action SARIF report
@@ -72,3 +73,4 @@ jobs:
7273
uses: github/codeql-action/upload-sarif@v4
7374
with:
7475
sarif_file: ${{ steps.scan.outputs.sarif }}
76+
category: grype-${{ matrix.platform }}

0 commit comments

Comments
 (0)