Make runner-bootstrap-timeout optional

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
Gabriel Adrian Samfira 2022-07-06 17:37:18 +00:00
parent 874506e539
commit 280cad96e4
4 changed files with 9 additions and 9 deletions

View file

@ -254,7 +254,7 @@ explicitly remove them using the runner delete command.
}
if cmd.Flags().Changed("runner-bootstrap-timeout") {
poolUpdateParams.RunnerBootstrapTimeout = poolRunnerBootstrapTimeout
poolUpdateParams.RunnerBootstrapTimeout = &poolRunnerBootstrapTimeout
}
pool, err := cli.UpdatePoolByID(args[0], poolUpdateParams)

View file

@ -210,8 +210,8 @@ func (s *sqlDatabase) updatePool(pool Pool, param params.UpdatePoolParams) (para
pool.OSType = param.OSType
}
if param.RunnerBootstrapTimeout > 0 {
pool.RunnerBootstrapTimeout = param.RunnerBootstrapTimeout
if param.RunnerBootstrapTimeout != nil && *param.RunnerBootstrapTimeout > 0 {
pool.RunnerBootstrapTimeout = *param.RunnerBootstrapTimeout
}
if q := s.conn.Save(&pool); q.Error != nil {

View file

@ -78,11 +78,11 @@ type NewUserParams struct {
}
type UpdatePoolParams struct {
Tags []string `json:"tags"`
Enabled *bool `json:"enabled"`
MaxRunners *uint `json:"max_runners"`
MinIdleRunners *uint `json:"min_idle_runners"`
RunnerBootstrapTimeout uint `json:"runner_bootstrap_timeout"`
Tags []string `json:"tags,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
MaxRunners *uint `json:"max_runners,omitempty"`
MinIdleRunners *uint `json:"min_idle_runners,omitempty"`
RunnerBootstrapTimeout *uint `json:"runner_bootstrap_timeout,omitempty"`
Image string `json:"image"`
Flavor string `json:"flavor"`
OSType config.OSType `json:"os_type"`

View file

@ -90,7 +90,7 @@ func (r *Runner) UpdatePoolByID(ctx context.Context, poolID string, param params
minIdleRunners = *param.MinIdleRunners
}
if param.RunnerBootstrapTimeout == 0 {
if param.RunnerBootstrapTimeout != nil && *param.RunnerBootstrapTimeout == 0 {
return params.Pool{}, runnerErrors.NewBadRequestError("runner_bootstrap_timeout cannot be 0")
}