Skip to content

fix(registry): seed valid ampel complypack content in mock registry#554

Open
hbraswelrh wants to merge 1 commit into
complytime:mainfrom
hbraswelrh:opsx/ampel-complypack-content
Open

fix(registry): seed valid ampel complypack content in mock registry#554
hbraswelrh wants to merge 1 commit into
complytime:mainfrom
hbraswelrh:opsx/ampel-complypack-content

Conversation

@hbraswelrh
Copy link
Copy Markdown
Member

Summary

Replace the dummy ampel complypack payload in the mock OCI registry with valid granular policy JSON that the ampel provider's LoadGranularPolicies() accepts. The dummy content ({"name":"...","version":"..."}) lacked the required id field, causing cross-repo integration test failures when the ampel provider consumes ComplypackContentPath (complytime/complytime-providers#52).

Changes

Code

  • cmd/mock-oci-registry/main.go: Added //go:embed testdata/ampel-complypack/* directive and updated seedDefaults() to use buildTarGzFromFS(ampelComplypackData, ...) instead of buildDummyTarGz("policy.json", ...) for the complypacks/ampel-bp artifact.
  • cmd/mock-oci-registry/testdata/ampel-complypack/block-force-push.json (new): Valid AmpelPolicy fixture with id, meta.controls, and tenets fields, copied from the existing cross-repo test fixture.

Tests

  • cmd/mock-oci-registry/main_test.go: Added TestBuildTarGzFromFS_AmpelFS (archive structure + JSON id field validation) and extended TestSeedDefaults_AllReposSeeded with ampel complypack content blob verification (manifest → layer → gzip → tar → JSON → id field).

Spec Artifacts

  • openspec/changes/ampel-complypack-content/: Proposal, design (3 decisions), spec (4 requirements, 6 scenarios), and tasks.

Pattern

Follows the OPA complypack pattern established in commit 74fbae8:

  1. Embed real policy files from testdata/ampel-complypack/ via //go:embed
  2. Use buildTarGzFromFS() to package them as a tar.gz payload
  3. Seed via addComplypackArtifact() in seedDefaults()

Merge Ordering

This PR is backward-compatible and safe to merge before complytime-providers PR #52:

  • The old ampel provider ignores ComplypackContentPath and falls back to the pre-staged granular policies directory (still present in cross_repo_integration_test.sh)
  • Once PR CPLYTM-550 - Clean-up openscap-plugin configuration file #52 lands on complytime-providers main, a follow-up will remove the pre-staged content (tasks 3.1, 3.2 in the spec)

Review Council

Passed 9-agent review council (1 iteration): all 9 APPROVE, 0 REQUEST CHANGES.

Verification

  • make build — passes
  • make test-unit — all tests pass (including new TestBuildTarGzFromFS_AmpelFS)
  • make lint — 0 issues

Supplemental to complytime/complytime-providers#52.

@hbraswelrh hbraswelrh requested a review from a team as a code owner June 4, 2026 20:16
@hbraswelrh hbraswelrh force-pushed the opsx/ampel-complypack-content branch from 65d37ef to dc3dab5 Compare June 4, 2026 20:32
@hbraswelrh hbraswelrh force-pushed the opsx/ampel-complypack-content branch from dc3dab5 to 5423ed7 Compare June 5, 2026 11:37
Replace the dummy ampel complypack payload in the mock OCI registry
with valid granular policy JSON that the ampel provider's
LoadGranularPolicies() accepts. The dummy content lacked the required
'id' field, causing cross-repo integration test failures when the
ampel provider consumes ComplypackContentPath (complytime-providers
PR complytime#52).

Changes:
- Add testdata/ampel-complypack/block-force-push.json with valid
  AmpelPolicy content (copied from cross-repo test fixture)
- Add //go:embed directive for ampel complypack testdata
- Update seedDefaults() to use buildTarGzFromFS instead of
  buildDummyTarGz for the complypacks/ampel-bp artifact
- Add TestBuildTarGzFromFS_AmpelFS verifying archive structure
  and JSON content validity
- Extend TestSeedDefaults_AllReposSeeded with ampel complypack
  content blob verification (manifest -> layer -> gzip -> tar ->
  JSON -> id field)

Follows the OPA complypack pattern established in commit 74fbae8.

Ref: complytime/complytime-providers#52
@hbraswelrh hbraswelrh force-pushed the opsx/ampel-complypack-content branch from 5423ed7 to de55823 Compare June 5, 2026 13:38
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.

1 participant