Repository navigation
refactor(dev): single source of truth for the OCM transfer step - #733
Conversation
…e broken ocmconfig The OCM transfer invocation and its config now live in one place, hack/demo/transfer-discovery.sh, which setup-discovery.sh calls and the upcoming make demo-app flow will reuse. This keeps the transfer step from drifting across the demo scripts. Delete the credentials-only test/fixtures/ocmconfig, the footgun that made the documented flow fail TLS. The single remaining config is test/fixtures/e2e/ocmconfig, which both the dev scripts and the e2e suite already use, so the config cannot drift between them. e2e is untouched, it keeps its own Go transfer and just references the same single config.
📝 WalkthroughWalkthroughThe PR adds a reusable script for transferring the OCM demo CTF. Discovery setup now uses the script, requires cluster CA trust in ChangesDiscovery transfer
Estimated code review effort: 3 (Moderate) | ~15–30 minutes Sequence Diagram(s)sequenceDiagram
participant setup-discovery.sh
participant transfer-discovery.sh
participant OCM
participant Registry
setup-discovery.sh->>transfer-discovery.sh: Pass OCM settings and registry URL
transfer-discovery.sh->>OCM: Run ocm transfer ctf
OCM->>Registry: Transfer the discovery CTF
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Wow, this is actually the first time Coderabbit doesn't complain |
olzemal
left a comment
There was a problem hiding this comment.
unrelated to this pr, but i noticed $OCM_DEMO_DIR is also not used by dev-cluster.sh anymore.
solution-arsenal/hack/dev-cluster.sh
Line 11 in 39a33df
Good find, will clean this up in another pr later |
…734) ## Background Part of #644, the arc is one command to spin up SolAr locally with the demo app deployed -> `make demo` 1. ✅ make `make dev-cluster` reliably populate the catalog (#731) 2. ✅ single source of truth for the OCM transfer step (#733) 3. **(this PR)** `make demo-app` / `make demo` / `make demo-clean` for the full render -> bootstrap flow 4. a CI smoke test that runs the demo so it cant silently rot ## What Three make targets, backed by two scripts under `hack/demo`: - `make demo-app` -> seeds the ocm-demo app end to end on an existing dev cluster: transfer -> discover -> release -> render -> bootstrap -> running workload. Idempotent. - `make demo` -> from zero: create the dev cluster if its missing, then `demo-app`. - `make demo-clean` -> remove the demo resources and the app namespace, keep the cluster and the catalog. ## Why After `make dev-cluster` we had an empty SolAr and getting the demo app actually deployed was a manual, order-sensitive dance across a few scripts. `demo-app` walks that whole path in one go. The important bit for not drifting: `demo-app` mirrors the exact happy path the e2e suite exercises and reuses the **same** `test/fixtures/e2e` manifests (release, target, registry, bindings, regcred, bootstrap). So the demo and the e2e tests share their inputs and cant diverge. CI will guard the ordering in step 4 (pr follows after this one :)). Topology -> everything runs in `solar-system`, because thats where dev-cluster's discovery writes the ComponentVersion and where the discovery Registry (`zot-scan`) and the `zot-deploy` pull secret already live. So every reference resolves in-namespace, no ReferenceGrants needed. This matches how the e2e suite runs the whole flow in a single namespace. The app itself lands in the Release's `targetNamespace` (`demo`). Re-runs are cheap -> `demo-app` skips the transfer when the ComponentVersion is already in the catalog. ## Testing Full loop against a local kind cluster (`make dev-cluster` first): ``` $ make demo-app >>> Transferring the ocm-demo component and waiting for discovery... >>> ... ocirepository.../solar-bootstrap condition met helmrelease.../solar-bootstrap condition met $ kubectl -n solar-system get releases,rendertasks,renderartifacts release/...-release ... Resolved rendertask/render-rel-... Target cluster-1 JobSucceeded rendertask/render-tgt-cluster-1-0 Target cluster-1 JobSucceeded renderartifact/... solar-system/bootstrap-cluster-1 v0.0.0 $ kubectl -n demo get pods solar-bootstrap-opendefense-cloud-ocm-demo-...-demo... 1/1 Running # the demo app is deployed ``` For the person who reviews this, try to run the following locally: - fresh `make demo-app` -> workload Running - `make demo-clean` -> demo resources + `demo` namespace gone, catalog + cluster kept - re-seed from clean -> workload Running again - idempotent re-run with catalog present -> skips the transfer, still reaches Ready - `make shellcheck` clean e2e suite is untouched ## Checklist - [x] Tests added/updated (n/a, dev tooling, verified manually end to end against a live kind cluster; reuses the e2e fixtures; CI smoke test lands in the follow-up PR) - [x] No breaking changes (new targets only, e2e untouched) - [x] Readable commit history (one focused commit) - [ ] AI code review considered and comments resolved Part of #644 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added commands to launch a complete demo environment, either using an existing development cluster or creating one as needed. * Added automated demo setup covering namespaces, credentials, registries, releases, rendering, and readiness checks. * Added cleanup support to remove demo resources while preserving the development cluster and shared setup. * Added configurable options, progress reporting, timeout handling, and re-seeding guidance for demo workflows. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
## What Remove the now-unused `OCM_DEMO_DIR` and `OCM` variables from `hack/dev-cluster.sh`. ## Why #733 moved the OCM transfer into `hack/demo/transfer-discovery.sh`, so `dev-cluster.sh` doesnt run `ocm` anymore. Both variables were left behind as dead declarations.@olzemal spotted `OCM_DEMO_DIR` in a review on #733 -> `OCM` is dead for the same reason, so go away :) ## Testing ``` $ grep -nE '\bOCM\b|OCM_DEMO_DIR' hack/dev-cluster.sh # nothing left $ make shellcheck # clean ``` No behavior change, the Makefile never passed these to the script (the `ocm-transfer-demo` target owns `OCM` separately). ## Checklist - [x] Tests added/updated (n/a, dead-code removal) - [x] No breaking changes - [x] Readable commit history (one commit) - [x] AI code review considered and comments resolved
## Background Part of #644, the context is one command to spin up SolAr locally with the demo app deployed -> `make demo`. Small PRs: 1. ✅ make `make dev-cluster` reliably populate the catalog (#731) 2. ✅ single source of truth for the OCM transfer step (#733) 3. ✅ `make demo-app` / `make demo` / `make demo-clean` (#734) 4. **(this PR)** a CI smoke test so the demo flow cant silently rot This is the last one, it closes out the story ## What A `Demo Smoke Test` workflow that runs `make demo` (dev-cluster + demo-app) end to end and asserts the demo application actually comes up. ## Why The demo shares its inputs with the e2e suite (same `test/fixtures/e2e` manifests), but the ordering and the make targets live outside the e2e Go test. Without a check they can drift and nobody notices until someone tries the demo. This job is the backstop: it walks the real transfer -> discover -> release -> render -> bootstrap pipeline and fails if the workload doesnt come up. `demo-app` already waits for the bootstrap HelmRelease to become Ready and exits non-zero otherwise, so a green `make demo` is the assertion. The assert step then polls for the demo pod and waits for it to be Ready. It builds SolAr from source rather than reusing the ghcr images, because `dev-cluster.sh` is wired for local images and adding a ghcr values + pull-secret path just for a smoke test wasnt worth it. ## Gating The demo is heavy (builds the images + full cluster), so it follows the same opt-in pattern as docker/helm/e2e: - on PRs -> only runs when the `ok-to-demo` label is set - on `main` -> runs automatically, but only when demo-relevant files change ## Testing - `actionlint` clean on the workflow. - The full flow (`make demo` -> running workload) is verified locally end to end in #734. - Self-validating: this PR carries `ok-to-demo`, so the smoke job runs on it (an earlier revision without the label gating already passed green in CI). ## Checklist - [x] Tests added/updated (this *is* the test, a CI smoke check) - [x] No breaking changes (new workflow only) - [x] Readable commit history (one focused commit) - [x] AI code review considered and comments resolved Part of #644
Background
Part of #644, the context is one command to spin up SolAr locally with the demo app deployed ->
make demo. Small PRs:make dev-clusterreliably populate the catalog (fix(dev): make dev-cluster reliably populate the catalog #731)make demo-app/make demo/make demo-cleanfor the full render -> bootstrap flowWhat
hack/demo/transfer-discovery.sh.setup-discovery.shcalls it, and the upcomingmake demo-appflow reuses ittest/fixtures/ocmconfigWhy
The transfer invocation and its config were living in more than one place, which is exactly how the drift in #731 happened (dev pointed at a config without the rootcerts block and failed TLS). Now theres one helper for the transfer step and one config ->
test/fixtures/e2e/ocmconfig, which both the dev scripts and the e2e suite already use, so the config cant drift between them.The old top-level
test/fixtures/ocmconfigwas the actual footgun (credentials only, no CA trust), so I deleted ite2e is left untouched -> it keeps its own Go transfer and just references the same single config. Rewiring it to shell out to the helper would change e2e behavior for no real gain (the config, the thing that drifted, is already shared). The behavioral no-drift across the whole flow comes from the demo smoke test in step 4.
Testing
Exit 0, no leaked port-forward.
grep -rn fixtures/ocmconfigconfirms nothing references the deleted config anymore (e2e usese2e/ocmconfig).Checklist
Part of #644
Summary by CodeRabbit
New Features
Documentation