feat!: extract provisioner tags from coder_workspace_tags data source (#15578)

Relates to https://github.com/coder/coder/issues/15087 and
https://github.com/coder/coder/issues/15427

- Extracts provisioner job tags from `coder_workspace_tags` on template
version creation using `provisioner/terraform/tfparse` added in
https://github.com/coder/coder/pull/15236
- Drops a WARN log in coderd if no matching provisioners found.
- Also drops a warning message in the CLI if no provisioners are found.
- To support both CLI and UI warnings, added a
`codersdk.MatchedProvisioners` struct to the `TemplateVersion` response
containing details of how many provisioners were around at the time of
the insert.

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
This commit is contained in:
Cian Johnston
2024-11-25 11:19:14 +00:00
committed by GitHub
co-authored by Mathias Fredriksson
parent 648cdd006c
commit 1cdc3e8921
11 changed files with 694 additions and 95 deletions
+21
View File
@@ -11389,6 +11389,24 @@ const docTemplate = `{
}
}
},
"codersdk.MatchedProvisioners": {
"type": "object",
"properties": {
"available": {
"description": "Available is the number of provisioner daemons that are available to\ntake jobs. This may be less than the count if some provisioners are\nbusy or have been stopped.",
"type": "integer"
},
"count": {
"description": "Count is the number of provisioner daemons that matched the given\ntags. If the count is 0, it means no provisioner daemons matched the\nrequested tags.",
"type": "integer"
},
"most_recently_seen": {
"description": "MostRecentlySeen is the most recently seen time of the set of matched\nprovisioners. If no provisioners matched, this field will be null.",
"type": "string",
"format": "date-time"
}
}
},
"codersdk.MinimalOrganization": {
"type": "object",
"required": [
@@ -13582,6 +13600,9 @@ const docTemplate = `{
"job": {
"$ref": "#/definitions/codersdk.ProvisionerJob"
},
"matched_provisioners": {
"$ref": "#/definitions/codersdk.MatchedProvisioners"
},
"message": {
"type": "string"
},
+21
View File
@@ -10207,6 +10207,24 @@
}
}
},
"codersdk.MatchedProvisioners": {
"type": "object",
"properties": {
"available": {
"description": "Available is the number of provisioner daemons that are available to\ntake jobs. This may be less than the count if some provisioners are\nbusy or have been stopped.",
"type": "integer"
},
"count": {
"description": "Count is the number of provisioner daemons that matched the given\ntags. If the count is 0, it means no provisioner daemons matched the\nrequested tags.",
"type": "integer"
},
"most_recently_seen": {
"description": "MostRecentlySeen is the most recently seen time of the set of matched\nprovisioners. If no provisioners matched, this field will be null.",
"type": "string",
"format": "date-time"
}
}
},
"codersdk.MinimalOrganization": {
"type": "object",
"required": ["id"],
@@ -12323,6 +12341,9 @@
"job": {
"$ref": "#/definitions/codersdk.ProvisionerJob"
},
"matched_provisioners": {
"$ref": "#/definitions/codersdk.MatchedProvisioners"
},
"message": {
"type": "string"
},