chore: provisioner acquirer to respect organization ID of jobs (#13874)

* test: add unit test to verify creation of templates in multiple orgs
* chore: provisioner acquirer to respect organization ID of jobs

Prior to this the wrong provisioner was awakened on any new job
posting.

* add comment and stricter check
This commit is contained in:
Steven Masley
2024-07-11 06:26:47 -10:00
committed by GitHub
parent bee913ac45
commit 687d9538de
3 changed files with 72 additions and 14 deletions

View File

@ -3,6 +3,7 @@ package provisionerjobs
import (
"encoding/json"
"github.com/google/uuid"
"golang.org/x/xerrors"
"github.com/coder/coder/v2/coderd/database"
@ -12,12 +13,14 @@ import (
const EventJobPosted = "provisioner_job_posted"
type JobPosting struct {
OrganizationID uuid.UUID `json:"organization_id"`
ProvisionerType database.ProvisionerType `json:"type"`
Tags map[string]string `json:"tags"`
}
func PostJob(ps pubsub.Pubsub, job database.ProvisionerJob) error {
msg, err := json.Marshal(JobPosting{
OrganizationID: job.OrganizationID,
ProvisionerType: job.Provisioner,
Tags: job.Tags,
})