fix(ci): unblock image job on private-repo SARIF upload - #11
Conversation
The post-merge main build of PR #10 successfully built, pushed, and Cosign-signed ghcr.io/bcit-tlu/haproxy-operator/haproxy-operator:0.2.1-head.db7fcb5, but the codeql-action/upload-sarif@v4 step failed with 'Resource not accessible by integration' on the workflow-runs GET. On private repos, upload-sarif needs 'actions: read' to read the calling workflow's run metadata; public repos (hriv, tech-ops-docs) don't hit this path because the metadata endpoint is anonymous. Two-part fix: 1. Add 'actions: read' to the workflow permissions block so the required metadata fetch actually works. 2. Mark the upload step 'continue-on-error: true' so a transient telemetry-upload failure never cascades into blocking chart publication of an already-built, already-signed image. This mirrors the intent of the existing guards — publish artifacts stay gated on MODE + successful build+sign; SARIF-to-Security-tab is a diagnostic sidecar. Co-Authored-By: kyle_hunter@bcit.ca <kyle_hunter@bcit.ca>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
⚙️ Control Options:
|
| - name: Upload scan results to GitHub Security | ||
| if: needs.versions.outputs.mode == 'head' || needs.versions.outputs.mode == 'release' | ||
| uses: github/codeql-action/upload-sarif@v4 | ||
| continue-on-error: true # Non-critical: don't block chart publish on telemetry upload |
There was a problem hiding this comment.
📝 Info: continue-on-error silently swallows all upload-sarif failures
Adding continue-on-error: true at line 255 means that any failure of the SARIF upload — including persistent misconfiguration (wrong permissions, bad SARIF format, etc.) — will be reduced to a workflow warning rather than a failure. The follow-up step at line 260-263 does emit a ::warning, which is good, but warnings are easy to miss in GitHub Actions UI. If the SARIF upload is broken for an extended period (e.g., a permissions regression), the team may not notice that vulnerability scan results are silently not reaching the Security tab. Consider whether a periodic audit or a separate alerting mechanism is warranted.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Good catch — the review correctly points out that continue-on-error: true is too broad as written. Addressed in a1830cd:
- Added an
id: upload-sarifhandle on the codeql-action step. - Added a follow-up step guarded by
if: steps.upload-sarif.outcome == 'failure'that emits a::warning::annotation.
Net effect: a failed SARIF upload still doesn't block the pipeline (preserves the original unblock intent), but it now surfaces as a yellow warning annotation in the workflow summary instead of silently disappearing. This covers the regression scenarios you enumerated (malformed SARIF, removed security-events: write, CodeQL breaking changes) — each would show up as a visible warning on the run.
There was a problem hiding this comment.
Agreed that a persistent warning can get buried if nobody watches the runs — but I think that's a monitoring/alerting concern separate from this workflow change, not something to block the PR on. Concretely:
- The GitHub Security tab itself is the primary signal: if it stops gaining new scan timestamps, that's the canonical "alert". Anyone looking at https://github.com/bcit-tlu/haproxy-operator/security/code-scanning will see stale data immediately.
- The right place for an "extended-period SARIF upload broken" alarm is a Vault/Grafana-style cross-repo audit (e.g. a scheduled workflow that lists repos + checks last CodeQL analysis date), not inside each per-repo pipeline.
- The
::warning::annotation plus the image job going green is the correct local contract: publish artifacts are decoupled from telemetry upload, but telemetry failures are not invisible on the run that produced them.
Happy to file a follow-up issue to track the cross-repo audit idea if that's useful, but not going to add it inline here.
Addresses Devin Review feedback on PR #11. 'continue-on-error: true' on upload-sarif correctly unblocks chart publish when the upload fails, but it silently swallows ALL upload failures — including genuine regressions (malformed SARIF, removed 'security-events: write', breaking CodeQL action changes). The security scan results would silently disappear from the GitHub Security tab with no signal in the workflow summary. Add a follow-up step that emits a '::warning::' annotation when the preceding step's outcome is 'failure'. This surfaces the failure in the Actions UI (yellow warning icon + annotation in the summary) without gating the pipeline, preserving the original intent that the image+chart artifacts ship even if telemetry upload glitches. Co-Authored-By: kyle_hunter@bcit.ca <kyle_hunter@bcit.ca>
Summary
The post-merge main build of #10 (commit
db7fcb5) successfully built, pushed, and Cosign-signedghcr.io/bcit-tlu/haproxy-operator/haproxy-operator:0.2.1-head.db7fcb5, but the finalgithub/codeql-action/upload-sarif@v4step failed with:Because the image job failed, the downstream
helm-publishjob (needs: [image, versions]) was skipped, so the chart was not published and the first-everhaproxy-operator/charts/haproxy-operatorGHCR package still doesn't exist.Root cause: on private repos,
codeql-action/upload-sariffetches the calling workflow run's metadata from/actions/runs/{run_id}which requiresactions: read. Public repos (hriv, tech-ops-docs) don't hit this path because that endpoint is anonymous for public repos — which is why their post-merge unified-versioning builds both published cleanly.Two-part fix:
actions: readto the workflow-levelpermissions:block so the required metadata fetch actually works.continue-on-error: trueso a transient telemetry-upload failure never cascades into blocking chart publication of an already-built, already-signed image. The Security tab upload is a diagnostic sidecar — publish-gate is already defended by the MODE guards on build/push/sign, which are the artifact-correctness path.Review & Testing Checklist for Human
image+helm-publishboth green, and the first unified chart artifact0.2.1-head.<sha>(+headmoving tag) to land atghcr.io/bcit-tlu/haproxy-operator/charts/haproxy-operator.actions: readdid what we expect).apps/haproxy-operator/base/ocirepository.yamlfromref.tag: latesttoref.tag: head(noted as pending in the Apr 2026 strict-D adoption).Notes
Not propagating this fix to hriv or tech-ops-docs — they're both public and their post-merge unified builds already succeeded (hriv
0.6.0-head.40b2888, tech-ops-docs0.2.1-head.28e2ad8), so there's no evidence the private-repo code path is exercised there. Addingactions: readto those preemptively would be harmless but violates minimum-scope; happy to propagate if you'd prefer symmetric permissions across the three repos.Link to Devin session: https://app.devin.ai/sessions/a5e23b4cc3a34f4caa54267af3c1ccc4
Requested by: @kphunter