Skip to content

Add Aspire.Hosting.Radius: Radius as a compute environment (+ cloud providers) - #18696

Merged
Mitch Denny (mitchdenny) merged 12 commits into
microsoft:mainfrom
nellshamrell:radius/pr1-compute-env-and-cloud
Jul 10, 2026
Merged

Mitch Denny (mitchdenny) merged 12 commits into
microsoft:mainfrom
nellshamrell:radius/pr1-compute-env-and-cloud

Conversation

@nellshamrell

@nellshamrell Nell Shamrell-Harrington (nellshamrell) commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds a new preview integration, Aspire.Hosting.Radius, that lets an Aspire AppHost target Radius as a first-class compute environment — a peer of AddKubernetesEnvironment, AddDockerComposeEnvironment, and AddAzureContainerAppEnvironment.

AddRadiusEnvironment is another Aspire compute environment — add it, keep your resource graph, aspire run locally as usual, and aspire publish/deploy to Radius.

This is PR 1 of a stacked series that splits a large integration into reviewable increments. It contains the golden-path core plus the most Aspire-idiomatic advanced feature (in-code cloud providers). Planned follow-ups: PR 2 – recipe parameters + secret management; PR 3 – multiple Radius resource groups + recipe/type customization. (the planned follow-ups well come after this pull request is reviewed and merged).

What's included

  • AddRadiusEnvironment / WithNamespace and WithComputeEnvironment targeting (reuses the existing Aspire API verbatim).
  • Full aspire publish / deploy lifecycle. publish emits a native app.bicep; deploy transparently runs rad deploy (no rad knowledge needed on the happy path).
  • Run-mode parity. Radius is publish/deploy-only and inert during aspire run — it registers no resource and adds no run-mode annotations, matching the unregistered-builder pattern of AddKubernetesEnvironment / AddDockerComposeEnvironment. Local dev and the dashboard are unchanged.
  • In-code cloud providers: WithAzureProvider / WithAwsProvider with typed credential modes (service principal, workload identity, access key, IRSA). Credentials flow from AddParameter(secret: true) and are never inlined into Bicep.
  • Core resource→type mapping including the legacy Applications.* fallback for Redis/Mongo/RabbitMQ/Dapr on the supported Radius floor (0.59+), and native Radius.Compute/containers for projects/containers.
  • ConfigureRadiusInfrastructure escape hatch over the typed Bicep AST (Experimental, ASPIRERADIUS004).
  • ASPIRERADIUS diagnostics — coded, aka.ms-linked, fail-fast config/publish/deploy validation.

Not in this PR (coming in the stacked follow-ups)

Recipe parameters, secret stores / sealed-secrets, multiple Radius resource groups, and WithManagedResource / PublishAsRadiusResource customization — deliberately deferred to keep this PR focused on the golden path.

Testing

New project Aspire.Hosting.Radius.Tests (31 files, 183 tests, all passing) covering run-mode inertness, publish Bicep generation (Verify snapshots incl. legacy-fallback emission), provider/credential emission + redaction, connection-string propagation, and rad CLI detection.

Status

Preview / prototype — the package ships version-pinned and the public API may change. Mirrors Aspire.Hosting.Kubernetes, which is also preview-only today.

Fixes # (no tracking issue yet)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected. (Stacked PRs 2 and 3 add recipe parameters, secrets, resource groups, and customization.)
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • Cloud-provider credentials are sourced from AddParameter(secret: true), never inlined into generated Bicep, and redacted from deploy output (see RadCredentialRedactionTests).
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

…oviders

Introduces the Aspire.Hosting.Radius integration, letting an Aspire AppHost
target Radius (radapp.io) as a first-class compute environment.

PR 1 of a stacked series. Scope (Tiers 1 + the idiomatic Tier 2 provider work):

- AddRadiusEnvironment / WithNamespace: add one line, keep your resource graph,
  aspire run locally unchanged, aspire publish/deploy to Radius.
- WithComputeEnvironment targeting (reuses the existing Aspire API).
- Full aspire publish/deploy lifecycle: publish emits a native app.bicep;
  deploy transparently runs rad deploy. Radius is inert in run mode, matching
  AddKubernetesEnvironment / AddDockerComposeEnvironment.
- In-code cloud providers: WithAzureProvider / WithAwsProvider with typed
  credential modes (service principal, workload identity, access key, IRSA);
  credentials come from AddParameter(secret: true) and are never inlined.
- Core resource→type mapping (ResourceTypeMapper) incl. the legacy
  Applications.* fallback for Redis/Mongo/RabbitMQ/Dapr on the supported
  Radius floor (0.59+).
- ConfigureRadiusInfrastructure escape hatch over the Bicep AST.

Follow-up PRs add recipe parameters + secret management (PR 2) and multiple
resource groups + recipe/type customization (PR 3).

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings July 8, 2026 20:59
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 18696

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 18696"

@github-actions github-actions Bot added the area-integrations Issues pertaining to Aspire Integrations packages label Jul 8, 2026
@nellshamrell

Copy link
Copy Markdown
Contributor Author

Design notes & anticipated questions

Posting a few things up front that reviewers are likely to ask, to save round-trips.

1. Why a stacked series instead of one PR?
The full integration is large. It's split into three independently-buildable, independently-testable PRs so each can be reviewed on its own merits:

  • PR 1 (this one): Radius as a compute environment + in-code cloud providers — the golden path.
  • PR 2: recipe parameters + secret management (stores, sealed-secrets, consumers).
  • PR 3: multiple Radius resource groups + WithManagedResource/PublishAsRadiusResource customization.

This PR is self-contained and shippable on its own; the follow-ups only add surface, they don't retrofit the core.

2. Run-mode inertness — how do I know Radius adds nothing locally?
AddRadiusEnvironment follows the same unregistered-builder pattern as AddKubernetesEnvironment / AddDockerComposeEnvironment: in run mode the environment is not added to the application model, so it surfaces no resource and its publish/deploy pipeline annotations stay dormant. aspire run and the dashboard are byte-for-byte what they'd be without Radius. Covered by the InnerLoop/* tests.

3. Pipeline steps live on the resource, not the extension method.
Publish/deploy steps are registered as annotations on RadiusEnvironmentResource (mirroring KubernetesEnvironmentResource) so any caller that constructs the resource directly — including a future hosting integration that wraps Radius — gets a complete pipeline without a breaking change.

4. Secret safety for cloud providers.
WithAzureProvider / WithAwsProvider credentials come exclusively from AddParameter(secret: true). They are never inlined into generated Bicep and are redacted from deploy output. See RadCredentialRedactionTests. Credential modes (service principal, workload identity, access key, IRSA) are typed, not stringly-configured.

5. Why does it still emit legacy Applications.* types for Redis/Mongo/RabbitMQ/Dapr?
The Radius.* user-defined resource types (UDTs) for these are not published in the pinned Radius floor (0.59) — I verified this directly against the biceptypes.azurecr.io/radius type registry: the 0.59 extension publishes Radius.Compute/containers, Radius.Core/*, Radius.Security/secrets, and only Radius.Data/mySqlDatabases. So ResourceTypeMapper falls back to the legacy Applications.* type per resource, which is what deploys today. Containers/projects use the native Radius.Compute/containers UDT.
The exit path is concrete and automatable: a UDT is "promoted" when its Radius.* type appears in a pinned release tag's published type index; at that point the LegacyFallbackType is dropped from that mapper entry, and once all legacy fallbacks are gone the three Legacy*Construct files can be deleted together.

6. Why pin the Radius Bicep extension version (0.59)?
Pinned to a concrete major.minor rather than :latest so generated Bicep deploys deterministically and an upstream tag move can't silently change the schema the AppHost emits against. It's meant to bump in lockstep with the targeted Radius install.

7. aspire add radius discoverability.
Package naming already follows convention (Aspire.Hosting.Radius). Wiring it into aspire add is the highest-leverage discoverability step — happy to include it here or as an immediate follow-up, whichever reviewers prefer.

8. Preview status / API review.
Ships preview-only (version-pinned, SuppressFinalPackageVersion), mirroring Aspire.Hosting.Kubernetes. Experimental surface is gated behind [Experimental] ASPIRERADIUS* diagnostics. No formal API review yet — glad to schedule one; the public entry points are intentionally small (AddRadiusEnvironment, WithNamespace, WithAzureProvider, WithAwsProvider, ConfigureRadiusInfrastructure).

Happy to adjust scope, split further, or fold aspire add registration in — feedback welcome.

@nellshamrell

Copy link
Copy Markdown
Contributor Author

What this PR delivers on its own (if it shipped without the follow-ups)

To make the review scope concrete: PR 1 alone is a complete, shippable "deploy your Aspire app to Radius" story. No follow-up PR is required for the golden path to work end-to-end.

An Aspire developer could target Radius as a deployment environment with zero changes to their inner loop:

var builder = DistributedApplication.CreateBuilder(args);

builder.AddRadiusEnvironment("radius")
    .WithNamespace("myapp");

var cache = builder.AddRedis("cache");

builder.AddProject<Projects.Api>("api")
    .WithReference(cache);

builder.Build().Run();

Concretely, this PR gives them:

1. aspire publish / aspire deploy to Radius. AddRadiusEnvironment registers the full publish→deploy pipeline. Projects and containers deploy as native Radius.Compute/containers resources; backing services are mapped automatically:

Aspire resource Radius type emitted
Project / Container Radius.Compute/containers (native)
Redis legacy Applications.Datastores/redisCaches *
Postgres / SQL Radius.Data/* (native)
MongoDB, RabbitMQ legacy fallback *
Dapr state store / pub-sub legacy fallback *

* Legacy Applications.* fallback because those Radius.* UDTs aren't published in the pinned 0.59 floor yet (verified against the type registry — see the design-notes comment above). This is transparent to the developer and deploys correctly today; the fallback is dropped per-type as each UDT is promoted.

2. In-code cloud providers. Configure Azure/AWS provisioning directly in the AppHost, with credentials sourced from secret parameters (never inlined into generated Bicep, redacted in deploy output):

builder.AddRadiusEnvironment("radius")
    .WithAzureProvider(servicePrincipal, subscriptionId, resourceGroup)  // SP or workload identity
    .WithAwsProvider(region, accountId, accessKey, secretKey);           // access key or IRSA

3. Custom container image for a project via WithContainerImage.

4. Namespace targeting (WithNamespace) and low-level Bicep-AST customization (ConfigureRadiusInfrastructure, Experimental).

5. Byte-for-byte unchanged aspire run. The environment is not registered in run mode (same pattern as AddKubernetesEnvironment / AddDockerComposeEnvironment), so the dashboard and local dev loop are completely untouched.

Deferred to the follow-up PRs (not needed for the core story):

  • PR 2 — recipe parameters (customize the Radius recipe backing each resource) + secret management (Radius secret stores, sealed secrets, consumers).
  • PR 3 — multiple Radius resource groups in one app + WithManagedResource / PublishAsRadiusResource for hand-authored/customized Radius resource types.

So the follow-ups add customization depth; they don't retrofit the core capability. This PR can stand alone.

Copilot AI 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.

Pull request overview

This PR adds a new preview hosting integration, Aspire.Hosting.Radius, that lets an Aspire AppHost target Radius as a first-class compute environment (a peer of AddKubernetesEnvironment / AddDockerComposeEnvironment / AddAzureContainerAppEnvironment). It provides AddRadiusEnvironment/WithNamespace, a full aspire publish/deploy lifecycle that emits a native app.bicep and shells out to rad deploy, in-code cloud providers (WithAzureProvider/WithAwsProvider) with typed credential modes, a core resource→Radius-type mapping with a legacy Applications.* fallback, and coded ASPIRERADIUS diagnostics. It is explicitly PR 1 of a stacked series and is inert during aspire run, mirroring the unregistered-builder pattern of the Kubernetes integration.

Changes:

  • New src/Aspire.Hosting.Radius project: environment resource, recipe/type mapping, Bicep constructs + post-processing, and the publish/credential-register/deploy pipeline steps.
  • In-code cloud-provider surface with credential redaction (secrets sourced from AddParameter(secret:true), never inlined into Bicep, redacted from rad output).
  • New Aspire.Hosting.Radius.Tests project (31 files) covering run-mode inertness, Verify-based Bicep snapshots, provider/credential emission + redaction, and rad CLI detection; solution + csproj wiring.

Reviewed changes

Copilot reviewed 77 out of 77 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/Aspire.Hosting.Radius/RadiusEnvironmentResource.cs Public compute-environment resource; wires prepare/publish/(credential)/deploy pipeline steps and cross-env DNS resolution.
src/Aspire.Hosting.Radius/RadiusRecipe.cs Public recipe override type; RecipeLocation doc narrates a within-branch rename (flagged).
src/Aspire.Hosting.Radius/CloudProviders/RadiusCloud.cs Public enum whose only consumer is deferred to a later PR and lacks the experimental gate used by the rest of the surface (flagged).
src/Aspire.Hosting.Radius/CloudProviders/RadiusCloudProviderExtensions.cs WithAzureProvider/WithAwsProvider; public XML docs leak internal FR-xxx identifiers (flagged).
src/Aspire.Hosting.Radius/Publishing/RadCredentialRegisterStep.cs Registers rad credential with secret redaction; security-sensitive, honestly documents process-table exposure.
src/Aspire.Hosting.Radius/Publishing/RadiusDeploymentPipelineStep.cs rad deploy step and CLI detection; cancellation not observed before Process.Start (bug), and a comment references a nonexistent test name (flagged).
src/Aspire.Hosting.Radius/Publishing/BicepPostProcessor.cs Bicep compilation, identifier sanitization/uniqueness (ASPIRERADIUS056), typed literal conversion.
tests/Aspire.Hosting.Radius.Tests/Deployment/RadCliDetectionTests.cs Detection tests; DetectRadCliAsync_SupportsCancellation depends on the production cancellation fix above.
tests/Aspire.Hosting.Radius.Tests/RadiusTestHelper.cs Simulates the prepare step for publishing-context tests; XML doc references internal design items (flagged).
tests/Aspire.Hosting.Radius.Tests/TestHosts/{Simple,MultiResource}AppHost.cs Test hosts that are never referenced by any test (dead code; flagged), with an inaccurate summary in the multi-resource host.
tests/Aspire.Hosting.Radius.Tests/Snapshots/*.verified.bicep Verify snapshots pinning legacy-fallback and UDT Bicep output.
Aspire.slnx / *.csproj Solution and project wiring for the new integration and its tests.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

…docs

- Fix DetectRadCliAsync to honor a pre-cancelled token before launching the
  process. When rad is not on PATH, process.Start() threw Win32Exception which
  the catch swallowed into false, so cancellation was never surfaced — failing
  DetectRadCliAsync_SupportsCancellation on CI hosts without rad. Check the
  token up front so OperationCanceledException propagates regardless.
- Fix stale comment referencing a nonexistent test name
  (ErrorMessage_ContainsInstallLink -> RadCliNotFoundException_ContainsInstallLinkAndRemediation).
- Remove RadiusCloud enum: unused public API in this PR (its only consumer,
  WithManagedResource, is deferred to a later stacked PR) and the only
  cloud-provider type lacking the [Experimental] gate. Defer to that PR.
- Remove unreferenced test hosts SimpleRadiusAppHost and MultiResourceAppHost
  (dead code; the latter's summary was also inaccurate).
- Drop internal design identifiers (FR-xxx/INV-x/within-branch rename history)
  from public XML docs and doc comments so they don't leak into IntelliSense.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings July 8, 2026 22:46
@nellshamrell

Copy link
Copy Markdown
Contributor Author

Thanks for the thorough review — all 8 comments are addressed in eb546bf.

Fixes

  1. DetectRadCliAsync cancellation (CI failure). Good catch — this was the actual cause of the red Hosting.Radius job. The method now calls cancellationToken.ThrowIfCancellationRequested() before launching the process, so a pre-cancelled token surfaces as OperationCanceledException regardless of whether rad is on PATH (previously process.Start() threw Win32Exception first, which the catch swallowed into false). Verified by running DetectRadCliAsync_SupportsCancellation with rad removed from PATH — it now passes.
  2. Stale test-name comment. Updated to RadCliNotFoundException_ContainsInstallLinkAndRemediation.
  3. RadiusCloud dead/ungated public API. Removed from this PR. Its only consumer (WithManagedResource) is deferred to the stacked PR that introduces resource customization, so RadiusCloud will land there alongside it (gated by the same [Experimental] diagnostic).
  4. Dead test hosts. Removed SimpleRadiusAppHost and MultiResourceAppHost (unreferenced; the latter's summary was also inaccurate).
  5. Internal FR-xxx identifiers in public docs. Dropped across RadiusCloudProviderExtensions, IAzure/IAwsRadiusProviderBuilder, the provider builders, CloudProviderValidation, and RadiusCloudProvidersAnnotation — docs now describe current behavior only.
  6. RadiusRecipe.RecipeLocation remarks. Removed the within-branch rename narration; describes the current recipeLocation/templatePath emission only.
  7. RadiusTestHelper doc. Removed the "A1/A2 fix" / "finding I5" references; describes the current constraint only.

Local result: build clean (0 warnings), 183 tests pass.

Copilot AI 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.

Pull request overview

Copilot reviewed 74 out of 74 changed files in this pull request and generated 2 comments.

- ConnectionConstruct: replace the copy/pasted 'Initializes a new ...' summary
  on the DefineProvisionableProperties() override with /// <inheritdoc />, matching
  the other constructs in the folder.
- Replace hard-coded Radius resource-type strings and API versions in the
  construct base() calls with the existing RadiusResourceTypes constants
  (Environments/Applications/RecipePacks/Containers + RadiusApiVersion, and
  new LegacyApplications/LegacyEnvironments + LegacyApiVersion for the legacy
  constructs). Avoids literal drift when the API version bumps during UDT migration.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings July 8, 2026 22:58
@nellshamrell

Copy link
Copy Markdown
Contributor Author

Both round-2 comments addressed in f15f7e5.

  1. ConnectionConstruct misleading summary. Replaced the copy/pasted Initializes a new ConnectionConstruct <summary> on the DefineProvisionableProperties() override with /// <inheritdoc />, matching the other constructs in the folder.
  2. Hard-coded type strings / API versions (nit). Took the suggestion — the construct base(...) calls now reference the RadiusResourceTypes constants (Environments/Applications/RecipePacks/Containers + RadiusApiVersion) instead of literals. Added two new constants (LegacyApplications, LegacyEnvironments) so the LegacyApplication* constructs use LegacyApiVersion too — no literal type/version strings remain in the constructs. Snapshot tests confirm the emitted Bicep is byte-identical.

Build clean (0 warnings), 183 tests pass.

Copilot AI 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.

Pull request overview

Copilot reviewed 74 out of 74 changed files in this pull request and generated 2 comments.

- RadiusRecipe public XML doc no longer references WithRecipeParameters(...) or
  diagnostic ASPIRERADIUS027 — neither ships in this PR (they land with recipe
  parameters in a later stacked PR). Describe the intended environment/type-scope
  behavior generically so IntelliSense doesn't point early adopters at unshipped API.
- Rename the misleading bool 'existingAnnotations' to 'alreadyTargeted' in
  RadiusInfrastructure.PrepareDeploymentTargetsAsync, matching the equivalent
  helper in RadiusTestHelper.AttachDeploymentTargets.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings July 8, 2026 23:51
@nellshamrell

Copy link
Copy Markdown
Contributor Author

Both round-3 comments addressed in 42b9d03.

  1. RadiusRecipe doc references unshipped API. Good catch — WithRecipeParameters(...) and diagnostic ASPIRERADIUS027 land with recipe parameters in a later stacked PR, so pointing IntelliSense at them here is misleading. Reworded the <remarks> to describe the intended environment/type-scope behavior generically, without naming the not-yet-shipped method or diagnostic.
  2. Misleading bool name. Renamed existingAnnotations → alreadyTargeted in PrepareDeploymentTargetsAsync, matching RadiusTestHelper.AttachDeploymentTargets.

Build clean (0 warnings), 183 tests pass.

Copilot AI 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.

Pull request overview

Copilot reviewed 74 out of 74 changed files in this pull request and generated 9 comments.

Comment thread src/Aspire.Hosting.Radius/README.md Resolved
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@mitchdenny Mitch Denny (mitchdenny) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code review of the Radius integration. This is cleanly additive (no changes to core Aspire abstractions), so review focused on the new code. Three findings below; I excluded items the existing automated reviewer already flagged (e.g. rad --version vs rad version, secret parameter values written as literals at RadiusInfrastructureBuilder.cs:1062, PublishAsRadiusResource() referenced but not shipped, the orphan Verify snapshot, and README drift).

Summary by category:

  • Dead code / stale comments (with an unbacked correctness claim): 1
  • Non-functional exported public API: 1
  • Misleading comments on a security-sensitive path: 1

Could you also run the pr-testing skill against this PR? It touches deployment/publish behavior (Bicep generation + rad deploy), and a pr-testing pass would exercise the publish path end-to-end beyond the unit/snapshot tests.

@mitchdenny

Copy link
Copy Markdown
Member

One more, for a follow-up (not blocking this PR): it would be valuable to add an E2E deployment test that actually deploys a Radius app and verifies the deployed behavior, rather than relying only on the Bicep snapshot/unit tests. The snapshot tests prove serializer output but not that rad deploy + the generated app.bicep produce a working deployment.

This can land as a separate follow-up PR. See the deployment-e2e-testing skill for the expected shape — tests belong under tests/Aspire.Deployment.EndToEnd.Tests/.

@mitchdenny

Copy link
Copy Markdown
Member

Beyond the deployment E2E test (which needs a real rad/cluster), I'd also like to see a lighter-weight CLI E2E smoke test that runs aspire publish against an AppHost configured with a Radius environment and asserts the basic shape of the emitted artifacts. This doesn't require the rad CLI at all — publish stops at generating app.bicep + bicepconfig.json, so it's a cheap, deterministic smoke test that still exercises the real CLI → AppHost → publish-pipeline path end-to-end (unlike the in-proc unit/snapshot tests).

Suggested assertions (keep it a smoke test, not a golden-file):

  • aspire publish exits 0
  • an app.bicep is produced in the environment output dir, starts with extension radius, and contains the expected Radius.Core/* resource(s)
  • a bicepconfig.json is produced that pins the radius bicep extension

Where CLI E2E testing lives / patterns to copy:

  • Project: tests/Aspire.Cli.EndToEnd.Tests/
  • Closest precedent: tests/Aspire.Cli.EndToEnd.Tests/KubernetesPublishTests.cs (and TypeScriptPublishTests.cs / JavaScriptPublishTests.cs) — same 'run aspire publish, assert output artifacts' shape
  • Helpers/fixtures: tests/Aspire.Cli.EndToEnd.Tests/Helpers/ and tests/Aspire.Cli.EndToEnd.Tests/Fixtures/
  • Skill/guide: the cli-e2e-testing skill (.agents/skills/cli-e2e-testing/SKILL.md) covers the Hex1b terminal-automation setup and conventions

This can also be a follow-up PR if you'd prefer to keep this one focused.

- RadiusInfrastructure/RadiusTestHelper: set DeploymentTargetAnnotation.ComputeEnvironment
  (and idempotency check) to resourceComputeEnvironment ?? targetComputeEnvironment so an
  explicitly-targeted resource is found by GetDeploymentTargetAnnotation, matching Kubernetes.
- ProviderScopeBicepEmissionTests: assert on azure-specific tokens (azure:/subscriptionId:/
  resourceGroupName:) instead of the never-present 'providers.azure' substring.
- DeployPipelineIntegrationTests: use the predicate DoesNotContain overload so a 'push-<resource>'
  dependency can't slip past the exact-match check.
- RecipeEntryConstruct: fix summary to reference UDT schema keys recipeKind/recipeLocation.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: e9cd817a-2328-4f41-b9ef-e0ede2ebba07

Copilot AI 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.

Copilot wasn't able to review this pull request because it exceeds the maximum diff size. Try reducing the number of changed files and lines, and requesting a review from Copilot again.

main renamed tests/Shared/TemporaryRepo.cs (namespace Aspire.Cli.Tests.Utils)
to TemporaryWorkspace.cs (namespace Aspire.Tests.Utils), now imported via a
global <Using Include="Aspire.Tests.Utils"> in the CLI E2E csproj. The stale
'using Aspire.Cli.Tests.Utils;' no longer resolves and broke the enumerate-tests
build (CS0234). Remove it; TemporaryWorkspace/SequenceCounter resolve via the
global usings.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: e9cd817a-2328-4f41-b9ef-e0ede2ebba07
Copilot AI review requested due to automatic review settings July 9, 2026 23:18

Copilot AI 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.

Copilot wasn't able to review this pull request because it exceeds the maximum diff size. Try reducing the number of changed files and lines, and requesting a review from Copilot again.

@nellshamrell

Copy link
Copy Markdown
Contributor Author

Done — added a lightweight CLI E2E smoke test: tests/Aspire.Cli.EndToEnd.Tests/RadiusPublishTests.cs (PublishWithRadiusEnvironment_EmitsExpectedArtifacts).

It exercises the real CLI → AppHost build → publish-pipeline path (no rad CLI, no cluster — publish stops at Bicep generation):

  • aspire new (Empty AppHost) → aspire add Aspire.Hosting.Radius → patches apphost.cs with AddRadiusEnvironment("radius") + AddContainer("web", "nginx") → aspire publish -o radius-output --non-interactive.
  • Exits 0 — WaitForSuccessPromptAsync matches the OK] $ prompt and throws on ERR:.
  • app.bicep is produced, starts with extension radius, and contains Radius.Core/environments + Radius.Compute/containers (+ nginx).
  • bicepconfig.json is produced and pins the Radius bicep extension (extensions.radius starts with br:biceptypes.azurecr.io/radius:<version>), parsed as JSON to guard against malformed output.

Modeled on KubernetesPublishRequiresExternalEndpointTests (the lightest "run aspire publish, assert output artifacts" precedent) rather than KubernetesPublishTests, which additionally spins up KinD + Helm + Docker — keeping it a cheap, deterministic smoke test as suggested.

Verified locally against a linux-x64 localhive archive in Docker: 1 passed, 0 failed (~69s). It also runs as its own CLI E2E CI job.

@nellshamrell

Copy link
Copy Markdown
Contributor Author

Hi Mitch Denny (@mitchdenny)! Thanks for the review! I believe I have incorporated all of your requests. I will follow up with the deployment end-to-end tests after this is merged.

@mitchdenny Mitch Denny (mitchdenny) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving — additive integration that plugs cleanly into the existing compute-environment extension points, and it ships as preview (SuppressFinalPackageVersion) so the API can bake. My earlier review comments (dead recipe-divergence logic, the unconsumed exported RadiusRecipe type, and the misleading secrets-as-Bicep-params comments) can be addressed in follow-ups along with the suggested deployment + CLI E2E smoke tests.

@mitchdenny
Mitch Denny (mitchdenny) merged commit 8660f6a into microsoft:main Jul 10, 2026
337 checks passed
@github-actions github-actions Bot added this to the 13.5 milestone Jul 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 CI Failure Analysis: Transient Infrastructure Failure

The CI build failed due to transient infrastructure issues.

Failed jobs:

  • Tests / Hosting.Azure / Hosting.Azure (windows-latest) — All 1579 tests passed successfully. Post-test steps (Check for hang dump files, Upload logs, Copy CLI E2E recordings) failed with exit code -1073741502 (0xC0000142), a known Windows process initialization failure that is a transient infrastructure issue unrelated to PR changes. (transient-infra)

If a rerun was not already requested automatically, visit the workflow run page to rerun the failed jobs manually.

Mitch Denny (mitchdenny) added a commit that referenced this pull request Jul 13, 2026
* Add live E2E deployment test for Aspire.Hosting.Radius

Follow-up to #18696. Adds RadiusStarterDeploymentTests, which deploys the
Aspire starter template to a live Radius environment on AKS and verifies the
deployed app runs (rad resources present, pods ready, HTTP 200) — proving the
`aspire publish` + `rad deploy app.bicep` path works end to end rather than
only validating serializer output via snapshot/unit tests.

- New test builds/pushes the starter images to ACR and attaches them with
  WithContainerImage (the Radius publisher does not push project images yet,
  see #16844), then asserts app.bicep references the ACR images before deploy.
- Gated "Setup Radius" step in deployment-tests.yml installs the pinned rad
  CLI (0.59.0, aligned with RadiusBicepExtension) only for the Radius matrix
  class.
- README documents the Radius scenario and the rad prerequisite.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 9c52ede6-7b7f-42ee-a961-9e1f19f54315

* Address code-review feedback on Radius E2E test

- Make the app.bicep image-reference check non-vacuous: split the marker
  token in the source command so it appears only in output, not the echoed
  command line (the grep exit code remains the hard gate).
- Add --show-labels to the pod/service listing so a Radius label-schema
  mismatch is visible in the recording rather than surfacing as an empty
  jsonpath during endpoint verification.
- Document that useRedisCache: true is intentional (exercises the Radius
  container recipe + connection wiring).

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 9c52ede6-7b7f-42ee-a961-9e1f19f54315

* Address PR review comments on Radius E2E test

- Pin the radius install.sh fetch to the v$RADIUS_VERSION release tag instead
  of the moving `main` branch, so the installer script content is locked to the
  same version we install (supply-chain hardening).
- Dispose the TemporaryWorkspace via `using var` so its temp directory is
  cleaned up (matches sibling deployment tests; the workspace is not a CI
  artifact).
- Dispose the resource-group-cleanup Process via `using var` to avoid leaking
  OS handles.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 9c52ede6-7b7f-42ee-a961-9e1f19f54315

* Address remaining PR review comments on Radius E2E test

Validate the Radius.Core UDT application (not just the legacy Redis app) by
using the preview graph implementation and asserting the deployed graph names
both project containers:
- rad app graph -a app --preview (forces the Radius.Core graph; the default
  routes to legacy Applications.Core, which the Redis-only legacy 'app'
  satisfies on its own)
- grep the captured preview graph for apiservice and webfrontend so a missing
  UDT container fails fast

Exercise the Redis-backed output cache by probing /weather instead of / on the
webfrontend. /weather calls the apiservice (WeatherApiClient) and is served
through AddRedisOutputCache; grep for the streamed forecast table so the probe
proves the API + output-cache path end-to-end despite StreamRendering.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 0a2ea3fa-e408-445e-8b72-55eaab7f6661

* Fix aspire deploy wait matching stale publish pipeline marker

The Radius E2E test ran `aspire publish` (which prints "Pipeline succeeded")
and then `aspire deploy` guarded by WaitForPipelineSuccessAsync. That helper
scans the whole terminal viewport for "Pipeline succeeded", so it could match
the stale marker still on screen from the earlier publish and return
immediately -- collapsing the intended 15-minute deploy budget down to the
trailing 2-minute prompt wait.

Wait on the deploy command's sequence-numbered prompt instead (17m, preserving
the prior 15m+2m effective ceiling). That prompt is scoped to this command
alone, so it cannot match the publish marker, and it already fails fast on a
non-zero deploy via the [n ERR:] prompt. The pipeline helper's only extra
behavior is a transient-Azure-capacity Assert.Skip that targets AKS
provisioning; deploy here only runs rad deploy against the already-created
cluster, so that path does not apply.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 0a2ea3fa-e408-445e-8b72-55eaab7f6661

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* Isolate kubeconfig and rad config in Radius E2E test

Address round-4 PR review comments on the Radius starter deployment test:

- Isolate kubeconfig: export KUBECONFIG to a throwaway file under the
  TemporaryWorkspace so az/kubectl/rad (incl. aspire-deploy's rad) never
  mutate the developer's ~/.kube/config.
- Isolate rad config: shadow `rad` with a workspace-local PATH shim that
  injects `--config <ws>/.rad/config.yaml` into every invocation (rad has
  no config env var; aspire deploy spawns rad via PATH). The user's
  ~/.rad/config.yaml is never touched, avoiding a backup/restore race.
- Drop `--force` from `rad workspace create`: the isolated config starts
  empty so the name can never collide with a pre-existing workspace.
- Add the ASPIREPIPELINES001 and ASPIRERADIUS057 pragmas independently so
  one already being present never skips adding the other.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 0a2ea3fa-e408-445e-8b72-55eaab7f6661

* Isolate Docker credentials in Radius E2E test

Address two more round-5 PR review comments on the Radius starter
deployment test:

- Isolate Docker credentials: export DOCKER_CONFIG to a throwaway dir under
  the TemporaryWorkspace in Step 1b so `az acr login` (which shells to
  `docker login`) and `dotnet publish /t:PublishContainer` authenticate
  against isolated creds instead of the developer's ~/.docker/config.json.
- Rewrite the deploy-wait comment to describe the current 17-minute timeout
  constraint directly rather than referencing an earlier PR revision.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 0a2ea3fa-e408-445e-8b72-55eaab7f6661

* Kill hung cleanup process tree on timeout in Radius E2E test

Address round-6 PR review comment: when the 2-minute cleanup wait fires,
`WaitForExitAsync` throws but disposing the Process does not terminate the
underlying `az group delete` process. Explicitly handle the timeout
cancellation, kill the whole process tree (`az` is a Python wrapper that
forks children), and wait briefly for it to be reaped so a hung cleanup
can't outlive the test run. Report cleanup failure based on whether the
tree was fully terminated.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 0a2ea3fa-e408-445e-8b72-55eaab7f6661

* Add KIND-based Radius CLI E2E test and fix AKS Radius deployment test

Add a per-PR KIND-based Radius deploy test (no Azure) that drives the full CLI
path (aspire publish -> aspire deploy -> rad deploy app.bicep) so the Radius
deploy flow gets local coverage on every PR, and get the live AKS Radius
deployment test passing end-to-end:

- Add RadiusDeployTests plus KubernetesDeployTestHelpers/KubernetesE2EVersions
  to install the rad CLI and Radius control plane onto a KIND cluster and verify
  a deployed container serves HTTP.
- Use --no-ssh-key when creating the AKS cluster so the test does not depend on
  the runner having SSH keys.
- Pre-create $HOME/.rad/bin before running the Radius install.sh: the script's
  needsSudo() only checks the install dir's immediate parent, so a fresh runner
  without $HOME/.rad wrongly triggers sudo and leaves the dir root-owned, which
  later breaks the non-sudo "rad bicep download" (config.yaml.lock permission).
- Symlink the default ~/.kube/config to $KUBECONFIG before "rad install
  kubernetes": rad's Contour gateway step reads the default kubeconfig path
  directly and ignores $KUBECONFIG, which the test isolates to the workspace.
- Port-forward to the Deployment instead of a Service in both tests: Radius does
  not synthesize a Kubernetes Service for container workloads (only recipe-backed
  resources such as the Redis cache get one).
- Validate the webfrontend home page instead of the cross-service /weather page:
  webfrontend -> apiservice service discovery does not resolve on Radius (no
  Service for the apiservice container), so /weather cannot render forecast data.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: e6ab6cb7-df30-489d-8140-d00294846005

* Address PR review feedback on Radius deployment/E2E tests

- KIND deploy wait scopes to the deploy command's own sequence-numbered
  success prompt instead of WaitForPipelineSuccessAsync, which could match
  the stale "Pipeline succeeded" left by the earlier `aspire publish`.
- Split the VERIFY_OK success marker in the shell source (VERIFY''_OK) so
  the contiguous token appears only in curl's output, not in the echoed
  command line where WaitUntilTextAsync would match it prematurely.
- AKS test now backs up a real ~/.kube/config and force-symlinks the default
  path to the isolated $KUBECONFIG, then restores it in `finally`, so a local
  run cannot read (or be left pointing at) the developer's own cluster.
- README documents the actual per-container HTTP probes and the current
  Radius limitation (no Service for Radius.Compute/containers workloads), so
  cross-container connectivity is honestly scoped out.
- Corrected the InstallRadiusControlPlaneAsync doc comment: `rad install
  kubernetes` does provision the default group/environment but not a workspace.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: e6ab6cb7-df30-489d-8140-d00294846005

* Address second round of Radius test review feedback

- RestoreDefaultKubeConfig no longer risks deleting a developer's own
  ~/.kube/config: Step 8b now writes a marker before shadowing the path and
  backs up any pre-existing entry (regular file OR symlink, including a dangling
  one, preserved via `cp -a`). Cleanup only runs when the marker is present
  (provisioning can fail before Step 8b) and restores the original verbatim,
  so a local run is never left with a deleted or dangling default kubeconfig.
- Corrected the RadiusDeployTests wiring comment: a native
  Radius.Compute/containers workload gets no Kubernetes Service, so the test
  port-forwards straight to the Deployment (the previous "Service the recipe
  creates" wording was wrong).
- Corrected the class summary: the live Azure/AKS test runs on demand AND
  nightly (deployment-tests.yml schedule), not "only on demand".

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: e6ab6cb7-df30-489d-8140-d00294846005

* Isolate rad kubeconfig via shim HOME; repin KIND E2E image

AKS test (RadiusStarterDeploymentTests): bake a workspace-local HOME
into the Step 1b rad shim so every rad invocation - including
rad workspace create and the rad deploy that aspire deploy spawns -
reads the isolated kubeconfig at $HOME/.kube/config (which several rad
subcommands read directly, ignoring KUBECONFIG). This keeps the
developer's real ~/.kube/config and ~/.rad untouched for the run
without any backup/restore, addressing the shared-state review
feedback. The kubeconfig symlink is folded into Step 1b (its target is
written by az aks get-credentials before the first rad runs).

KIND test (RadiusDeployTests): repin the container image to the stable
digest-pinned mcr.microsoft.com/azuredocs/aci-helloworld to avoid
depending on a mutable tag (tracked by #18747).

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: e6ab6cb7-df30-489d-8140-d00294846005

---------

Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Mitch Denny <[email protected]>
@davidfowl

Copy link
Copy Markdown
Collaborator

Mitch Denny (@mitchdenny) Nell Shamrell-Harrington (@nellshamrell) This works with typescript right?

Nell Shamrell-Harrington (nellshamrell) added a commit to nellshamrell/aspire that referenced this pull request Jul 13, 2026
Second slice of the Aspire→Radius integration, layered on the merged
compute-environment baseline (microsoft#18696).

Recipe parameters (`WithRecipeParameters`):
- Flow environment-wide and resource-type-scoped values onto the recipe
  pack and legacy environment recipe entries.
- ParameterResource-backed values emit as valueless `@secure()` Bicep
  params bound at deploy time; provider references resolve at publish.
- ASPIRERADIUS028 guards recipe-parameter identifier collisions.

Secret management (gated behind experimental ASPIRERADIUS006):
- `AddRadiusSecretStore` / `WithSecretStore` with inline, existing-secret,
  and sealed-secret population modes plus `recipeConfig` consumers.
- Sealed secrets are applied via a dedicated pipeline step after publish
  and before deploy; secret values are never inlined into Bicep.
- Validation surfaces actionable ASPIRERADIUS040–055 diagnostics.

Recipe and secret parameters are unified with the existing container
env-var parameter registry so a parameter shared across both emits a
single Bicep `param` and one deploy binding; distinct parameters whose
names collide to the same identifier fail loudly (ASPIRERADIUS056)
rather than silently misbinding.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: f19583f4-384b-4601-a94b-290d9b0d4ed5
Nell Shamrell-Harrington (nellshamrell) added a commit to nellshamrell/aspire that referenced this pull request Jul 14, 2026
Second slice of the Aspire→Radius integration, layered on the merged
compute-environment baseline (microsoft#18696).

Recipe parameters (`WithRecipeParameters`):
- Flow environment-wide and resource-type-scoped values onto the recipe
  pack and legacy environment recipe entries.
- ParameterResource-backed values emit as valueless `@secure()` Bicep
  params bound at deploy time; provider references resolve at publish.
- ASPIRERADIUS028 guards recipe-parameter identifier collisions.

Secret management (gated behind experimental ASPIRERADIUS006):
- `AddRadiusSecretStore` / `WithSecretStore` with inline, existing-secret,
  and sealed-secret population modes plus `recipeConfig` consumers.
- Sealed secrets are applied via a dedicated pipeline step after publish
  and before deploy; secret values are never inlined into Bicep.
- Validation surfaces actionable ASPIRERADIUS040–055 diagnostics.

Recipe and secret parameters are unified with the existing container
env-var parameter registry so a parameter shared across both emits a
single Bicep `param` and one deploy binding; distinct parameters whose
names collide to the same identifier fail loudly (ASPIRERADIUS056)
rather than silently misbinding.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: f19583f4-384b-4601-a94b-290d9b0d4ed5
Nell Shamrell-Harrington (nellshamrell) added a commit to nellshamrell/aspire that referenced this pull request Jul 20, 2026
Second slice of the Aspire→Radius integration, layered on the merged
compute-environment baseline (microsoft#18696).

Recipe parameters (`WithRecipeParameters`):
- Flow environment-wide and resource-type-scoped values onto the recipe
  pack and legacy environment recipe entries.
- ParameterResource-backed values emit as valueless `@secure()` Bicep
  params bound at deploy time; provider references resolve at publish.
- ASPIRERADIUS028 guards recipe-parameter identifier collisions.

Secret management (gated behind experimental ASPIRERADIUS006):
- `AddRadiusSecretStore` / `WithSecretStore` with inline, existing-secret,
  and sealed-secret population modes plus `recipeConfig` consumers.
- Sealed secrets are applied via a dedicated pipeline step after publish
  and before deploy; secret values are never inlined into Bicep.
- Validation surfaces actionable ASPIRERADIUS040–055 diagnostics.

Recipe and secret parameters are unified with the existing container
env-var parameter registry so a parameter shared across both emits a
single Bicep `param` and one deploy binding; distinct parameters whose
names collide to the same identifier fail loudly (ASPIRERADIUS056)
rather than silently misbinding.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: f19583f4-384b-4601-a94b-290d9b0d4ed5
Nell Shamrell-Harrington (nellshamrell) added a commit to nellshamrell/aspire that referenced this pull request Jul 20, 2026
Second slice of the Aspire→Radius integration, layered on the merged
compute-environment baseline (microsoft#18696).

Recipe parameters (`WithRecipeParameters`):
- Flow environment-wide and resource-type-scoped values onto the recipe
  pack and legacy environment recipe entries.
- ParameterResource-backed values emit as valueless `@secure()` Bicep
  params bound at deploy time; provider references resolve at publish.
- ASPIRERADIUS028 guards recipe-parameter identifier collisions.

Secret management (gated behind experimental ASPIRERADIUS006):
- `AddRadiusSecretStore` / `WithSecretStore` with inline, existing-secret,
  and sealed-secret population modes plus `recipeConfig` consumers.
- Sealed secrets are applied via a dedicated pipeline step after publish
  and before deploy; secret values are never inlined into Bicep.
- Validation surfaces actionable ASPIRERADIUS040–055 diagnostics.

Recipe and secret parameters are unified with the existing container
env-var parameter registry so a parameter shared across both emits a
single Bicep `param` and one deploy binding; distinct parameters whose
names collide to the same identifier fail loudly (ASPIRERADIUS056)
rather than silently misbinding.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: f19583f4-384b-4601-a94b-290d9b0d4ed5
Nell Shamrell-Harrington (nellshamrell) added a commit to nellshamrell/aspire that referenced this pull request Jul 20, 2026
Second slice of the Aspire→Radius integration, layered on the merged
compute-environment baseline (microsoft#18696).

Recipe parameters (`WithRecipeParameters`):
- Flow environment-wide and resource-type-scoped values onto the recipe
  pack and legacy environment recipe entries.
- ParameterResource-backed values emit as valueless `@secure()` Bicep
  params bound at deploy time; provider references resolve at publish.
- ASPIRERADIUS028 guards recipe-parameter identifier collisions.

Secret management (gated behind experimental ASPIRERADIUS006):
- `AddRadiusSecretStore` / `WithSecretStore` with inline, existing-secret,
  and sealed-secret population modes plus `recipeConfig` consumers.
- Sealed secrets are applied via a dedicated pipeline step after publish
  and before deploy; secret values are never inlined into Bicep.
- Validation surfaces actionable ASPIRERADIUS040–055 diagnostics.

Recipe and secret parameters are unified with the existing container
env-var parameter registry so a parameter shared across both emits a
single Bicep `param` and one deploy binding; distinct parameters whose
names collide to the same identifier fail loudly (ASPIRERADIUS056)
rather than silently misbinding.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: f19583f4-384b-4601-a94b-290d9b0d4ed5
Nell Shamrell-Harrington (nellshamrell) added a commit to nellshamrell/aspire that referenced this pull request Jul 27, 2026
Second slice of the Aspire→Radius integration, layered on the merged
compute-environment baseline (microsoft#18696).

Recipe parameters (`WithRecipeParameters`):
- Flow environment-wide and resource-type-scoped values onto the recipe
  pack and legacy environment recipe entries.
- ParameterResource-backed values emit as valueless `@secure()` Bicep
  params bound at deploy time; provider references resolve at publish.
- ASPIRERADIUS028 guards recipe-parameter identifier collisions.

Secret management (gated behind experimental ASPIRERADIUS006):
- `AddRadiusSecretStore` / `WithSecretStore` with inline, existing-secret,
  and sealed-secret population modes plus `recipeConfig` consumers.
- Sealed secrets are applied via a dedicated pipeline step after publish
  and before deploy; secret values are never inlined into Bicep.
- Validation surfaces actionable ASPIRERADIUS040–055 diagnostics.

Recipe and secret parameters are unified with the existing container
env-var parameter registry so a parameter shared across both emits a
single Bicep `param` and one deploy binding; distinct parameters whose
names collide to the same identifier fail loudly (ASPIRERADIUS056)
rather than silently misbinding.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: f19583f4-384b-4601-a94b-290d9b0d4ed5
Mitch Denny (mitchdenny) pushed a commit that referenced this pull request Aug 10, 2026
* Add Radius recipe parameters and secret management

Second slice of the Aspire→Radius integration, layered on the merged
compute-environment baseline (#18696).

Recipe parameters (`WithRecipeParameters`):
- Flow environment-wide and resource-type-scoped values onto the recipe
  pack and legacy environment recipe entries.
- ParameterResource-backed values emit as valueless `@secure()` Bicep
  params bound at deploy time; provider references resolve at publish.
- ASPIRERADIUS028 guards recipe-parameter identifier collisions.

Secret management (gated behind experimental ASPIRERADIUS006):
- `AddRadiusSecretStore` / `WithSecretStore` with inline, existing-secret,
  and sealed-secret population modes plus `recipeConfig` consumers.
- Sealed secrets are applied via a dedicated pipeline step after publish
  and before deploy; secret values are never inlined into Bicep.
- Validation surfaces actionable ASPIRERADIUS040–055 diagnostics.

Recipe and secret parameters are unified with the existing container
env-var parameter registry so a parameter shared across both emits a
single Bicep `param` and one deploy binding; distinct parameters whose
names collide to the same identifier fail loudly (ASPIRERADIUS056)
rather than silently misbinding.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: f19583f4-384b-4601-a94b-290d9b0d4ed5

* Harden Radius sealed-secret handling from code-review findings

Address four findings from the code review of the sealed-secret path:

- Replace the regex/line-oriented SealedSecret manifest validator with a
  YamlDotNet parser. Reject duplicate keys, multi-document/non-mapping roots,
  anchors/aliases/merge keys, top-level data/stringData, and non-empty
  spec.template.data so a plaintext Kubernetes Secret can no longer be smuggled
  past validation into published artifacts or applied to a cluster.
- Close the validate/copy TOCTOU: read and validate the manifest once, carry the
  validated bytes, and write those exact bytes into the artifact instead of
  re-reading the source file.
- Gate the deploy-time materialization wait on the SealedSecret's status
  (observedGeneration match + Synced=True) before confirming the Secret, so a
  redeploy no longer proceeds with a stale Secret. Fast-fail on Synced=False or
  generation advance, enforce a per-probe remaining-time budget, and fail with
  ASPIRERADIUS058 on timeout. Raw kubectl -o json output is never logged.
- Fail closed (ASPIRERADIUS059) when the active rad workspace's Kubernetes
  context cannot be resolved, instead of silently using kubectl's ambient
  context, with an ASPIRE_RADIUS_KUBE_CONTEXT override escape hatch.

Update the README diagnostics table (broaden 044; add 058/059) and add tests.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: ddaf7f6d-b633-4b7e-9578-ec5b40e3c8e9

* Rename secret-store population methods to With* and fix stale diagnostic doc

Address review feedback on the Radius secret-store API:

- Rename FromExistingSecret/FromSealedSecret to WithExistingSecret/
  WithSealedSecret so the configuration methods follow Aspire's With*
  convention (they configure an existing resource builder). Update all call
  sites, XML docs, validation messages, README examples, and tests.
- Remove the retired ASPIRERADIUS046 entry from the README diagnostics table;
  its "sealed Secret never materialized before deploy" meaning is now covered
  by the status-gated ASPIRERADIUS058.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: ddaf7f6d-b633-4b7e-9578-ec5b40e3c8e9

* Address Radius secret-store design-review findings

Fixes five design findings surfaced by architecture/hosting/api reviews on
the Radius recipe & secret-store surface:

1. Gateway TLS (WithTlsCertificate) now fails loud instead of silently
   dropping: rejected at the validation gate (ASPIRERADIUS060), with a
   defensive throw at emission.
2. Remove the unusable WithTerraformProviderSecret API (and its enum member,
   ASPIRERADIUS053 validation, emission case, test, and README refs).
3. Restrict WithMaterializationTimeout to sealed stores: reject an explicit
   override on a non-sealed store (ASPIRERADIUS062).
4. Validate declared keys exist in the materialized sealed Secret at deploy
   (ASPIRERADIUS061); Secret values are never logged, only key names read.
5. ATS export conformance: add Reason to every [AspireExportIgnore] on the
   new Radius surface and [ResourceName] to the secret-store name params.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: ddaf7f6d-b633-4b7e-9578-ec5b40e3c8e9

* Address Copilot review feedback on Radius secret stores

- SealedSecretManifest.ValidateStructure: guard Stack.Pop() on MappingEnd/
  SequenceEnd so a malformed or out-of-sync YAML event stream fails as
  ASPIRERADIUS044 instead of escaping as a raw InvalidOperationException.
- README: use the modern canonical resource-type string Radius.Data/redisCaches
  in the recipe-parameter scoping example (matches WithRecipeParametersTests and
  RadiusResourceTypes.RedisCaches); Applications.Datastores/redisCaches is only
  the legacy fallback emission type.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: ddaf7f6d-b633-4b7e-9578-ec5b40e3c8e9

* Make sealed-secret timeout test deterministic (fix CI flake)

WaitForSealedSecretSynced_StatusMatchesButSecretAbsent_KeepsWaitingThenTimesOut
used a 10ms wall-clock timeout and asserted secretCalls > 1. On a loaded CI
runner a slow cold-JIT first iteration could consume the whole 10ms budget
before a second poll, so only one secretExists call happened and the assertion
failed. The probe now reports the Secret absent on the first call (so the loop
keeps waiting past one iteration) and hangs on the second so the SUT's
remaining-budget guard cancels it and surfaces the real ASPIRERADIUS058 timeout,
guaranteeing at least two polls regardless of runner speed.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: ddaf7f6d-b633-4b7e-9578-ec5b40e3c8e9

* Normalize manifest-path and apply-generation failures to Radius diagnostics

Address re-review feedback on PR #18778:

- SealedSecretManifest.ReadValidated: File.ReadAllBytes can throw
  ArgumentException (empty/whitespace/invalid-character path) and
  PathTooLongException, which previously escaped the catch filter without
  the ASPIRERADIUS044 wrapping promised by the XML-doc/README contract.
  Broaden the filter so every unreadable-manifest failure normalizes to
  ASPIRERADIUS044.

- SealedSecretApplyStep.ParseGeneration: the "did not return
  metadata.generation" throw omitted the SealedSecret/store identity and a
  diagnostic code. Thread the store name + namespace/name through and map
  the failure to ASPIRERADIUS058 for consistent triage.

Adds targeted tests for both paths.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: ddaf7f6d-b633-4b7e-9578-ec5b40e3c8e9

* Address code-review findings in Radius recipes + secrets

Fixes findings from code-review, rubber-duck, security, architecture, and
hosting-integration-authoring passes on the recipe-parameter and secret-store
work in Aspire.Hosting.Radius.

Secret handling:
- Reject plaintext `kind: Secret` embedded in a SealedSecret's
  last-applied-configuration annotation; fail closed on malformed/non-scalar
  annotation values and non-object data/stringData (ASPIRERADIUS063).
- Require an explicit metadata.namespace for application-scoped sealed stores so
  the namespace can't silently diverge per environment (ASPIRERADIUS055).
- Bound the kubectl apply/sync/verify sequence with a shared timeout budget
  (ASPIRERADIUS066); tolerate transient/NotFound `kubectl get sealedsecret`
  failures during polling instead of aborting the deploy.
- Reject key-specific envSecret consumers against keyless stores
  (ASPIRERADIUS064) and repeated population of a store (ASPIRERADIUS065);
  validate keys before mutating so a bad first key can't poison a retry.
- Fire the targeted duplicate-identifier diagnostic (ASPIRERADIUS048) for
  app-vs-env Bicep identifier collisions, matching the actual emission scope.

Recipe parameters:
- Convert ParameterResource/RadiusProviderReference nested inside recipe
  parameter objects/arrays recursively so they stay late-bound, with cycle and
  depth guards.

Cleanup:
- Remove the dead WithTlsCertificate/GatewayTls consumer API and stale
  gateway-TLS doc comments.

Adds unit tests for each finding and updates the README diagnostics table.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3

* Address PR #18834 review feedback for Radius secrets

Harden and tighten the Radius secret-store surface in response to Copilot
review comments:

- SealedSecretManifest: fail closed in EmbedsPlaintextSecret when the embedded
  last-applied-configuration has duplicate/missing/non-string kind or duplicate
  data/stringData, so a crafted payload cannot smuggle plaintext past a single
  TryGetProperty lookup.
- WithSealedSecret: resolve a relative manifest path against the AppHost
  directory (matching other hosting file APIs) so it works regardless of the
  process working directory.
- RadiusSecretStoreNaming: align the store-name grammar with Aspire's
  resource-name grammar (letters/digits/hyphens, start-with-letter, no
  consecutive/trailing hyphen, <=64) so publish mode (AddResource) never rejects
  a name run mode accepted. Update the ASPIRERADIUS049 message.
- WithData: add a single-key convenience overload binding a data key to a secret
  parameter, delegating transactionally to the callback form.
- SealedSecretApplyStep.GetSealedSecretStatusAsync: only treat SealedSecret
  NotFound or transient connectivity failures as retryable; surface permanent
  kubectl failures (auth/RBAC/context/missing plugin) immediately instead of
  waiting out the whole materialization budget.

Adds 22 targeted tests (357 total, all passing).

Co-authored-by: Copilot <[email protected]>
Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3

* Address Radius re-review: Terraform Git PAT key requirement, duplicate inline key rejection, existing-secret reference validation

Re-review of PR #18834 raised three additional findings on the Radius
secret-store surface:

- Terraform Git PAT auth now requires the referenced store to declare a
  'pat' key (optionally 'username'), matching what Radius reads for
  recipeConfig.terraform.authentication.git.pat, instead of accepting a
  basicAuthentication username/password store it cannot use (ASPIRERADIUS051).
- RadiusSecretStoreDataBuilder.Add rejects a duplicate inline key via TryAdd
  instead of silently overwriting through the dictionary indexer, so a
  double-declared key surfaces at the call site (ASPIRERADIUS043).
- WithExistingSecret validates the '[namespace/]name' reference at the API
  boundary (single separator, DNS-1123 name/namespace) rather than deferring
  a malformed reference to deploy time (ASPIRERADIUS046).

Adds targeted tests and updates the README diagnostics table and xmldoc.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3

* Address Radius re-review: rewire secret stores on rename, bound materialization timeout, validate sealed manifest names

A second re-review round on PR #18834 raised three findings:

- ConfigureRadiusInfrastructure exposes secret stores (opts.SecretStores), but
  the identifier snapshot/rewire logic ignored them. Renaming a store construct
  left recipeConfig referencing the old <identifier>.id, and renaming the legacy
  application/environment left the store's ApplicationId/EnvironmentId pointing at
  stale symbols. Extended IdentifierSnapshot and added RewireSecretStoreReferences
  to rewrite both consumer references and parent scope IDs.
- WithMaterializationTimeout accepted values above int.MaxValue milliseconds (e.g.
  TimeSpan.MaxValue) that CancellationTokenSource.CancelAfter / the deploy deadline
  cannot represent, so they passed publish validation but threw at deploy. Reject
  them at configuration time.
- SealedSecret manifest parsing accepted any nonblank metadata.name (e.g. Bad_Name,
  a/b, an overlong namespace), deferring the failure to kubectl apply. Validate the
  name as a DNS-1123 subdomain and any explicit namespace as a DNS-1123 label at
  publish time, mirroring the WithExistingSecret fast-fail.

Extracted the DNS-1123 helpers into a shared KubernetesName class and added tests
for all three findings.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3

* Address Radius PR re-review round B (R1-R6)

- WithExistingSecret validates reference and keys before marking the store
  populated so a corrected retry is not blocked by ASPIRERADIUS065 (R1).
- Reject secret data keys that are not valid Kubernetes Secret keys at the API
  boundary for inline/existing/sealed populations (ASPIRERADIUS067) (R2).
- rad workspace kube-context fallback now returns the single distinct context
  only; multiple contexts fail closed instead of guessing (R3).
- Application-scoped store declared without any Radius environment now fails fast
  via a store-registered pipeline gate (ASPIRERADIUS068) (R4).
- Add remarks/example xmldoc to AddRadiusSecretStore and WithRecipeParameters (R5/R6).

Co-authored-by: Copilot <[email protected]>
Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3

* Address Radius PR re-review rounds B2/B3 (N1-N8)

- IsValidSecretDataKey now matches apimachinery IsConfigMapKey semantics:
  reject keys >253 chars, '.'/'..', and keys starting with '..' (N1).
- IsTransientKubectlFailure no longer treats permanent x509 TLS trust failures
  as retryable; they fail fast instead of polling to the sync timeout (N2).
- Secret-store validation test uses Directory.CreateTempSubdirectory (N3).
- SealedSecret manifest requires the exact bitnami.com/v1alpha1 group/version
  instead of a bitnami.com/ prefix (N4).
- Embedded SealedSecret in last-applied-configuration is now validated
  recursively for plaintext spec.template.data/stringData (ASPIRERADIUS063) (N5).
- Recipe-parameter Merge validates all keys before applying (transactional) (N6).
- Deploy-parameters test now exercises the production WriteDeployParametersFile
  helper and asserts the owner-only ARM JSON file contract (N7).
- README secret-store diagnostics range lists only secret-store codes and notes
  056/057 are separate and 053/054/060 retired (N8).

Co-authored-by: Copilot <[email protected]>
Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3

* Parse rad workspace config with YamlDotNet in SealedSecretApplyStep

The hand-rolled line/regex parser in ParseActiveWorkspaceContext did not
honor real YAML syntax, so valid rad configs (trailing inline comments on
values such as `default: prod # active`, quoted mapping keys, or flow-style
mappings) failed to resolve the active workspace context and aborted every
SealedSecret deployment with ASPIRERADIUS059 unless the override was set.

Parse ~/.rad/config.yaml with YamlDotNet (already a dependency), reading
workspaces.default then workspaces.items.<default>.connection.context, and
keep the fail-closed behavior for missing/ambiguous values (default present
but context missing -> null; no default -> single distinct context only).

Co-authored-by: Copilot <[email protected]>
Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3

* Address PR review feedback on Radius secret stores

- SealedSecret apply: close TOCTOU by streaming the exact validated
  manifest bytes to `kubectl apply -f -` over stdin instead of
  re-reading the (mutable) manifest path.
- Reject uppercase inline secret-store names: the name is used verbatim
  as the backing Kubernetes Secret name (DNS-1123), so require lowercase
  to fail fast at the API/publish boundary instead of at deploy.
- ASPIRERADIUS067: include the 253-char limit and `.`/`..` prefix
  restrictions in the invalid-secret-data-key message.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: a79a2e75-6c34-40f1-8b75-dcd5ca8b2b16

* Address PR re-review on Radius sealed-secret deploy/publish

- SecretExistsAsync: treat transient connectivity/apiserver failures as
  "keep polling" (like the status probe) so a brief blip after
  Synced=True no longer aborts an otherwise healthy deploy. Refactored
  to an injectable overload and added unit coverage.
- RunKubectlAsync: stream stdin inside the same cancellation handler as
  WaitForExitAsync so a cancel while writing/flushing stdin terminates
  the kubectl process tree instead of leaking it.
- CopySealedSecretManifests: clear the integration-owned sealed-secrets
  subtree before writing so republishing after a store is removed or
  renamed no longer retains obsolete encrypted manifests.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: a79a2e75-6c34-40f1-8b75-dcd5ca8b2b16

* Validate spec.encryptedData in SealedSecret manifests

A SealedSecret with a missing, scalar, empty, or plaintext-looking
spec.encryptedData previously passed publish validation and was copied
verbatim into the artifact, even though that path promises a structurally
valid encrypted manifest.

Require spec to be a mapping containing a non-empty spec.encryptedData
mapping whose values are non-empty standard-base64 scalars, failing with
ASPIRERADIUS044. The gate runs after the existing plaintext and
last-applied-configuration leak checks so a leaking manifest still reports
the more specific ASPIRERADIUS063.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 8674d1f9-7353-40df-b64d-31803c6dbdd3

---------

Co-authored-by: Copilot <[email protected]>
Copilot-Session: f19583f4-384b-4601-a94b-290d9b0d4ed5
Copilot-Session: ddaf7f6d-b633-4b7e-9578-ec5b40e3c8e9
Copilot-Session: b76dc20d-c553-47b7-8f5e-6fcdc0f10aa3
Copilot-Session: a79a2e75-6c34-40f1-8b75-dcd5ca8b2b16
Copilot-Session: 8674d1f9-7353-40df-b64d-31803c6dbdd3
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-integrations Issues pertaining to Aspire Integrations packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants