Skip to content

Fix failing Anchore Container Scan: upgrade scan-action v3 → v7 - #5

Merged
kjake merged 1 commit into
masterfrom
claude/anchore-scan-job-debug-xn26xs
Jul 18, 2026
Merged

Fix failing Anchore Container Scan: upgrade scan-action v3 → v7#5
kjake merged 1 commit into
masterfrom
claude/anchore-scan-job-debug-xn26xs

Conversation

@kjake

@kjake kjake commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Problem

The scheduled Anchore Container Scan job has been failing. From the failing run's logs:

Executing: grype -o sarif --fail-on critical --only-fixed localbuild/testimage:latest
1 error occurred:
	* db could not be loaded: the vulnerability database was built 18 weeks ago (max allowed age is 5 days)

##[error]Invalid SARIF. JSON syntax error: Unexpected end of JSON input

Root cause

anchore/scan-action@v3 pins grype v0.74.4, which depends on the legacy Grype vulnerability database (schema v5). Anchore has deprecated that schema, so the DB served to old grype is now badly stale (18 weeks old vs. the 5-day max). Grype aborts without writing results.sarif, and the subsequent upload-sarif step then fails parsing an empty file (Unexpected end of JSON input).

Fix

  • Upgrade anchore/scan-action@v3@v7, which bundles a current grype that uses the maintained DB (schema v6).
  • In v7 the SARIF report is written to a temp directory and exposed via the step's sarif output instead of a fixed results.sarif, so the scan step now has id: scan and the upload step references ${{ steps.scan.outputs.sarif }}.

All scan parameters (fail-build: false, severity-cutoff: critical, only-fixed: true) are preserved.

Verification

Once merged (or via workflow_dispatch), the job should complete: grype loads a fresh DB, emits valid SARIF, and the report uploads to code scanning.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PJEgmMAsLQtv4PUiuFXJx1


Generated by Claude Code

The scheduled Anchore Container Scan job was failing because
anchore/scan-action@v3 pins grype v0.74.4, which relies on the legacy
Grype vulnerability DB (schema v5). Anchore has deprecated that schema,
so the DB served to the old grype is now stale:

    db could not be loaded: the vulnerability database was built
    18 weeks ago (max allowed age is 5 days)

Grype then exits without writing results.sarif, and the
upload-sarif step fails with 'Invalid SARIF. Unexpected end of JSON input'.

Upgrade to anchore/scan-action@v7, which bundles a current grype that
uses the maintained DB (schema v6). In v7 the SARIF report is written to
a temp dir and exposed via the step output rather than a fixed
results.sarif, so reference ${{ steps.scan.outputs.sarif }} in the
upload step.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJEgmMAsLQtv4PUiuFXJx1
@kjake
kjake marked this pull request as ready for review July 18, 2026 01:56
@kjake
kjake merged commit 18bf87c into master Jul 18, 2026
2 checks passed
@kjake
kjake deleted the claude/anchore-scan-job-debug-xn26xs branch July 18, 2026 01:57
kjake pushed a commit that referenced this pull request Jul 18, 2026
Resolve conflicts from master's Anchore fix (PR #5) and Dependabot
action bumps (PR #7):

- .github/workflows/anchore.yml: keep scan-action@v7 (master's newer fix)
  over this branch's @v6; the rest (checkout@v7, buildx@v4, build-push@v7,
  codeql upload@v4) came from master's bumps.
- .github/workflows/docker.yml: take master's setup-qemu-action@v4 bump
  while keeping this branch's functional QEMU image pin
  (tonistiigi/binfmt:qemu-v8.1.5) and its explanatory comment.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJEgmMAsLQtv4PUiuFXJx1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants