Repository navigation
rad init --preview should be able to work with radius.core environments. - #11639
Conversation
Codecov Report❌ Patch coverage is 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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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 --previewrunner + sharedradinit/commonhelpers for cluster/cloud/app prompts. - Introduces a
pkg/cli/recipepackhelper 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. |
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>
Radius functional test overviewClick here to see the test run details
Test Status⌛ Building Radius and pushing container images for functional tests... |
…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>
…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>
Description
rad init --preview(new init flow) and wires it into the CLI, while preserving existingrad initbehavior.rad env update --preview --recipe-packsto replace the environment recipe pack list (supports comma-separated values) and adds tests.rad initprompt logic intopkg/cli/cmd/radinit/commonand adds coverage for the extracted helpers.Type of change
Fixes: #11490
Contributor checklist
Please verify that the PR meets the following requirements, where applicable: