Repository navigation
refactor(cli)!: remove unused --preview helpers and stale preview wording - #13326
Conversation
Signed-off-by: lakshmimsft <ljavadekar@microsoft.com>
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Radius functional test overviewClick here to see the test run details
Test Status⌛ Building Radius and pushing container images for functional tests... |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #13326 +/- ##
==========================================
+ Coverage 60.27% 60.35% +0.07%
==========================================
Files 748 748
Lines 44255 44129 -126
==========================================
- Hits 26676 26634 -42
+ Misses 17579 17495 -84 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟢 Approval recommended
The cleanup matches the documented behavior changes, and static review identified no blocking defects.
No open issues 🎉
What changed in this PR
Completes the CLI preview cleanup for #11803 after earlier commands moved to Radius.* defaults.
Changes:
- Removes
rad deploy --previewandRADIUS_PREVIEW; application types now follow environment types. - Consolidates diagnostics clients and removes unreachable legacy paths.
- Renames shared helpers, removes unused validators, and updates tests and script configuration.
| File | Description |
|---|---|
pkg/cli/prompt/validator.go |
Removes unused application-name validation. |
pkg/cli/deployment/diagnostics.go |
Removes legacy container diagnostics. |
pkg/cli/deployment/diagnostics_test.go |
Updates diagnostics tests. |
pkg/cli/connections/mock_factory.go |
Removes duplicate diagnostics constructor. |
pkg/cli/connections/factory.go |
Consolidates diagnostics construction. |
pkg/cli/cmd/workspace/create/create.go |
Uses shared environment ID helper. |
pkg/cli/cmd/resource/list/list.go |
Uses shared resource ID helpers. |
pkg/cli/cmd/resource/list/list_test.go |
Renames an environment ID constant. |
pkg/cli/cmd/env/update/update_test.go |
Removes stale preview flag descriptions. |
pkg/cli/cmd/env/delete/delete.go |
Uses renamed helpers and message constants. |
pkg/cli/cmd/env/delete/cascade_test.go |
Updates message constant references. |
pkg/cli/cmd/deploy/deploy.go |
Removes preview-based application selection. |
pkg/cli/cmd/deploy/deploy_test.go |
Removes obsolete preview tests. |
pkg/cli/cmd/deleteorder_test.go |
Updates test case names. |
pkg/cli/cmd/cascadedelete.go |
Renames file and shared helpers. |
pkg/cli/cmd/cascadedelete_test.go |
Updates helper tests. |
pkg/cli/cmd/app/status/status.go |
Uses shared application ID helper. |
pkg/cli/cmd/app/delete/delete.go |
Uses renamed application ID helper. |
pkg/cli/clivalidation.go |
Removes unused environment-name validation. |
cmd/rad/cmd/root.go |
Removes preview dispatch helpers. |
cmd/rad/cmd/root_test.go |
Adds deploy flag-registration coverage. |
cmd/rad/cmd/resourceLogs.go |
Uses consolidated diagnostics constructor. |
cmd/rad/cmd/resourceExpose.go |
Uses consolidated diagnostics constructor. |
.github/scripts/test-repo-radius-state-e2e.sh |
Removes obsolete preview environment variable. |
Review effort: Balanced
brooke-hamilton
left a comment
There was a problem hiding this comment.
No actionable findings in the reviewed changes. Targeted unit tests could not run because this checkout requires Go 1.27.2, the installed toolchain is 1.27.0, and automatic toolchain verification failed offline. No live-cluster tests were run.
Summary
Removes the remaining
--previewplumbing from theradCLI, and the code paths that #13306, #13316, #13317 and #13319 made unreachable.rad deploy: removes the--previewflag andRADIUS_PREVIEWsupport. The application type now always follows the environment type: aRadius.Core/environmentsenvironment gets aRadius.Core/applicationsapplication, and anApplications.Core/environmentsenvironment gets anApplications.Core/applicationsapplication.wirePreviewSubcommand,resolveUsePreviewandwithPreviewEnvVarNote, plus their tests. No command uses them any more.Applications.Core/containerspath fromARMDiagnosticsClient: thePreviewflag, theApplicationClient,ContainerClientandEnvironmentClientfields, the legacyfindNamespaceOfContainer, andgetAppContainerName. Since feat(cli)!: make rad resource expose and logs target Radius.Compute/containers without --preview #13319,rad resource logsandrad resource exposeaccept onlyRadius.Compute/containers, so nothing reached this path.CreateDiagnosticsClientPreviewintoCreateDiagnosticsClientand removes it from theconnections.Factoryinterface andMockFactory.GetPublicEndpoint, used byrad app statusand deploy progress, is unchanged.cli.RequireEnvironmentName,prompt.ValidateApplicationNameand its message constant.deadcodereported them as unreachable, and nothing calls them, including tests.cmd.PreviewResourceID,PreviewApplicationID,PreviewEnvironmentIDandListPreviewApplicationsInEnvironmentbecomecmd.ResourceID,ApplicationID,EnvironmentIDandListApplicationsInEnvironment.pkg/cli/cmd/previewdelete.gobecomescascadedelete.go.rad app status,rad workspace createandrad resource listnow call these helpers, and the privateresourceIDhelper inrad resource listis removed.export RADIUS_PREVIEW=truefrom.github/scripts/test-repo-radius-state-e2e.sh. The script creates its environment withrad env create, so its deploys still produceRadius.Coreapplications.Test_Deploy_RegisteredWithoutPreviewchecks thatrad deployhas no--previewflag and still registers every flag its runner reads.Breaking changes
rad deploy --previewfails withunknown flag: --preview.RADIUS_PREVIEWis no longer read by anyradcommand.rad deploy -a <app>into anApplications.Core/environmentsenvironment always creates anApplications.Core/applicationsapplication. Before,--previeworRADIUS_PREVIEW=truecreated aRadius.Core/applicationsapplication pointing at the legacy environment.Cross-repo follow-ups:
radius-project/ai-extensions: remaining--previewusages are removed in (DO NOT MERGE) chore: drop --preview from rad cli commands ai-extensions#1022.radius-project/docs: therad deployCLI reference page is regenerated from this help text. The release note should list the breaking changes above.Reason for change
Part of #11803. Earlier PRs in the series made
Radius.Corethe default forrad env,rad app,rad init,rad workspace create,rad resource list,rad resource exposeandrad resource logs. This PR removes the last--previewflag (onrad deploy) and deletes the duplicate legacy code paths and preview-named helpers those PRs left behind.How to test
Prerequisites:
kubectlcontext.Radius.Coreenvironment nameddefault, and anapp.bicepthat declares aRadius.Compute/containersresource namedwebin an application nameddemo.Build the CLI from this branch:
Run the commands:
$RAD deploy app.bicep -a demo -e defaultRadius.Core/applications/demoand deploys it$RAD deploy app.bicep -a demo -e default --previewunknown flag: --previewRADIUS_PREVIEW=true $RAD deploy --help--previewflag and noRADIUS_PREVIEWnote$RAD app status demo$RAD resource logs Radius.Compute/containers web -a demowebcontainer$RAD resource expose Radius.Compute/containers web -a demo --port 5000 --remote-port 80$RAD app delete demo -yRun the unit tests and lint. They pass:
go test ./cmd/rad/... ./pkg/cli/... golangci-lint run ./cmd/rad/... ./pkg/cli/...File change summary
cmd/rad/cmd/root.go,root_test.goTest_Deploy_RegisteredWithoutPreviewcmd/rad/cmd/resourceExpose.go,resourceLogs.goCreateDiagnosticsClientpkg/cli/cmd/deploy/deploy.go,deploy_test.go--previewandRADIUS_PREVIEW; the application type follows the environment typepkg/cli/deployment/diagnostics.go,diagnostics_test.goRadius.Compute/containersonlypkg/cli/connections/factory.go,mock_factory.gopkg/cli/cmd/previewdelete.go→cascadedelete.go(and test)pkg/cli/cmd/app/delete/delete.go,env/delete/delete.go,env/delete/cascade_test.gopkg/cli/cmd/app/status/status.go,workspace/create/create.go,resource/list/list.go,list_test.gopkg/cli/clivalidation.go,pkg/cli/prompt/validator.goRequireEnvironmentNameandValidateApplicationNamepkg/cli/cmd/deleteorder_test.go,env/update/update_test.go.github/scripts/test-repo-radius-state-e2e.shRADIUS_PREVIEW=true