Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: wsbuilder: complete job and mark workspace deleted if no provisioners available#18465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
johnstcn wants to merge7 commits intomain
base:main
Choose a base branch
Loading
fromcj/delete-orphan-fake-complete-job

Conversation

johnstcn
Copy link
Member

@johnstcnjohnstcn commentedJun 19, 2025
edited
Loading

Alternate fix for#18080

Modifies wsbuilder to complete the provisioner job and mark the workspace as deleted if it is clear that no provisioner will be able to pick up the delete build.

This has a significant advantage of not deviating too much from the current semantics ofPOST /api/v2/workspacebuilds.#18460 ends up returning a 204 on orphan delete due to no build being created.

Downside is that we have to duplicate some responsibilities of provisionerdserver in wsbuilder.

@johnstcnjohnstcn marked this pull request as ready for reviewJune 20, 2025 10:17
@johnstcnjohnstcn requested a review fromCopilotJune 20, 2025 10:17
Copy link
Contributor

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

This PR ensures that when an orphan-delete request finds no active provisioners, the builder marks the provisioner job as completed and the workspace as deleted. It also adds the UI hook for orphan deletion, updates in-memory DB behavior, and expands tests to cover the new orphan scenarios.

  • AddcanOrphan flag and checkbox in the workspace delete dialog
  • Implement orphan-delete fallback in wsbuilder (complete job + delete workspace)
  • Expand unit and integration tests to cover orphan-delete paths

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
FileDescription
site/src/modules/workspaces/WorkspaceMoreActions/WorkspaceDeleteDialog.tsxExtractcanOrphan and render orphan checkbox with updated text
coderd/wsbuilder/wsbuilder.goOrphan-delete logic: complete provisioner job and mark workspace deleted when no provisioners available
coderd/wsbuilder/wsbuilder_test.goNew tests for orphan-delete with and without available provisioners
coderd/workspacebuilds.goUseqpr variable to pass provisioner job info into conversion
coderd/workspacebuilds_test.goImportdbfake and add subtests for orphan build errors and permissions
coderd/database/dbmem/dbmem.goReturn empty slice instead ofsql.ErrNoRows for no provisioner daemons
cli/delete_test.goUpdate CLI delete test to cover--orphan behavior and status codes
Comments suppressed due to low confidence (2)

site/src/modules/workspaces/WorkspaceMoreActions/WorkspaceDeleteDialog.tsx:53

  • [nitpick] Add frontend tests to verify that the "Orphan Resources" checkbox appears only whencanOrphan is true and is hidden otherwise.
const canOrphan =

coderd/wsbuilder/wsbuilder.go:495

  • Implement or remove the TODO for audit baggage so that delete transitions are properly logged in the audit system.
// TODO: audit baggage?

Comment on lines -374 to -378
client:=coderdtest.New(t,&coderdtest.Options{IncludeProvisionerDaemon:true})
first:=coderdtest.CreateFirstUser(t,client)

ctx,cancel:=context.WithTimeout(context.Background(),testutil.WaitLong)
defercancel()
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

review: refactored to use dbfake instead

Comment on lines -407 to -409
_,err=client.Workspace(ctx,workspace.ID)
require.Error(t,err)
require.Equal(t,http.StatusGone,coderdtest.SDKError(t,err).StatusCode())
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

review: moved this check to the relevant CLI test

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

Copilot code reviewCopilotCopilot left review comments

@dannykoppingdannykoppingAwaiting requested review from dannykopping

@mtojekmtojekAwaiting requested review from mtojek

At least 1 approving review is required to merge this pull request.

Assignees

@johnstcnjohnstcn

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp