Skip to content
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

Merged
merged 1 commit into from
Feb 8, 2024

Conversation

worstell
Copy link
Contributor

@worstell worstell commented Feb 8, 2024

fixes #885

@worstell worstell force-pushed the worstell/20240207-add-wait-flag-for-deploy branch 2 times, most recently from 1f66d73 to 5d4dd13 Compare February 8, 2024 00:05
@@ -138,6 +138,7 @@ func (d *devCmd) Run(ctx context.Context, client ftlv1connect.ControllerServiceC
deploy := deployCmd{
Replicas: 1,
ModuleDir: dir,
Wait: d.ExitAfterDeploy,
Copy link
Contributor Author

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

@worstell worstell force-pushed the worstell/20240207-add-wait-flag-for-deploy branch from 5d4dd13 to 16b1541 Compare February 8, 2024 00:09
Comment on lines 123 to 124
ticker := time.NewTicker(1 * time.Second)
defer ticker.Stop()
Copy link
Collaborator

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

Copy link
Contributor Author

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

🤷‍♀️

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))
Copy link
Collaborator

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

very true 😃

}
}
if !found {
return fmt.Errorf("deployment %s not found: %v", deploymentName, status.Msg.Deployments)
Copy link
Collaborator

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?

Copy link
Contributor Author

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

@worstell worstell force-pushed the worstell/20240207-add-wait-flag-for-deploy branch from 16b1541 to d7ec723 Compare February 8, 2024 00:56
@worstell worstell merged commit d83db73 into main Feb 8, 2024
11 checks passed
@worstell worstell deleted the worstell/20240207-add-wait-flag-for-deploy branch February 8, 2024 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ftl dev --exit-after-deploy should wait for the deployments to come up
3 participants