- Notifications
You must be signed in to change notification settings - Fork915
fix(coderd): change the order of precedence between coder_workspace_tags and request tags#16119
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
@@ -355,10 +355,11 @@ func TestPostTemplateVersionsByOrganization(t *testing.T) { | |||
wantTags: map[string]string{"owner": "", "scope": "organization", "foo": "bar", "a": "1", "b": "2"}, | |||
}, | |||
{ | |||
name: "main.tf withworkspace tagsand request tags", | |||
name: "main.tf withrequest tagsnot clobbering workspace tags", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Is clobbering actually involved here? Since there's no two entries of the same tag the result is just a union.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
There's a test below that shows the actual clobbering behaviour. I guess "not clobbering" and "union" are similar enough in result but different enough in semantics to be confusing. But the tags are not a union, there is an order of precedence here that I'm trying to codify and demonstrate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Tricky edge case 👍
12991ff
intomainUh oh!
There was an error while loading.Please reload this page.
/cherry-pick release/2.18 |
This PR switches the order of precedence of workspace tags when posting a template version.
Previously, user-specified tags in the request could not override those detected from our parsing of the template file. Now, they can do.
This addresses a customer issue where were attempting to set a workspace tag via variable.
Note: there is a possible follow-up item here where we could pass in the workspace tag values from the request into
tfparse
and let it take those user-specified values into account. This is covered in a separate test.