Skip to content

rad init --preview should be able to work with radius.core environments. - #11639

Merged
nithyatsu merged 47 commits into
radius-project:mainfrom
nithyatsu:working
May 5, 2026
Merged

nithyatsu merged 47 commits into
radius-project:mainfrom
nithyatsu:working

Conversation

@nithyatsu

@nithyatsu nithyatsu commented Apr 14, 2026 •

Copy link
Copy Markdown
Contributor

Description

  • Adds rad init --preview (new init flow) and wires it into the CLI, while preserving existing rad init behavior.
  • Implements Radius.Core environment creation/selection in preview init
  • Updates rad env update --preview --recipe-packs to replace the environment recipe pack list (supports comma-separated values) and adds tests.
  • Refactors shared rad init prompt logic into pkg/cli/cmd/radinit/common and adds coverage for the extracted helpers.
  • updated rad deploy to create and inject default recipepack for any radius.core environment which dont have any recipepack.
  • fixed rad env update to take a comma seperated list of recipepacks , than using update to only add a pack incrementally.

Type of change

  • This pull request adds or changes features of Radius and has an approved issue (issue link required).

Fixes: #11490

Contributor checklist

Please verify that the PR meets the following requirements, where applicable:

  • An overview of proposed schema changes is included in a linked GitHub issue.
    • Yes
    • Not applicable
  • A design document PR is created in the design-notes repository, if new APIs are being introduced.
    • Yes
    • Not applicable
  • The design document has been reviewed and approved by Radius maintainers/approvers.
    • Yes
    • Not applicable
  • A PR for the samples repository is created, if existing samples are affected by the changes in this PR.
    • Yes
    • Not applicable
  • A PR for the documentation repository is created, if the changes in this PR affect the documentation or any user facing updates are made.
    • Yes
    • Not applicable
  • A PR for the recipes repository is created, if existing recipes are affected by the changes in this PR.
    • Yes
    • Not applicable

@nithyatsu
nithyatsu had a problem deploying to external-contributor-approval April 14, 2026 00:32 — with GitHub Actions Failure
@codecov

codecov Bot commented Apr 14, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 40.76577% with 789 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.06%. Comparing base (21ead27) to head (5ee7e48).

Files with missing lines Patch % Lines
pkg/cli/test_client_factory/radius_core.go 0.00% 189 Missing ⚠️
pkg/cli/cmd/radinit/common/display.go 0.00% 165 Missing ⚠️
pkg/cli/cmd/radinit/common/azure.go 0.00% 153 Missing ⚠️
pkg/cli/cmd/radinit/common/aws.go 0.00% 84 Missing ⚠️
pkg/cli/cmd/radinit/preview/environment.go 67.33% 30 Missing and 19 partials ⚠️
pkg/cli/cmd/radinit/preview/init.go 77.77% 29 Missing and 9 partials ⚠️
pkg/cli/cmd/radinit/common/cloud.go 42.42% 17 Missing and 2 partials ⚠️
pkg/cli/cmd/deploy/deploy.go 63.04% 11 Missing and 6 partials ⚠️
pkg/cli/recipepack/recipepack.go 64.44% 16 Missing ⚠️
pkg/cli/cmd/radinit/common/application.go 65.51% 5 Missing and 5 partials ⚠️
... and 11 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11639      +/-   ##
==========================================
- Coverage   51.46%   51.06%   -0.40%     
==========================================
  Files         699      715      +16     
  Lines       44130    44940     +810     
==========================================
+ Hits        22710    22949     +239     
- Misses      19255    19817     +562     
- Partials     2165     2174       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nithyatsu
nithyatsu marked this pull request as ready for review April 23, 2026 15:44
@nithyatsu
nithyatsu requested a review from a team as a code owner April 23, 2026 15:44
Copilot AI review requested due to automatic review settings April 23, 2026 15:44
@nithyatsu
nithyatsu requested a review from a team as a code owner April 23, 2026 15:44
@nithyatsu
nithyatsu marked this pull request as draft April 23, 2026 15:44

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 --preview implementation path for rad init (and supporting plumbing) to target Radius.Core environments, including default recipe pack creation/injection and shared radinit prompting logic.

Changes:

  • Adds rad init --preview runner + shared radinit/common helpers for cluster/cloud/app prompts.
  • Introduces a pkg/cli/recipepack helper to create/ensure the default recipe pack and uses it from env create/deploy flows.
  • Updates env update recipe-pack semantics (replace list) and expands the test client factory to support new scenarios.

Reviewed changes

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

Show a summary per file
File Description
test/functional-portable/cli/noncloud/cli_test.go Removes a dev-recipe functional test and related imports.
pkg/cli/test_client_factory/radius_core.go Extends fake Core RP servers (env/recipe packs) for new test scenarios.
pkg/cli/recipepack/recipepack.go Adds helpers for default recipe pack IDs/resources and ensure/create logic.
pkg/cli/recipepack/recipepack_test.go Adds unit tests for default recipe pack generation.
pkg/cli/cmd/utils.go Adds helper to populate recipe-pack clients by scope.
pkg/cli/cmd/utils_test.go Adds tests for recipe-pack client population.
pkg/cli/cmd/radinit/preview/options.go Adds interactive init options gathering for preview runner.
pkg/cli/cmd/radinit/preview/init.go Adds rad init --preview command/runner wiring and execution flow.
pkg/cli/cmd/radinit/preview/init_test.go Adds extensive validation/run tests for preview init.
pkg/cli/cmd/radinit/preview/environment.go Implements preview environment creation using Radius.Core APIs + default recipe pack.
pkg/cli/cmd/radinit/preview/display.go Adds preview TUI summary/progress display.
pkg/cli/cmd/radinit/preview/cluster.go Delegates cluster option selection to common helpers.
pkg/cli/cmd/radinit/preview/cloud.go Delegates cloud provider selection to common helpers.
pkg/cli/cmd/radinit/preview/azure.go Implements Azure provider prompting for preview init.
pkg/cli/cmd/radinit/preview/aws.go Implements AWS provider prompting for preview init.
pkg/cli/cmd/radinit/preview/application.go Delegates application scaffolding prompts to common helpers.
pkg/cli/cmd/radinit/preview/application_test.go Tests preview application prompt flow.
pkg/cli/cmd/radinit/common/cluster.go New shared cluster selection/install-state helper code.
pkg/cli/cmd/radinit/common/cluster_test.go Tests for shared cluster helpers.
pkg/cli/cmd/radinit/common/cloud.go New shared cloud-provider prompt flow.
pkg/cli/cmd/radinit/common/cloud_test.go Tests for shared cloud-provider flow.
pkg/cli/cmd/radinit/common/application.go New shared application scaffold/name selection flow.
pkg/cli/cmd/radinit/common/application_test.go Tests for shared application helpers.
pkg/cli/cmd/radinit/cluster.go Refactors legacy init cluster selection to use shared helpers.
pkg/cli/cmd/radinit/cloud.go Refactors legacy init cloud provider selection to use shared helpers.
pkg/cli/cmd/radinit/application.go Refactors legacy init application prompts to use shared helpers.
pkg/cli/cmd/env/update/preview/update.go Changes recipe-pack flag to “replace list” behavior and improves messaging.
pkg/cli/cmd/env/update/preview/update_test.go Updates/extends tests to validate recipe-pack replacement + warning output.
pkg/cli/cmd/env/create/preview/create.go Ensures default recipe pack exists and links it when creating an env.
pkg/cli/cmd/env/create/preview/create_test.go Expands tests around default recipe pack creation and error paths.
pkg/cli/cmd/deploy/deploy.go Injects default recipe pack into templates for Radius.Core environments when missing.
pkg/cli/cmd/deploy/deploy_test.go Adds tests covering recipe-pack injection behavior during deploy.
pkg/cli/bicep/resources.go Enhances template inspection to return Radius.Core environment resources.
cmd/rad/cmd/root.go Wires rad init preview routing via --preview.

Comment thread pkg/cli/cmd/radinit/preview/aws.go Resolved
Comment thread pkg/cli/recipepack/recipepack.go Resolved
Comment thread cmd/rad/cmd/root.go Resolved
Comment thread pkg/cli/cmd/utils_test.go Resolved
Comment thread pkg/cli/cmd/utils.go Resolved
Comment thread pkg/cli/cmd/radinit/preview/init.go Resolved
Comment thread pkg/cli/cmd/radinit/preview/display.go Resolved
Comment thread pkg/cli/cmd/radinit/preview/aws.go Resolved
@nithyatsu nithyatsu added the pr:important High-impact changes needing special attention during release and in release notes label Apr 23, 2026
@nithyatsu
nithyatsu marked this pull request as ready for review April 23, 2026 19:17
@nithyatsu nithyatsu changed the title rad init new + old env support with a --preview flag rad init --preview should be able to work with new environments and recipe pack. Apr 23, 2026
@nithyatsu nithyatsu changed the title rad init --preview should be able to work with new environments and recipe pack. rad init --preview should be able to work with radius.core environments. Apr 23, 2026
@brooke-hamilton
brooke-hamilton requested a review from Copilot April 27, 2026 13:31

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 34 out of 34 changed files in this pull request and generated 10 comments.

Comment thread pkg/cli/cmd/radinit/preview/options.go Resolved
Comment thread pkg/cli/cmd/radinit/preview/init.go Resolved
Comment thread pkg/cli/cmd/radinit/preview/display.go Resolved
Comment thread pkg/cli/cmd/radinit/preview/display.go Resolved
Comment thread pkg/cli/cmd/utils_test.go Resolved
Comment thread pkg/cli/bicep/resources.go Resolved
Comment thread pkg/cli/recipepack/recipepack.go Resolved
Comment thread pkg/cli/cmd/radinit/preview/display.go Resolved
Comment thread pkg/cli/cmd/radinit/preview/display.go Resolved
Comment thread pkg/cli/cmd/radinit/preview/init.go Resolved
Comment thread pkg/cli/cmd/radinit/preview/aws.go Resolved
@nithyatsu
nithyatsu requested review from kachawla and willtsai May 4, 2026 21:48
@nithyatsu
nithyatsu requested a review from a team as a code owner May 4, 2026 21:49
nithyatsu and others added 21 commits May 5, 2026 08:52
Signed-off-by: nithyatsu <nithyasu@microsoft.com>
Signed-off-by: nithyatsu <nithyasu@microsoft.com>
Signed-off-by: nithyatsu <nithyasu@microsoft.com>
Signed-off-by: nithyatsu <nithyasu@microsoft.com>
Signed-off-by: nithyatsu <nithyasu@microsoft.com>
Signed-off-by: nithyatsu <nithyasu@microsoft.com>
Signed-off-by: nithyatsu <nithyasu@microsoft.com>
Signed-off-by: nithyatsu <nithyasu@microsoft.com>
Signed-off-by: nithyatsu <nithyasu@microsoft.com>
Signed-off-by: nithyatsu <nithyasu@microsoft.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
@willtsai willtsai linked an issue May 5, 2026 that may be closed by this pull request
@radius-functional-tests

radius-functional-tests Bot commented May 5, 2026 •

Copy link
Copy Markdown

Radius functional test overview

🔍 Go to test action run

Click here to see the test run details
Name Value
Repository nithyatsu/radius
Commit ref 5ee7e48
Unique ID func3a852858eb
Image tag pr-func3a852858eb
  • gotestsum 1.13.0
  • KinD: v0.29.0
  • Dapr: 1.14.4
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func3a852858eb
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func3a852858eb
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func3a852858eb
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func3a852858eb
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func3a852858eb
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting ucp-cloud functional tests...
⌛ Starting corerp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

@nithyatsu
nithyatsu merged commit 1d1b316 into radius-project:main May 5, 2026
57 checks passed
Reshrahim pushed a commit to Reshrahim/radius that referenced this pull request Jun 15, 2026
…ts. (radius-project#11639)

# Description

- Adds `rad init --preview` (new init flow) and wires it into the CLI,
while preserving existing `rad init` behavior.
- Implements Radius.Core environment creation/selection in preview init
- Updates `rad env update --preview --recipe-packs` to replace the
environment recipe pack list (supports comma-separated values) and adds
tests.
- Refactors shared `rad init` prompt logic into
`pkg/cli/cmd/radinit/common` and adds coverage for the extracted
helpers.
- updated rad deploy to create and inject default recipepack for any
radius.core environment which dont have any recipepack.
- fixed rad env update to take a comma seperated list of recipepacks ,
than using update to only add a pack incrementally.

## Type of change

- This pull request adds or changes features of Radius and has an
approved issue (issue link required).

Fixes: [radius-project#11490 ](radius-project#11490)

## Contributor checklist
Please verify that the PR meets the following requirements, where
applicable:

- An overview of proposed schema changes is included in a linked GitHub
issue.
    - [ ] Yes <!-- TaskRadio schema -->
    - [x] Not applicable <!-- TaskRadio schema -->
- A design document PR is created in the [design-notes
repository](https://github.com/radius-project/design-notes/), if new
APIs are being introduced.
    - [ ] Yes <!-- TaskRadio design-pr -->
    - [x] Not applicable <!-- TaskRadio design-pr -->
- The design document has been reviewed and approved by Radius
maintainers/approvers.
    - [x] Yes <!-- TaskRadio design-review -->
    - [ ] Not applicable <!-- TaskRadio design-review -->
- A PR for the [samples
repository](https://github.com/radius-project/samples) is created, if
existing samples are affected by the changes in this PR.
    - [ ] Yes <!-- TaskRadio samples-pr -->
    - [x] Not applicable <!-- TaskRadio samples-pr -->
- A PR for the [documentation
repository](https://github.com/radius-project/docs) is created, if the
changes in this PR affect the documentation or any user facing updates
are made.
    - [ ] Yes <!-- TaskRadio docs-pr -->
    - [x] Not applicable <!-- TaskRadio docs-pr -->
- A PR for the [recipes
repository](https://github.com/radius-project/recipes) is created, if
existing recipes are affected by the changes in this PR.
    - [ ] Yes <!-- TaskRadio recipes-pr -->
    - [x] Not applicable <!-- TaskRadio recipes-pr -->

---------

Signed-off-by: nithyatsu <nithyasu@microsoft.com>
Co-authored-by: Copilot <copilot@github.com>
Signed-off-by: Reshma Abdul Rahim <reshmarahim.abdul@microsoft.com>
willtsai pushed a commit to zachcasper/radius that referenced this pull request Oct 20, 2026
…13325)

## Summary

Moves `pkg/cli/cmd/radinit/common` back into `pkg/cli/cmd/radinit` and
deletes the layer that connected them. No user-visible behavior changes:
every prompt, summary line and progress line is the same text.

- **Package moved:** `common/{aws,azure,cloud,cluster,display}.go`
replace the `radinit` shim files at the same paths, and
`pkg/cli/cmd/radinit/common` is deleted.
- **Shims removed:**
- `Runner.enterAWSCloudProvider`, `enterAzureCloudProvider`,
`enterCloudProviderOptions`, `enterClusterOptions`, `confirmOptions` and
`showProgress` now contain the logic directly instead of wrapping a
`common` function. The IRSA and workload-identity Helm values are set in
the matching credential branch.
  - The constant aliases in `cloud.go` are gone.
- **Duplicate types removed:**
- `ClusterResult` was a copy of `clusterOptions`, and
`CloudProviderResult` a copy of `cloudProviderOptions`.
- `DisplayOptions`, `ClusterDisplay`, `EnvironmentDisplay` and
`CloudProvidersDisplay` copied fields out of `initOptions`, and
`toDisplayOptions` filled them in. The summary and progress views now
read `initOptions` directly.
- The `AzureProviderFunc`/`AWSProviderFunc` callback types are gone.
They existed only because `common` couldn't import `radinit`.
- **Unexported:** the 90 identifiers that `common` exported (prompt text
constants, helper functions, the Bubble Tea models) are now
package-private. Nothing outside `radinit` used them. The Bubble Tea
model fields are lowercased too, and the tests carried over from
`common` now use radinit's lowercase naming (for example
`Test_selectCluster`). The renames were done with `gopls rename`.
- **Tests:**
- `common/cloud_test.go` is deleted: `Test_enterCloudProviderOptions`
already covers each of its cases.
- `common/cluster_test.go` is merged into `cluster_test.go`. Its two
`EnterClusterOptions` cases now run through `Runner` as subtests of
`Test_enterClusterOptions`.
- `common/display_test.go` is merged into `display_test.go`.
`Test_toDisplayOptions_ConfigFiles` is replaced by the existing view
tests, which now build `initOptions{BicepConfigDirectory: ...}`.
  - A duplicate `getTestKubeConfig` helper is removed.
- New: `Test_summaryModel_View_RecipePack` covers the recipe-pack line,
which used to come from `toDisplayOptions`.
`Test_enterAWSCloudProvider_*` now check the IRSA Helm value, which no
test asserted before.

## Reason for change

Part of radius-project#11803. `common` was split out in radius-project#11639 so the old `rad init`
and `rad init --preview` could share prompt and display code. radius-project#13316
removed `rad init --preview`, so `radinit` is the only consumer left.
That left about 230 lines of wrappers, constant aliases and translation
types that existed only to cross a package boundary nobody needs. This
PR restores the single-package shape `radinit` had before radius-project#11639.

## How to test

1. Run the unit tests:

   ```bash
   go test ./pkg/cli/cmd/radinit/... ./cmd/rad/...
   ```

2. Confirm nothing still imports the old package:

   ```bash
! git grep -n
'"github.com/radius-project/radius/pkg/cli/cmd/radinit/common"' --
'*.go'
   ```

3. Review tip: the moved files replace shim files at the same paths, so
GitHub shows them as rewrites rather than renames. To see what actually
changed in each moved file, diff it against its `common` original:

   ```bash
   for f in aws azure cloud cluster display; do
git diff -w origin/main:pkg/cli/cmd/radinit/common/$f.go
HEAD:pkg/cli/cmd/radinit/$f.go
   done
   ```

Apart from the lowercased names and the `package` line, the only changes
are the `Runner` receivers, the Helm `SetValues` lines, and
`initOptions` replacing `DisplayOptions`.

4. Optional: run `rad init --full` against a kind cluster and check that
the summary and progress screens look the same as before.

Validation run locally:

- `go build ./...`: passed
- `go vet -tags e2e ./test/...`: passed
- `go test ./cmd/rad/... ./pkg/cli/...`: passed
- `golangci-lint run ./pkg/cli/cmd/radinit/...`: 0 issues, so the
`unused` linter found no helper left dead by the fold.
- Mutation check: removing the IRSA `SetValues` line, or the recipe-pack
summary line, makes `Test_enterAWSCloudProvider_IRSA` or
`Test_summaryModel_View_RecipePack` fail.

## File change summary

| File | Summary of change |
| ---- | ----------------- |
| `pkg/cli/cmd/radinit/aws.go` | Replaced by `common/aws.go`.
`enterAWSCloudProvider` is a `Runner` method that sets the IRSA Helm
value; identifiers unexported |
| `pkg/cli/cmd/radinit/azure.go` | Replaced by `common/azure.go`.
`enterAzureCloudProvider` is a `Runner` method that sets the
workload-identity Helm value; identifiers unexported |
| `pkg/cli/cmd/radinit/cloud.go` | Replaced by `common/cloud.go`.
`enterCloudProviderOptions` writes to `options.CloudProviders`; result
and callback types removed |
| `pkg/cli/cmd/radinit/cluster.go` | Replaced by `common/cluster.go`.
`enterClusterOptions` writes to `options.Cluster`; `ClusterResult`
removed |
| `pkg/cli/cmd/radinit/display.go` | Replaced by `common/display.go`.
Views read `initOptions`; `DisplayOptions` types and `toDisplayOptions`
removed; `confirmOptions` and `showProgress` are `Runner` methods |
| `pkg/cli/cmd/radinit/init.go` | Drop the `common` import and
qualifiers |
| `pkg/cli/cmd/radinit/aws_test.go` | Drop `common.` qualifiers; assert
`SetValues` for access key (empty) and IRSA |
| `pkg/cli/cmd/radinit/azure_test.go` | Drop `common.` qualifiers |
| `pkg/cli/cmd/radinit/cloud_test.go` | Drop `common.` qualifiers |
| `pkg/cli/cmd/radinit/cluster_test.go` | Merge
`common/cluster_test.go`; installed and not-installed cases run through
`Runner` |
| `pkg/cli/cmd/radinit/display_test.go` | Merge
`common/display_test.go`; views built from `initOptions`; add
`Test_summaryModel_View_RecipePack` |
| `pkg/cli/cmd/radinit/init_test.go` | Drop `common.` qualifiers |
| `pkg/cli/cmd/radinit/common/*` | Deleted |

---------

Signed-off-by: lakshmimsft <ljavadekar@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:important High-impact changes needing special attention during release and in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support both new and old env with rad init using --preview flag Default Recipe Packs for K8s

4 participants