fix: allow workspace create with unverifiable Radius Core environments#11797
fix: allow workspace create with unverifiable Radius Core environments#11797wahajahmed010 wants to merge 1 commit into
Conversation
…oject#11670) When creating a workspace with --environment, the Validate method queries the environment via GetEnvironment to confirm it exists. For Radius Core environments created with rad env create --preview, the validation client (v20231001preview) cannot always query these environments, causing a false 'does not exist' error. This fix changes the environment validation from a fatal error to a warning log, matching the existing workaround where users create workspaces without --environment and pass the environment later via rad deploy -e. Fixes radius-project#11670 Signed-off-by: wahajahmed010 <wahajahmed010@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates rad workspace create validation so that an environment specified via --environment no longer blocks workspace creation when the CLI cannot verify the environment (notably for Radius Core environments created with rad env create --preview), aligning with the documented workaround of setting the environment later.
Changes:
- Downgrade
GetEnvironmentvalidation failure from a fatal validation error to a warning log duringworkspace create. - Update unit test expectations so validation succeeds even when the environment lookup fails.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/cli/cmd/workspace/create/create.go | Changes environment existence validation to log a warning instead of failing workspace creation. |
| pkg/cli/cmd/workspace/create/create_test.go | Updates validation test case to expect success when environment cannot be verified. |
| @@ -195,7 +195,11 @@ func (r *Runner) Validate(cmd *cobra.Command, args []string) error { | |||
|
|
|||
| _, err = client.GetEnvironment(cmd.Context(), env) | |||
| if err != nil { | |||
| // Resource group exists but environment does not | ||
| // (workspace create now logs a warning instead of failing) | ||
| mocks.ApplicationManagementClient.EXPECT().GetResourceGroup(gomock.Any(), "local", "rg1").Return(ucp.ResourceGroupResource{}, nil).Times(1) | ||
| mocks.ApplicationManagementClient.EXPECT().GetEnvironment(gomock.Any(), "env1").Return(corerp.EnvironmentResource{}, errors.New("environment does not exist")).Times(1) | ||
| }, |
|
@wahajahmed010 - Thanks for the interest. We want to make sure the workspace command works with new environments Radius.Core/environments as they will be replacing the Application.Core/environments.
Can you take a look at this and update the fix? |
|
@wahajahmed010 we are closing this due to a lack of response, but please feel free to re-open if you want to continue working on the PR. Thank you for the contribution! |
Description
When creating a workspace with
--environment, theValidatemethod queries the environment viaGetEnvironmentto confirm it exists. For Radius Core environments created withrad env create --preview, the validation client (v20231001preview) cannot always query these environments, causing a false "does not exist" error that blocks workspace creation.This fix changes the environment validation from a fatal error to a warning log, matching the existing workaround where users create workspaces without
--environmentand pass the environment later viarad deploy -e.Changes
pkg/cli/cmd/workspace/create/create.go: ChangedGetEnvironmenterror from fatalclierrors.Messagetor.Output.LogInfowarningpkg/cli/cmd/workspace/create/create_test.go: Updated test expectations — workspace create now succeeds even when environment can't be verifiedFixes
Fixes #11670
Checklist
This contribution was prepared with AI assistance.