Skip to content

Commit a2de581

Browse files
committed
github/workflows/security: Account for non existing latest/ track
In MicroCloud we don't use latest/ track but instead only track numbers. Only latest/edge get populated. Signed-off-by: Julian Pelizäus <julian.pelizaeus@canonical.com>
1 parent 82cdcc0 commit a2de581

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

.github/workflows/security.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,15 @@ jobs:
7777
strategy:
7878
matrix:
7979
version:
80-
- "latest"
81-
- "2"
80+
- track: 3
81+
branch: main
82+
- track: 2
83+
branch: v2-edge
8284
steps:
8385
- name: Checkout
8486
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
8587
with:
86-
ref: ${{ (matrix.version == 'latest' && 'main') || format('v{0}-edge', matrix.version) }}
88+
ref: ${{ matrix.version.branch }}
8789
persist-credentials: false
8890

8991
- name: Resolve branch HEAD SHA
@@ -94,7 +96,7 @@ jobs:
9496
env:
9597
SNAP_NAME: ${{ github.event.repository.name }}
9698
run: |
97-
snap download "${SNAP_NAME}" --channel=${{ matrix.version }}/stable --cohort="+"
99+
snap download "${SNAP_NAME}" --channel=${{ matrix.version.track }}/stable --cohort="+"
98100
unsquashfs ./${SNAP_NAME}*.snap
99101
100102
- name: Run Trivy vulnerability scanner
@@ -105,7 +107,7 @@ jobs:
105107
scanners: vuln,secret,misconfig
106108
format: sarif
107109
severity: LOW,MEDIUM,HIGH,CRITICAL
108-
output: ${{ matrix.version }}-stable.sarif
110+
output: ${{ matrix.version.branch }}.sarif
109111

110112
- name: Flag snap scanning alerts and tag KEV alerts
111113
run: |
@@ -125,12 +127,12 @@ jobs:
125127
else
126128
.
127129
end
128-
)' ${{ matrix.version }}-stable.sarif > ${{ matrix.version }}-modified.sarif
129-
mv ${{ matrix.version }}-modified.sarif ${{ matrix.version }}-stable.sarif
130+
)' ${{ matrix.version.branch }}.sarif > ${{ matrix.version.branch }}-modified.sarif
131+
mv ${{ matrix.version.branch }}-modified.sarif ${{ matrix.version.branch }}.sarif
130132
131133
- name: Upload Trivy scan results to GitHub Security tab
132134
uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
133135
with:
134-
sarif_file: ${{ matrix.version }}-stable.sarif
136+
sarif_file: ${{ matrix.version.branch }}.sarif
135137
sha: ${{ steps.branch-sha.outputs.sha }}
136-
ref: refs/heads/${{ (matrix.version == 'latest' && 'main') || format('v{0}-edge', matrix.version) }}
138+
ref: refs/heads/${{ matrix.version.branch }}

0 commit comments

Comments
 (0)