Skip to content

fix(coderd/database): avoid clobbering workspace build state #9826

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Sep 22, 2023

Conversation

johnstcn
Copy link
Member

Fixes #9823.

  • Decomposes UpdateWorkspaceBuildByID into UpdateWorkspaceBuildProvisionerStateByID and UpdateWorkspaceBuildDeadlineByID.
  • Replaces existing invocations of UpdateWorkspaceBuildByID with the newer queries where applicable.
  • Modifies GetActiveWorkspaceBuildsByTemplateID to not return incomplete workspace builds.

check.Args(database.UpdateWorkspaceBuildDeadlineByIDParams{
ID: build.ID,
UpdatedAt: build.UpdatedAt,
Deadline: build.Deadline,
Copy link
Member

@mafredri mafredri Sep 22, 2023

Choose a reason for hiding this comment

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

This is a test, but in theory this clobbers max deadline? Should we do some testing about that / prevent it?

Copy link
Member Author

@johnstcn johnstcn Sep 22, 2023

Choose a reason for hiding this comment

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

In theory, yes - but I want to keep the scope of this limited to provisioner state.
We can think about #9822 separately.

Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

👍 once the linter is happy

@johnstcn johnstcn merged commit 8d8402d into main Sep 22, 2023
@johnstcn johnstcn deleted the cj/9823-dont-clobber-tf-state branch September 22, 2023 15:22
@github-actions github-actions bot locked and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EnterpriseTemplateScheduleStore removes provisioner state from builds
4 participants