Skip to content

feat: implement feature to support template version while creating workspace using cli #14880

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 11, 2024

Conversation

joobisb
Copy link
Contributor

@joobisb joobisb commented Sep 30, 2024

This PR closes #14860

@cdr-bot cdr-bot bot added the community Pull Requests and issues created by the community. label Sep 30, 2024
@joobisb joobisb changed the title feat: implement feature to support specifying template version while creating workspace using cli feat: implement feature to support template version while creating workspace using cli Sep 30, 2024
Comment on lines +207 to +211
version, err := client.TemplateVersionByName(inv.Context(), template.ID, templateVersion)
if err != nil {
return xerrors.Errorf("get template version by name: %w", err)
}
templateVersionID = version.ID
Copy link
Member

Choose a reason for hiding this comment

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

This unfortunately does not accept the template version uuid. It would be better if the name or uuid worked.

We should fix this in the route handler imo: https://github.com/coder/coder/blob/main/coderd/templateversions.go#L885-L885

Not needed in this PR.

Comment on lines +146 to +148
version2 := coderdtest.CreateTemplateVersion(t, client, owner.OrganizationID, completeWithAgent(), func(ctvr *codersdk.CreateTemplateVersionRequest) {
ctvr.TemplateID = template.ID
})
Copy link
Member

Choose a reason for hiding this comment

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

Add coderdtest.AwaitTemplateVersionJobCompleted(t, client, version2.ID) after creating the version. Otherwise we get a race condition in some tests.

Suggested change
version2 := coderdtest.CreateTemplateVersion(t, client, owner.OrganizationID, completeWithAgent(), func(ctvr *codersdk.CreateTemplateVersionRequest) {
ctvr.TemplateID = template.ID
})
version2 := coderdtest.CreateTemplateVersion(t, client, owner.OrganizationID, completeWithAgent(), func(ctvr *codersdk.CreateTemplateVersionRequest) {
ctvr.TemplateID = template.ID
})
coderdtest.AwaitTemplateVersionJobCompleted(t, client, version2.ID)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

got it, I've updated the test

Copy link
Member

@Emyrk Emyrk left a comment

Choose a reason for hiding this comment

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

When tests are passing, I will approve and merge 👍

@joobisb joobisb requested a review from Emyrk October 3, 2024 19:06
@joobisb
Copy link
Contributor Author

joobisb commented Oct 8, 2024

When tests are passing, I will approve and merge 👍

@Emyrk the tests are passing, can we merge this ?

@matifali matifali merged commit 1914490 into coder:main Oct 11, 2024
27 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 11, 2024
@joobisb joobisb deleted the issue#14860 branch November 22, 2024 19:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
community Pull Requests and issues created by the community.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

coder create does not support specifying template version
3 participants