Skip to content

feat: Docker-free in-process smoke harness for backend dynamic plugins#2714

Open
gustavolira wants to merge 4 commits into
redhat-developer:mainfrom
gustavolira:poc/native-smoke-harness
Open

feat: Docker-free in-process smoke harness for backend dynamic plugins#2714
gustavolira wants to merge 4 commits into
redhat-developer:mainfrom
gustavolira:poc/native-smoke-harness

Conversation

@gustavolira

@gustavolira gustavolira commented Jun 26, 2026

Copy link
Copy Markdown
Member

What

A Docker-free, in-process smoke harness (smoke-tests-native/) that validates RHDH
dynamic backend plugins: it installs them with the published
@red-hat-developer-hub/cli-module-install-dynamic-plugins CLI, then boots them with
startTestBackend (@backstage/backend-test-utils) — no Docker container, no cluster.
About 20x faster than the per-workspace docker run rhdh smoke-test for that scope.

The loader / module-resolution / plugin-config are ported from RHDH's already-green
nightly test (plugin-dynamic-loading.spec.ts, redhat-developer/rhdh#4967).

How it runs in CI

A dedicated, separate workflow .github/workflows/native-smoke.yaml — independent of the
Docker-based run-workspace-smoke-tests.yaml:

  • pull_request (paths smoke-tests-native/**): validates the harness on every change here.
  • workflow_dispatch: run against any plugin ref on demand.

It installs skopeo, builds with esbuild, runs yarn smoke, and uploads results.json.
There is no docker run anywhere. The PR's run is green — the harness installed the
plugin and booted it in-process (status: pass).

Scope (honest boundary)

  • Covers: backend dynamic plugins that don't extend the catalog (e.g. scaffolder modules).
  • Not yet: catalog-extending modules (catalog-backend doesn't boot standalone in the
    minimal harness — tracked as follow-up) and frontend plugins (backend-only; UI render is
    the NFS / app-next path). Those stay on the Docker smoke for now.

This is additive — it removes no existing Docker smoke-test. Migrating covered workspaces
off Docker is a separate, parity-gated step.

Verification

  • CI green: SonarCloud + the new smoke check.
  • Local (Node 24): tsc --noEmit clean; yarn install --immutable passes; harness run =
    pass on a good plugin, error on a bad ref.
  • Benchmark vs Docker (same plugin, real images): ~5s vs ~104s.

Tickets: RHIDP-15075, RHIDP-15076, RHIDP-13530 (epic RHIDP-13501).

🤖 Generated with Claude Code

@openshift-ci

openshift-ci Bot commented Jun 26, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Comment thread smoke-tests-native/src/native-smoke.ts Fixed
@gustavolira

Copy link
Copy Markdown
Member Author

/review

@gustavolira

Copy link
Copy Markdown
Member Author

/agentic-review

@gustavolira gustavolira marked this pull request as ready for review June 26, 2026 17:06
@gustavolira gustavolira requested review from a team, gashcrumb and kadel as code owners June 26, 2026 17:06
@gustavolira

Copy link
Copy Markdown
Member Author

/publish

@github-actions

Copy link
Copy Markdown
Contributor

PR action (/publish) cancelled: PR doesn't touch only 1 workspace.

@github-actions github-actions Bot added the non-workspace-changes PR changes files outside workspace directories label Jun 26, 2026
@gustavolira gustavolira changed the title feat(poc): Docker-free in-process dynamic-plugin smoke harness feat: Docker-free in-process smoke harness for backend dynamic plugins Jun 30, 2026
@gustavolira gustavolira force-pushed the poc/native-smoke-harness branch from c41bdb4 to 588b296 Compare June 30, 2026 18:40

@rostalan rostalan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In my opinion, this is a step in the good direction, I am just worried that any potential gain atm is negated by the lack of coverage of the frontend and catalog plugins. If I still need to run the old smoke tests on the workspace to test these plugins, what good is it for to have the backend tested faster?
Edit: did not notice we had pure backend workspaces, it makes sense to run it in that case. It could also catch backend issues faster.

@rostalan rostalan requested a review from davidfestal July 1, 2026 12:42
Comment thread smoke-tests-native/src/native-smoke.ts Outdated
Comment thread smoke-tests-native/src/plugin-config.ts
Comment thread smoke-tests-native/src/native-smoke.ts Outdated
Comment thread smoke-tests-native/src/loader.ts Outdated
Comment thread smoke-tests-native/src/native-smoke.ts
@gustavolira gustavolira force-pushed the poc/native-smoke-harness branch from b83702e to c279415 Compare July 1, 2026 14:31
@gustavolira

Copy link
Copy Markdown
Member Author

Heads-up that the frontend / UI-render half this PR scopes out ("backend-only; UI render is the NFS / app-next path") now has a proven, Docker-free path in redhat-developer/rhdh#5005.

That PR is basically the frontend complement to this one. It boots the RHDH backend + the legacy app (packages/app) dev servers in-process — no cluster, no image build — and runs an existing Playwright spec against them. Dynamic frontend plugins are installed exactly the way you do here: the published install-dynamic-plugins CLI pulling from OCI via skopeo, so no dynamic-plugins/dist source build. It's green in CI in ~4.5 min — the dynamic-home-page plugin (from this repo's OCI registry) renders "Welcome back!" + Quick Access off-cluster and the existing guest-signin spec passes unmodified.

Two things from it that are directly relevant here:

  • The install-dynamic-plugins + OCI populate works for frontend plugins too, not just backend — the same step extends to UI render.
  • Render nuance worth knowing: plugins that mount on a route (e.g. the home page at /) render with just the plugin + the repo's app-config.dynamic-plugins.yaml; plugins that mount app-level (e.g. global-header) load fine (scalprum serves them) but need extra config to actually mount in the layout.

Honest gap for doing the same in this repo: the frontend harness needs the full RHDH app to boot, which the overlays repo doesn't have locally — so a "frontend smoke" here wouldn't be a trivial port of this backend harness. But the approach and the OCI-for-frontend validation are proven if we want to add the frontend counterpart down the line. Together they'd cover the whole Docker-free/cluster-free smoke: backend loads (this PR) + frontend renders (#5005).

@gustavolira gustavolira requested a review from rostalan July 2, 2026 12:35
gustavolira and others added 3 commits July 2, 2026 11:40
Adds smoke-tests-native/: validates RHDH dynamic backend plugins in-process via the
published install-dynamic-plugins CLI + startTestBackend — no Docker, no cluster
(~20x faster than the per-workspace docker run smoke for that scope). Runs in a
dedicated native-smoke.yaml workflow (pull_request + workflow_dispatch). Loader,
module-resolution and plugin-config are ported from RHDH PR #4967.

Scope: backend non-catalog plugins. Catalog-extending modules and frontend stay on
the Docker smoke (catalog wiring + NFS are follow-ups). Additive — removes nothing.

Tickets: RHIDP-15075, RHIDP-15076, RHIDP-13530 (epic RHIDP-13501).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
….json

- Warn when backend plugins are filtered by KNOWN_FAILURES, and when nothing at
  all was validated (avoids a silent pass on a known-failure-only workspace);
  include the skipped list in results.json. [native-smoke.ts]
- Move the CLI version check + temp-dir setup inside the try, so a failure there
  still writes a results.json (status: error) instead of exiting with no report.
- Validate the --dynamic-plugins file exists (not just that the arg was passed).
- Warn instead of silently skipping a plugin dir with a malformed package.json.
  [loader.ts]
- Clarify that plugin-config KNOWN_FAILURES/configOverrides are for multi-plugin/
  workspace runs and kept in TS (type-checked, in sync with the RHDH port) rather
  than package.json.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… small cleanups

- bump esbuild 0.24.2 -> 0.28.1 (clears GHSA-67mh-4wv8-2f99 advisory range) and
  typescript 6.0.2 -> 6.0.3; engines.yarn ">=4" to match packageManager yarn@4
- workflow: single source of truth for the default plugin ref (env only, input
  default removed); corepack before setup-node + yarn cache keyed on
  smoke-tests-native/yarn.lock
- native-smoke: shared BackendStartResult type; writeErrorReport helper also
  covers usage errors (results.json now written on exit 2 too); drop unused env
  param from run(); single-pass KNOWN_FAILURES partition
- loader: normalize "./dist/…" package mains; type-guard filter instead of
  "as string[]"; hoist repeated role check

Verified on Node 24: tsc clean, esbuild build ok, end-to-end smoke run
status: pass (backend loaded 1/1, startTestBackend booted), usage-error path
writes results.json (status: error) and exits 2.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@gustavolira gustavolira force-pushed the poc/native-smoke-harness branch from c279415 to ef2ee44 Compare July 2, 2026 14:40
…(S3776)

- resolveOutPath(): the --out CLI argument is resolved and constrained to the
  working directory before any write, so a faulty argument can never write
  outside it; rejected paths exit 2 with a clear message
- extract partitionKnownFailures() from main(), bringing its cognitive
  complexity back under the threshold

Verified on Node 24: tsc clean, build ok, happy path status: pass,
"../escape.json" rejected (exit 2), usage error still writes results.json.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Jul 2, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

non-workspace-changes PR changes files outside workspace directories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants