Skip to content

docs: update line of reasoning for subsequent PRs #543

@hbraswelrh

Description

@hbraswelrh

Line of Reasoning for PRs

This sub-issue serves as a simple way to document the functionality introduced for the demo of complypacks being pulled using the complyctl runtime, complytime-providers, and the mock-oci-registry. The features can be demoed using the devcontainer DevPod locally, via codespaces, etc.

complyctl

PR #538 538 (complyctl) extended the mock registry with seedFromDirectory() so it can serve mounted Gemara YAML from a filesystem directory. That's the general mechanism for private/local policies. It's independent and it works today for any provider. PR #540 doesn't use seedFromDirectory() because the OPA test content is embedded, not mounted.

PR #540 (complyctl) adds the OPA test content that the mock registry serves out of the box:

  • Gemara policy metadata: test-opa-catalog.yaml + test-opa-policy.yaml with executor.id: opa — seeded via seedDefaults() at policies/test-opa-policy
  • Complypack artifact: Rego files + complytime-mapping.json packaged as a tar.gz — seeded via addComplypackArtifact() at complypacks/test-opa-complypack
  • Workspace config: complytime.yaml has the test-opa-bp policy-id, the complypack entry, and a test-k8s-deployment target
  • Test input: post-create.sh generates a sample K8s Deployment manifest in the workspace

complytime-providers

PR complytime/complytime-providers#41 (complytime-providers) is the ~30-line change that makes the OPA provider read ComplypackContentPath from GenerateRequest instead of requiring opa_bundle_ref. Without it, the provider rejects the generate request with the error you saw.

Demo

The demo flow in a Codespace:
complyctl get

  • Fetches policies/test-opa-policy from the mock registry → OCI layout cache
  • Fetches complypacks/test-opa-complypack from the mock registry → complypack cache at ~/.complytime/complypacks/opa/1.0.0/

complyctl generate --policy-id test-opa-bp

  • Resolves the policy graph from the cached Gemara YAML — finds executor.id: opa
  • Looks up the complypack cache for evaluator-id opa — finds content.tar.gz
  • Calls RouteGenerate("opa", ...) with ComplypackContentPath set to the cache path
  • PR 41: OPA provider's resolvePolicyDir() sees the path, skips conftest pull, reads complytime-mapping.json directly from the complypack content, matches requirement IDs to Rego namespaces, writes scan-config.json

complyctl scan --policy-id test-opa-bp

  • Reads scan-config.json from Generate — has BundleDir pointing at the complypack content
  • PR 41: resolveScanPolicyDir() uses scanCfg.BundleDir — no opa_bundle_ref needed
  • Runs conftest test test-deployment.yaml --policy --namespace kubernetes.run_as_nonroot --namespace kubernetes.resource_limits
  • Returns assessment results for the two container security requirements

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type
No fields configured for issues without a type.

Projects

Status
In progress 📋

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions