mirror of
https://gitea.com/gitea/act_runner.git
synced 2024-12-27 19:38:20 +01:00
Exit with Code 1 if registering a runner fails (#228)
### It's a "simple dirty fix" and I don't have any experiences with Go, so if this doesn't match your coding compliance, please adjust the code as needed I'm using bash scripts to register a token `./act_runner/act_runner register --no-interactive --name runner$number --instance http://localhost:3000 --token $token` But when a token is invalid, the command still returns 0, which is not practical for automation. A simple non-zero return would be more convenient for power users and developers. Co-authored-by: Markus Löffler <markus.loeffler@netcare.de> Co-authored-by: techknowlogick <techknowlogick@noreply.gitea.com> Reviewed-on: https://gitea.com/gitea/act_runner/pulls/228 Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.com> Co-authored-by: MarkusLoeffler01 <markusloeffler01@noreply.gitea.com> Co-committed-by: MarkusLoeffler01 <markusloeffler01@noreply.gitea.com>
This commit is contained in:
parent
a29307a9d9
commit
b21d476aca
@ -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 {
|
||||
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)
|
||||
}
|
||||
log.Infof("Runner registered successfully.")
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user