Skip to content

ci: pin fixture test databases and close Dependabot fixture PRs - #343

Open
nfcodacy wants to merge 4 commits into
masterfrom
ci/pin-fixture-test-dbs
Open

nfcodacy wants to merge 4 commits into
masterfrom
ci/pin-fixture-test-dbs

Conversation

@nfcodacy

Copy link
Copy Markdown
Contributor

Every Dependabot PR here gets stuck on plugins_test. The docs/multiple-tests fixtures are checked against an image built with the latest Trivy DB and OpenSSF index, so each database update changes the expected results and fails CI on PRs that didn't change anything related (e.g. #342). On top of that, Dependabot keeps opening security updates for the fixture sources, which are vulnerable on purpose.

What this changes:

  • plugins_test now runs against codacy-trivy:fixtures, built by a new build_fixtures_image job with the Trivy DB digest and OpenSSF commit pinned in scripts/fixture-dbs.env. The published image still ships the latest databases; only the test image is pinned.
  • results.xml now changes only when detection logic changes (e.g. a Trivy bump). Moving the pin forward is scripts/pin_fixture_dbs.sh + scripts/build_fixture_image.sh + scripts/regenerate_fixtures.py in one PR (README → Fixture test databases).
  • The auto-merge workflow closes Dependabot PRs that touch docs/multiple-tests/ instead of approving them. Other Dependabot behaviour is unchanged.
  • Fixtures regenerated against the pinned DBs: one new Go stdlib finding in pattern-vulnerability-medium.

Trade-off: the DB is pinned by digest on ghcr.io/aquasecurity/trivy-db. If Aqua ever deletes that version, build_fixtures_image fails with "manifest unknown" and the fix is to move the pin forward.

After merge:

🤖 Generated with Claude Code

nfcodacy and others added 2 commits November 23, 2026 16:40
plugins_test compared docs/multiple-tests against an image built with the
latest Trivy DB and OpenSSF index, so every database update changed the
expected results and failed CI on unrelated PRs, Dependabot bumps included.

Fixture tests now run against codacy-trivy:fixtures, built with the DB digest
and OpenSSF commit pinned in scripts/fixture-dbs.env. Released images still
ship the latest databases. The auto-merge workflow now closes Dependabot PRs
that touch the intentionally vulnerable fixture sources.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nfcodacy
nfcodacy requested a review from a team as a code owner November 23, 2026 16:40
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@codacy-production codacy-production Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

👀 Worth a closer look

The Dependabot workflow can continue toward auto-merge when fetching the PR diff fails, potentially allowing fixture-source updates through without inspection. This should be reviewed alongside the workflow branching that protects pinned fixture sources.

Test suggestions

  • Verify the fixture image builds from the configured Trivy digest and OpenSSF commit and contains the resulting databases.
  • Verify CircleCI runs plugins_test with the fixture image while publication still uses the normal latest-database image.
  • Verify the pin-refresh script updates both database references and rejects invalid responses.
  • Verify fixture regeneration defaults to codacy-trivy:fixtures and supports an explicit image override.
  • Verify the Dependabot workflow closes PRs touching docs/multiple-tests and leaves other Dependabot PRs eligible for existing auto-merge behavior.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify the fixture image builds from the configured Trivy digest and OpenSSF commit and contains the resulting databases.
2. Verify CircleCI runs plugins_test with the fixture image while publication still uses the normal latest-database image.
3. Verify the pin-refresh script updates both database references and rejects invalid responses.
4. Verify fixture regeneration defaults to codacy-trivy:fixtures and supports an explicit image override.
5. Verify the Dependabot workflow closes PRs touching docs/multiple-tests and leaves other Dependabot PRs eligible for existing auto-merge behavior.

TIP Add review instructions in .codacy/instructions/review.md, or an AGENTS.md, so the reviewer knows your conventions.
TIP How was this review? Give us feedback

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Run tests, the Trivy DB download and the OpenSSF index build in parallel.
- Cache Go modules and build output for generate_and_test, keyed on go.sum.
- Persist only what later jobs use instead of the whole working directory.
- Build the fixtures image in parallel with publish_docker_local.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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