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

feat(coderd): add filters and fix template for provisioner daemons#16558

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

Merged
mafredri merged 1 commit intomainfrommafredri/feat-coderd-provisioner-id-filter
Feb 14, 2025

Conversation

mafredri
Copy link
Member

@mafredrimafredri commentedFeb 13, 2025
edited
Loading

This change adds provisioner daemon ID filter to the provisioner daemons
endpoint, and also implements the limiting to 50 results.

Test coverage is greatly improved and template information for jobs
associated to the daemon was also fixed.

Updates#15084
Updates#15192
Related#16532

This change adds provisioner daemon ID filter to the provisioner daemonsendpoint, and also implements the limiting to 50 results.Test coverage is greatly improved and template information for jobsassociated to the daemon was also fixed.
Comment on lines +78 to +93
-- Current job information.
LEFT JOIN
template_versions version ONversion.id = (current_job.input->>'template_version_id')::uuid
workspace_builds current_build ONcurrent_build.id =CASE WHEN current_job.input ? 'workspace_build_id' THEN(current_job.input->>'workspace_build_id')::uuid END
LEFT JOIN
templates tmpl ON tmpl.id = version.template_id
-- We should always have a template version, either explicitly or implicitly via workspace build.
template_versions current_version ON current_version.id = CASE WHEN current_job.input ? 'template_version_id' THEN (current_job.input->>'template_version_id')::uuid ELSE current_build.template_version_id END
LEFT JOIN
templates current_template ON current_template.id = current_version.template_id
-- Previous job information.
LEFT JOIN
workspace_builds previous_build ON previous_build.id = CASE WHEN previous_job.input ? 'workspace_build_id' THEN (previous_job.input->>'workspace_build_id')::uuid END
LEFT JOIN
-- We should always have a template version, either explicitly or implicitly via workspace build.
template_versions previous_version ON previous_version.id = CASE WHEN previous_job.input ? 'template_version_id' THEN (previous_job.input->>'template_version_id')::uuid ELSE previous_build.template_version_id END
LEFT JOIN
templates previous_template ON previous_template.id = previous_version.template_id
Copy link
MemberAuthor

@mafredrimafredriFeb 13, 2025
edited
Loading

Choose a reason for hiding this comment

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

Review: I completed this because it was missing some things. But I wonder if we need to take RBAC into consideration now?

The endpoint previously returned a job ID/status only, now it also returns information regarding the template that job is associated with.

This has some implications considering regular members are allowed to view provisioner daemon resources. WDYT@johnstcn?

I'm not particularly fond of it, but we could add the same authorization to the API endpoint as for jobs:

// For now, only owners and template admins can access provisioner jobs.if!api.Authorize(r,policy.ActionRead,rbac.ResourceProvisionerJobs.InOrg(org.ID)) {httpapi.ResourceNotFound(rw)returnnil,false}

Copy link
Member

Choose a reason for hiding this comment

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

I don't know how sensitivetemplate ortemplate_version fields can be, but a red flag for me would be if this could cross org boundaries.

I think some further questions we need to answer before we can even update the RBAC rules are:

  • Who can view a template import job not linked to any workspace? (Suggestion: anyone who can read the linked template)
  • Who can view a workspace build job? (Suggestion: anyone who can read the linked workspace)

To be safe, I think we should promote the same level of access control as for provisioner jobsfor now. We should add a follow-up issue to take provisioner job ownership and template-level ACLs into account.

Does that sound reasonable to you?

mafredri reacted with thumbs up emoji
Copy link
Member

@mtojekmtojek left a comment
edited
Loading

Choose a reason for hiding this comment

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

I admit you nailed the test coverage in this PR :) LGTM but defer the final call to@johnstcn 👍

mafredri reacted with heart emoji
Copy link
Member

@johnstcnjohnstcn left a comment

Choose a reason for hiding this comment

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

Change looks good to me 👍 I'm not going to block on the RBAC change you suggested.

mafredri reacted with heart emoji
Comment on lines +48 to +58
tags := database.StringMap{}
if tagsRaw != "" {
if err := tags.Scan([]byte(tagsRaw)); err != nil {
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
Message: "Invalid tags query parameter",
Detail: err.Error(),
})
return
}
}

Copy link
Member

Choose a reason for hiding this comment

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

non-blocking, suggestion:qp.StringMap could be a nice QoL feature to have here!

mafredri reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

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

Ended up implementing that here:#16578

@mafredri
Copy link
MemberAuthor

Thanks for the reviews@johnstcn and@mtojek!

I’ll merge this now to unblock@BrunoQuaresma and follow-up on Monday on both the RBAC change and open an issue for improvements. As well as that qp.StringMap (nice suggestion!)

@mafredrimafredri merged commit77306f3 intomainFeb 14, 2025
37 of 39 checks passed
@mafredrimafredri deleted the mafredri/feat-coderd-provisioner-id-filter branchFebruary 14, 2025 15:26
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsFeb 14, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@johnstcnjohnstcnjohnstcn approved these changes

@mtojekmtojekmtojek left review comments

@BrunoQuaresmaBrunoQuaresmaAwaiting requested review from BrunoQuaresma

Assignees

@mafredrimafredri

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@mafredri@johnstcn@mtojek

[8]ページ先頭

©2009-2025 Movatter.jp