-
Notifications
You must be signed in to change notification settings - Fork 7
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
base: main
Are you sure you want to change the base?
Conversation
ca07e3a
to
7783991
Compare
frontend/cli/cmd_deploy.go
Outdated
@@ -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 { |
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.
FYI you can just compare d.Timeout > 0
frontend/cli/cmd_deploy.go
Outdated
tm := optional.None[time.Duration]() | ||
if d.Timeout.Milliseconds() > 0 { | ||
tm = optional.Some(d.Timeout) | ||
} |
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.
You can replace this with:
tm := optional.None[time.Duration]() | |
if d.Timeout.Milliseconds() > 0 { | |
tm = optional.Some(d.Timeout) | |
} | |
tm := optional.Zero(d.Timeout) |
internal/buildengine/engine.go
Outdated
@@ -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 { |
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's much more idiomatic to use the context for timeouts.
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.
Fixed
9ed19d2
to
0e6ea0e
Compare
Also limit test deploy to 1m to help diagnose issues
0e6ea0e
to
0b5b535
Compare
Also limit test deploy to 1m to help diagnose issues