-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat: add wait flag on deploy cmd #900
Conversation
1f66d73
to
5d4dd13
Compare
@@ -138,6 +138,7 @@ func (d *devCmd) Run(ctx context.Context, client ftlv1connect.ControllerServiceC | |||
deploy := deployCmd{ | |||
Replicas: 1, | |||
ModuleDir: dir, | |||
Wait: d.ExitAfterDeploy, |
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.
if ExitAfterDeploy
is true, we'll pass Wait
for all the deploys contained therein
5d4dd13
to
16b1541
Compare
cmd/ftl/cmd_deploy.go
Outdated
ticker := time.NewTicker(1 * time.Second) | ||
defer ticker.Stop() |
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.
I'm not sure if it has the same effect you're looking for, but you might be able to use time.After
in the select below vs. creating a NewTicker
.
https://github.com/TBD54566975/ftl/blob/main/cmd/ftl/cmd_dev.go#L175
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.
i think we actually want ticker here instead of timer? both would probably work but from googling it seems like timer is more for performing a single event after a delay whereas ticker is intended for recurring events executed at an interval
🤷♀️
cmd/ftl/cmd_deploy.go
Outdated
logger.Infof("Waiting for deployment %s to become ready", resp.Msg.DeploymentName) | ||
|
||
wg, ctx := errgroup.WithContext(ctx) | ||
wg.Go(d.checkReadiness(ctx, client, resp.Msg.DeploymentName)) |
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.
I don't think you need any concurrency here, you can just run the for loop synchronously?
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.
very true 😃
cmd/ftl/cmd_deploy.go
Outdated
} | ||
} | ||
if !found { | ||
return fmt.Errorf("deployment %s not found: %v", deploymentName, status.Msg.Deployments) |
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 the assumption here that the deployment should already exist? Is that true?
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.
it should be true, we're performing the wait
loop synchronously after calling the controller to persist the deployment via client.CreateDeployment
16b1541
to
d7ec723
Compare
fixes #885