Add OpenVEX report generation and publishing#339
Conversation
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: saschagrunert The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a new best-effort step to fetch a CRI‑O OpenVEX JSON into the build archive, runs it conditionally in the Changes
Sequence Diagram(s)sequenceDiagram
participant GH as "GitHub Actions"
participant Vars as "vars job (outputs)"
participant VEX as "scripts/vex"
participant CI as "CRI‑O Artifacts Server"
participant SIGN as "scripts/sign-artifacts"
participant STORAGE as "Cloud Storage"
GH->>Vars: produce outputs (ARCHIVE_PATH, COMMIT, PROJECT_TYPE)
GH->>VEX: run scripts/vex (conditional)
VEX->>CI: request OpenVEX for ARCHIVE_ID
CI-->>VEX: OpenVEX JSON or not-found
VEX->>GH: write cri-o.$ARCHIVE_ID.openvex.json into ARCHIVE_PATH
GH->>SIGN: invoke sign-artifacts
SIGN->>SIGN: locate and cosign tarballs, SPDX, and *.openvex.json
SIGN->>STORAGE: upload signed artifacts
STORAGE-->>GH: upload confirmation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
/release-note-none |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
scripts/vex (1)
24-27: VerifyREVISIONis available whenPROJECT_TYPE == stable.When
PROJECT_TYPEisstable, the script uses$REVISION(line 26), butREVISIONis not explicitly passed in the workflow step'senvblock (lines 168-173 inobs.yml). It is available as a workflow-level env var (line 28), so this should work — but it's worth noting the implicit dependency for clarity and consistency with the other env vars being explicitly passed.Consider explicitly passing REVISION in the workflow step env
In
.github/workflows/obs.yml, addREVISIONto the vex step's env block for consistency:- run: scripts/vex if: ${{ inputs.skip-bundles == false && github.event_name != 'pull_request' }} env: ARCHIVE_PATH: ${{ needs.vars.outputs.archive_path }} COMMIT: ${{ needs.vars.outputs.commit }} GIT_ROOT: ${{ needs.vars.outputs.git_root }} PROJECT_TYPE: ${{ needs.vars.outputs.project_type }} + REVISION: ${{ inputs.revision || 'main' }} VERSION: ${{ needs.vars.outputs.version }}
93d5159 to
c8ae5c2
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.github/workflows/obs.yml:
- Around line 162-168: Remove the unnecessary GIT_ROOT environment variable from
the scripts/vex step: update the env block for the step that runs scripts/vex to
only pass ARCHIVE_PATH, COMMIT, and PROJECT_TYPE (remove GIT_ROOT since
scripts/vex does not consume it while scripts/vars is the only consumer that
needs it).
🧹 Nitpick comments (1)
scripts/sign-artifacts (1)
18-23: Glob may fail if no.openvex.jsonfiles exist.This is a pre-existing pattern (same risk on lines 4 and 11), but worth noting: if the glob matches nothing, bash iterates with the literal string, and
cosignwill error out underset -e. Consider enablingnullglobat the top of the script so all three loops safely become no-ops when there are no matching files.Suggested fix
#!/usr/bin/env bash set -euo pipefail +shopt -s nullglob for TARBALL in build/bundle/*.tar.gz; do
c8ae5c2 to
5ca773a
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
scripts/vex (1)
7-9: Quote variable expansions to prevent word splitting.
$COMMITand$REVISIONshould be quoted for robustness, consistent with the quoted usage of$ARCHIVE_PATHon line 13.Proposed fix
-ARCHIVE_ID=$COMMIT +ARCHIVE_ID="$COMMIT" if [[ $PROJECT_TYPE == stable ]]; then - ARCHIVE_ID="$REVISION" + ARCHIVE_ID="$REVISION" fi
5ca773a to
95b8671
Compare
95b8671 to
3d1f96a
Compare
There was a problem hiding this comment.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In @.github/workflows/obs.yml:
- Around line 162-167: The scripts/vex step placement and gating are
correct—leave the step as-is: keep the step named/using scripts/vex, retain the
if condition (if: ${{ inputs.skip-bundles == false && github.event_name !=
'pull_request' }}), and preserve the env entries (ARCHIVE_PATH, COMMIT,
PROJECT_TYPE) so the vex download runs after bundle artifacts are available and
before sign-artifacts; no changes required.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
scripts/sign-artifacts (1)
19-25: Glob expansion into a scalar is fragile if multiple VEX files ever land in the directory.
echo build/bundle/*.openvex.jsonconcatenates all matches into one string. If more than one.openvex.jsonfile is present,$VEXbecomes a space-separated list,[[ -e "$VEX" ]]will fail, andcosign sign-blobwould receive a bad path. Aforloop (matching the existing tarball/SBOM patterns) is more defensive and consistent:Suggested change
-# Sign VEX file if available (not every release branch publishes one). -VEX=$(echo build/bundle/*.openvex.json) -if [[ -e "$VEX" ]]; then - cosign sign-blob -y "$VEX" \ - --bundle "$VEX.bundle" \ - --output-signature "$VEX.sig" \ - --output-certificate "$VEX.cert" -fi +# Sign VEX files if available (not every release branch publishes one). +for VEX in build/bundle/*.openvex.json; do + [[ -e "$VEX" ]] || continue + cosign sign-blob -y "$VEX" \ + --bundle "$VEX.bundle" \ + --output-signature "$VEX.sig" \ + --output-certificate "$VEX.cert" +done🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/sign-artifacts` around lines 19 - 25, The current VEX variable uses echo on a glob (VEX=$(echo build/bundle/*.openvex.json)) which concatenates matches into one scalar; replace that with an explicit loop: iterate over build/bundle/*.openvex.json (for VEX in build/bundle/*.openvex.json; do ... done), skip non-existing matches with a guard (e.g. [[ -e "$VEX" ]] || continue), and run the existing cosign sign-blob -y "$VEX" --bundle "$VEX.bundle" --output-signature "$VEX.sig" --output-certificate "$VEX.cert" for each file so multiple .openvex.json files are handled safely and consistently.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@scripts/sign-artifacts`:
- Around line 19-25: The current VEX variable uses echo on a glob (VEX=$(echo
build/bundle/*.openvex.json)) which concatenates matches into one scalar;
replace that with an explicit loop: iterate over build/bundle/*.openvex.json
(for VEX in build/bundle/*.openvex.json; do ... done), skip non-existing matches
with a guard (e.g. [[ -e "$VEX" ]] || continue), and run the existing cosign
sign-blob -y "$VEX" --bundle "$VEX.bundle" --output-signature "$VEX.sig"
--output-certificate "$VEX.cert" for each file so multiple .openvex.json files
are handled safely and consistently.
Make VEX download best-effort since not every CRI-O release branch publishes VEX information. Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
3d1f96a to
8bdb56c
Compare
|
We only have one vex file per build. |
|
@cri-o/cri-o-maintainers PTAL |
|
Tip For best results, initiate chat on the files or code changes.
✏️ Learnings added
|
|
@cri-o/cri-o-maintainers PTAL |
|
/lgtm |
Adds OpenVEX report generation to the release pipeline:
scripts/vexthat runsgovulncheck -format openvexagainst the CRI-O sourcescripts/sign-artifactsCompanion PR: cri-o/cri-o#9767
Summary by CodeRabbit