Skip to content

fix: allow workspace create with unverifiable Radius Core environments#11797

Closed
wahajahmed010 wants to merge 1 commit into
radius-project:mainfrom
wahajahmed010:fix/11670-workspace-core-env-check
Closed

fix: allow workspace create with unverifiable Radius Core environments#11797
wahajahmed010 wants to merge 1 commit into
radius-project:mainfrom
wahajahmed010:fix/11670-workspace-core-env-check

Conversation

@wahajahmed010
Copy link
Copy Markdown

Description

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 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 --environment and pass the environment later via rad deploy -e.

Changes

  • pkg/cli/cmd/workspace/create/create.go: Changed GetEnvironment error from fatal clierrors.Message to r.Output.LogInfo warning
  • pkg/cli/cmd/workspace/create/create_test.go: Updated test expectations — workspace create now succeeds even when environment can't be verified

Fixes

Fixes #11670

Checklist

  • Updated unit tests
  • Verified fix matches existing user workaround
  • Disclosed AI-assisted contribution

This contribution was prepared with AI assistance.

…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>
Copilot AI review requested due to automatic review settings May 1, 2026 22:59
@wahajahmed010 wahajahmed010 requested review from a team as code owners May 1, 2026 22:59
@wahajahmed010 wahajahmed010 requested a deployment to external-contributor-approval May 1, 2026 22:59 — with GitHub Actions Waiting
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 GetEnvironment validation failure from a fatal validation error to a warning log during workspace 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)
},
@Reshrahim
Copy link
Copy Markdown
Contributor

Reshrahim commented May 4, 2026

@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.

  1. Workspace should be created with the new Radius.Core/environments via rad workspace create --preview for backward compatibility . Here is an example on how this done on environments
  2. All configuration options are supported with rad workspace create --preview
  3. Documentation are updated.

Can you take a look at this and update the fix?

@brooke-hamilton
Copy link
Copy Markdown
Member

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to create workspaces with Radius.Core/environments

4 participants