Skip to content

Upgrade grype to fix DB migration failure and fix setup-cli action when cli_version specified#12

Merged
wesleyjellis merged 2 commits into
mainfrom
wesley/upgrade-grype
Jul 21, 2026
Merged

Upgrade grype to fix DB migration failure and fix setup-cli action when cli_version specified#12
wesleyjellis merged 2 commits into
mainfrom
wesley/upgrade-grype

Conversation

@wesleyjellis

@wesleyjellis wesleyjellis commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Note

This PR was written by Claude.

Summary

The scheduled Grype security scan is failing across consuming repos with:

WARN error updating db error=unable to activate new vulnerability database: failed to hydrate database: failed to open db: unable to migrate: constraint failed: UNIQUE constraint failed: operating_systems.name, ... (2067)
INFO loaded DB status=invalid
ERROR failed to load vulnerability db: database does not exist

example

This is upstream Grype bug anchore/grype#3586: the newly published vulnerability DB (schema v6.1.9) cannot be migrated by older Grype versions. Our grype.yml used anchore/scan-action@v6.5.0, which defaults to installing Grype v0.96.1.

Changes

  • Bump anchore/scan-action from v6.5.0 (df395807...) to v7.4.0 (e1165082ffb1fe366ebaf02d8526e7c4989ea9d2), updating both the pinned SHA and the trailing # vX.Y.Z comment.
  • Add grype-version: v0.116.0 to the Scan step so we control the Grype version explicitly rather than relying on the action default. v0.116.0 contains the fix for Issue Pulling DB update anchore/grype#3586.

The grype-version input name was verified against action.yml in anchore/scan-action@v7.4.0. All other inputs (path, only-fixed, output-format, fail-build) and the upload step are unchanged.

Breaking changes

None affecting this workflow. The v6→v7 major bump carried no input/runtime/behavior changes in its release notes (just a Grype dependency bump). The only runtime change across the range is node20node24 (v7.4.0), which is handled transparently by GitHub-hosted runners. No inputs we use were removed or renamed; the json output consumed by the upload step is unchanged.

Test Plan

  1. Merge this PR to main.
  2. In a consuming repo (e.g. OpsLevel/OpsLevel), re-run the Security - Grype Scan Repo workflow (via the scheduled trigger, or manually re-run the latest failed run of the Security scan).
  3. Confirm the run no longer emits the unable to migrate: constraint failed: UNIQUE constraint failed: operating_systems... error and that loaded DB status=valid.
  4. Confirm the Scan step installs Grype v0.116.0 (visible in the step logs) and completes with a zero exit status.
  5. Confirm results still upload successfully to OpsLevel (the "Upload results to OpsLevel" step succeeds).

CI fixes / setup-cli

It also seems like the setup-cli action was broken since always as it was using a different parameter in the action body than the input was declared.

Bump anchore/scan-action from v6.5.0 to v7.4.0 and pin grype-version to
v0.116.0 to resolve the scheduled scan failure caused by the v6.1.9
vulnerability DB not being migratable by older grype (anchore/grype#3586).
@wesleyjellis wesleyjellis self-assigned this Jul 21, 2026
The install command referenced ${{ inputs.version }}, but the input is
named cli_version, so the version was always empty and the CLI defaulted
to latest. Also forward the arg to the script via 'sh -s --' instead of
passing it to sh itself.
@wesleyjellis
wesleyjellis requested a review from Farjaad July 21, 2026 17:52
@wesleyjellis wesleyjellis changed the title Upgrade grype to fix DB migration failure Upgrade grype to fix DB migration failure and fix setup-cli action when cli_version specified Jul 21, 2026
@wesleyjellis
wesleyjellis merged commit 943c24a into main Jul 21, 2026
2 checks passed
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