-
Notifications
You must be signed in to change notification settings - Fork 979
feat(cli): add exp task create command #19492
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
Conversation
3220cc1
to
9196c38
Compare
9196c38
to
14ee5c9
Compare
templateVersionPresetID = uuid.New() | ||
) | ||
|
||
templateAndVersionFoundHandler := func(t *testing.T, ctx context.Context, templateName, templateVersionName, presetName, prompt string) http.HandlerFunc { |
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.
Decided to create a small helper here instead of writing the same handler over-and-over again. This is following in the footsteps of #19533 by using a http handler to mock coderd
behavior instead of using coderdtest
.
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.
We might want to add a single "integration"-style test at the end in a separate PR so we know we've all our bases covered.
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.
Sounds good to me
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.
Some suggestions/nits inline, but approach seems fine. We may want to consider moving some of the logic to the API endpoint if we want to make API usage more convenient, but this works for now.
workspace, err := expClient.CreateTask(ctx, codersdk.Me, codersdk.CreateTaskRequest{ | ||
TemplateVersionID: templateVersionID, | ||
TemplateVersionPresetID: templateVersionPresetID, | ||
Prompt: taskInput, |
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.
Suggestion: Not sure if we're too far gone to do this, but potential for rename: Prompt -> Input depending on how we want to standardize this.
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.
As it is all experimental we technically still have time
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.
Post-merge approve and one more suggestion.
inv.Stdout, | ||
"The task %s has been created at %s!\n", | ||
cliui.Keyword(workspace.Name), | ||
cliui.Timestamp(time.Now()), |
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.
workspace.CreatedAt
?
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.
The way I've implemented it is how we currently do it for workspace creation but I'm happy to create a quick follow up PR to address this?
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.
Up to you tbh, I'm good with either just thought it made sense so threw it out there. 👍🏻
Partially implements coder/internal#893
This isn't the full implementation of
coder exp tasks create
as defined in the issue, but it is the minimum required to create a task.