Repository navigation
feat(cli): add provisioner job cancel command - #16252
Merged
Merged
Conversation
mafredri
force-pushed
the
mafredri/feat-cli-provisioner-job-cancel
branch
2 times, most recently
from
January 24, 2025 12:55
20596bf to
d50b500
Compare
mafredri
force-pushed
the
mafredri/feat-cli-provisioner-job-cancel
branch
from
January 24, 2025 12:56
d50b500 to
efdcbba
Compare
mafredri
commented
Jan 24, 2025
mafredri
commented
Jan 24, 2025
| return | ||
| } | ||
|
|
||
| jobs, ok := api.getProvisionerJobs(rw, r, []uuid.UUID{jobID}) |
Member
Author
There was a problem hiding this comment.
Review: Note that I'm sharing logic between this endpoint and the one for returning multiple. I mainly did this to ensure they use the same authorization code between the endpoints. That's because the existing api.Database.GetProvisionerJobByID is mainly used by provisioners, I did not want to use the same here until we can enforce proper RBAC for jobs (#16160)
Member
I think it's definitely worth an issue. I can definitely foresee a template admin trying to cancel some hanging workspace build jobs and being surprised that they are not allowed to do so. |
johnstcn
approved these changes
Jan 24, 2025
johnstcn
left a comment
Member
There was a problem hiding this comment.
Nice work 👍 Some comments below, but nothing blocking.
mtojek
reviewed
Jan 24, 2025
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This PR adds a command to cancel provisioner jobs.
I've re-used existing cancellation endpoints to ensure we keep current RBAC permissions. This revealed that template admins are only allowed to cancel TemplateVersionImport jobs, and not dry-run or workspace jobs.
This is due to:
coder/coderd/templateversions.go
Line 677 in 4872d14
And en explanation for it exists here:
coder/coderd/templateversions.go
Lines 464 to 465 in 4872d14
So I'm not sure what to make of this, is it a bug or not?
For now I've encoded the current behavior in the tests.
Fixes #16117
Updates #15084