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: timeout for deploy command #3349

Merged
merged 1 commit into from
Nov 21, 2024
Merged

Conversation

stuartwdouglas
Copy link
Collaborator

Also limit test deploy to 1m to help diagnose issues

@stuartwdouglas stuartwdouglas added the run-all A PR with this label will run the full set of CI jobs in the PR rather than in the merge queue label Nov 6, 2024
@stuartwdouglas stuartwdouglas requested review from wesbillman and removed request for a team November 6, 2024 23:50
This was referenced Nov 6, 2024
@stuartwdouglas stuartwdouglas force-pushed the stuartwdouglas/deploy-timeout branch 3 times, most recently from ca07e3a to 7783991 Compare November 7, 2024 00:59
@@ -37,5 +40,10 @@ func (d *deployCmd) Run(ctx context.Context, projConfig projectconfig.Config) er
if err != nil {
return err
}
return engine.BuildAndDeploy(ctx, d.Replicas, !d.NoWait)
tm := optional.None[time.Duration]()
if d.Timeout.Milliseconds() > 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

FYI you can just compare d.Timeout > 0

Comment on lines 44 to 47
tm := optional.None[time.Duration]()
if d.Timeout.Milliseconds() > 0 {
tm = optional.Some(d.Timeout)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can replace this with:

Suggested change
tm := optional.None[time.Duration]()
if d.Timeout.Milliseconds() > 0 {
tm = optional.Some(d.Timeout)
}
tm := optional.Zero(d.Timeout)

@@ -755,7 +755,7 @@ func (e *Engine) getDependentModuleNames(moduleName string) []string {
}

// BuildAndDeploy attempts to build and deploy all local modules.
func (e *Engine) BuildAndDeploy(ctx context.Context, replicas int32, waitForDeployOnline bool, moduleNames ...string) error {
func (e *Engine) BuildAndDeploy(ctx context.Context, replicas int32, waitForDeployOnline bool, timeout optional.Option[time.Duration], moduleNames ...string) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's much more idiomatic to use the context for timeouts.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

@stuartwdouglas stuartwdouglas force-pushed the stuartwdouglas/deploy-timeout branch 6 times, most recently from 0e6ea0e to 0b5b535 Compare November 7, 2024 22:39
@stuartwdouglas stuartwdouglas force-pushed the stuartwdouglas/deploy-timeout branch 2 times, most recently from 67f017e to 8d32f25 Compare November 20, 2024 03:09
Also limit test deploy to 1m to help diagnose issues
@stuartwdouglas stuartwdouglas merged commit 7d33918 into main Nov 21, 2024
92 checks passed
@stuartwdouglas stuartwdouglas deleted the stuartwdouglas/deploy-timeout branch November 21, 2024 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run-all A PR with this label will run the full set of CI jobs in the PR rather than in the merge queue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants