mirror of
https://github.com/coder/coder.git
synced 2025-07-23 21:32:07 +00:00
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:
@ -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,
|
||||
})
|
||||
|
Reference in New Issue
Block a user