mirror of
				https://gitea.com/gitea/act_runner.git
				synced 2025-10-30 20:37:56 +01:00 
			
		
		
		
	refactor(register): refactor registration functions and improve logging (#288)
- Remove the else clause in the `registerInteractive` function, and unconditionally log "Runner registered successfully." - Change the return value in the `doRegister` function from `nil` to `ctx.Err()`. Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> Reviewed-on: https://gitea.com/gitea/act_runner/pulls/288 Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com> Co-committed-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
		| @@ -215,9 +215,8 @@ func registerInteractive(ctx context.Context, configFile string) error { | ||||
| 			log.Infof("Registering runner, name=%s, instance=%s, labels=%v.", inputs.RunnerName, inputs.InstanceAddr, inputs.Labels) | ||||
| 			if err := doRegister(ctx, cfg, inputs); err != nil { | ||||
| 				return fmt.Errorf("Failed to register runner: %w", err) | ||||
| 			} else { | ||||
| 				log.Infof("Runner registered successfully.") | ||||
| 			} | ||||
| 			log.Infof("Runner registered successfully.") | ||||
| 			return nil | ||||
| 		} | ||||
|  | ||||
| @@ -305,7 +304,7 @@ func doRegister(ctx context.Context, cfg *config.Config, inputs *registerInputs) | ||||
| 		})) | ||||
| 		select { | ||||
| 		case <-ctx.Done(): | ||||
| 			return nil | ||||
| 			return ctx.Err() | ||||
| 		default: | ||||
| 		} | ||||
| 		if ctx.Err() != nil { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user