Exit with Code 1 if registering a runner fails #228

Merged
techknowlogick merged 6 commits from MarkusLoeffler01/act_runner:main into main 2023-06-09 17:34:25 +00:00

View File

@ -197,7 +197,7 @@ func registerInteractive(configFile string) error {
if stage == StageWaitingForRegistration {
log.Infof("Registering runner, name=%s, instance=%s, labels=%v.", inputs.RunnerName, inputs.InstanceAddr, inputs.CustomLabels)
if err := doRegister(cfg, inputs); err != nil {
log.Errorf("Failed to register runner: %v", err)
return fmt.Errorf("Failed to register runner: %w", err)
} else {
MarkusLoeffler01 marked this conversation as resolved Outdated

thanks for this PR. You may be able to return an error, and Cobra would exit with a non-zero status, I haven't tested this suggestion though.

thanks for this PR. You may be able to return an error, and Cobra would exit with a non-zero status, I haven't tested this suggestion though.

Maybe:

				return fmt.Errorf("Failed to register runner: %w", err)
Maybe: ```go return fmt.Errorf("Failed to register runner: %w", err) ```
log.Infof("Runner registered successfully.")
}
@ -257,8 +257,7 @@ func registerNoInteractive(configFile string, regArgs *registerArgs) error {
return nil
}
if err := doRegister(cfg, inputs); err != nil {
log.Errorf("Failed to register runner: %v", err)
return nil
return fmt.Errorf("Failed to register runner: %w", err)
}
techknowlogick marked this conversation as resolved Outdated

Ditto.

Ditto.
log.Infof("Runner registered successfully.")
return nil