Skip to content

Commit 8ac6683

Browse files
authored
feat: support ignore-vulnerabilities in rock oci publish workflow (#142)
## Description This PR updates the reusable rock OCI publishing workflow (`.github/workflows/_rock-oci-publish.yaml`) to support passing ignored vulnerabilities when triggering builds/releases via the `oci-factory` CLI. ### Changes - **Workflow input**: Added optional `ignore-vulnerabilities` string input (defaults to `""`) to accept a comma-separated list of vulnerability/CVE IDs to ignore. - **CLI argument formatting**: Formats and passes `--ignored-vulnerabilities=<ids>` to `oci-factory upload` commands for both stable and edge/candidate releases when specified. Whitespace is stripped to prevent shell argument splitting issues. - **Go version compatibility**: Updated `setup-go` version requirement from `>=1.22.0` to `>=1.25.0` to ensure compatibility with `github.com/canonical/oci-factory/tools/cli-client` which requires Go 1.25+. Ref: canonical/oci-factory#1182 (comment)
2 parents 1bf335a + 4a6a193 commit 8ac6683

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

.github/workflows/_rock-oci-publish.yaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ on:
3131
type: string
3232
required: false
3333
default: "22.04"
34+
ignore-vulnerabilities:
35+
type: string
36+
required: false
37+
default: ""
38+
description: "Comma-separated list of vulnerabilities to ignore"
3439

3540
jobs:
3641
oci-factory:
@@ -41,7 +46,7 @@ jobs:
4146
- name: Golang setup
4247
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
4348
with:
44-
go-version: ">=1.22.0"
49+
go-version: ">=1.25.0"
4550
# install oci-factory via golang and set path in environment
4651
- name: Install oci-factory
4752
run: |
@@ -56,13 +61,18 @@ jobs:
5661
echo EOL_CANDIDATE=$(date -d "$(date +'%Y-%m-%d') +${{ inputs.eol-edge-release }}" "+%Y-%m-%d") >> $GITHUB_ENV
5762
echo IMAGE_VERSION_STABLE=$($YQ '.version | split(".").0' rockcraft.yaml) >> $GITHUB_ENV
5863
echo IMAGE_VERSION_CANDIDATE=$($YQ '.version | split(".").[0:2] | join(".")' rockcraft.yaml) >> $GITHUB_ENV
64+
IGNORE_VULNS="${{ inputs.ignore-vulnerabilities }}"
65+
IGNORE_VULNS="$(echo "$IGNORE_VULNS" | tr -d ' ')"
66+
if [ -n "$IGNORE_VULNS" ]; then
67+
echo "IGNORED_VULNERABILITIES=--ignored-vulnerabilities=$IGNORE_VULNS" >> $GITHUB_ENV
68+
fi
5969
- name: Release to stable
60-
run: $OCI_FACTORY upload -y --release track=$IMAGE_VERSION_STABLE-${{ inputs.ubuntu-base-version }},risks=stable,eol=$EOL_STABLE
70+
run: $OCI_FACTORY upload -y --release track=$IMAGE_VERSION_STABLE-${{ inputs.ubuntu-base-version }},risks=stable,eol=$EOL_STABLE $IGNORED_VULNERABILITIES
6171
if: inputs.stable-release == true
6272
env:
6373
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
6474
- name: Release to edge and candidate
65-
run: $OCI_FACTORY upload -y --release track=$IMAGE_VERSION_CANDIDATE-${{ inputs.ubuntu-base-version }},risks=candidate,edge,eol=$EOL_CANDIDATE
75+
run: $OCI_FACTORY upload -y --release track=$IMAGE_VERSION_CANDIDATE-${{ inputs.ubuntu-base-version }},risks=candidate,edge,eol=$EOL_CANDIDATE $IGNORED_VULNERABILITIES
6676
if: inputs.edge-release == true
6777
env:
6878
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}

0 commit comments

Comments
 (0)