fix: allow workspace create with unverifiable Radius Core environments#11797
Open
wahajahmed010 wants to merge 1 commit intoradius-project:mainfrom
Open
fix: allow workspace create with unverifiable Radius Core environments#11797wahajahmed010 wants to merge 1 commit intoradius-project:mainfrom
wahajahmed010 wants to merge 1 commit intoradius-project:mainfrom
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>
Contributor
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 { | |||
Comment on lines
106
to
110
| // 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) | ||
| }, |
Contributor
|
@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? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.