chore(runner): refactor register flow

Signed-off-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi.Wu
2022-10-02 12:33:17 +08:00
committed by Jason Song
parent 7486d2ab91
commit 3a1503138b
8 changed files with 165 additions and 97 deletions

View File

@ -5,8 +5,10 @@ import (
"os"
"strconv"
"gitea.com/gitea/act_runner/config"
"gitea.com/gitea/act_runner/engine"
"gitea.com/gitea/act_runner/runtime"
"github.com/mattn/go-isatty"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
@ -15,7 +17,7 @@ import (
const version = "0.1"
// initLogging setup the global logrus logger.
func initLogging(cfg Config) {
func initLogging(cfg config.Config) {
isTerm := isatty.IsTerminal(os.Stdout.Fd())
log.SetFormatter(&log.TextFormatter{
DisableColors: !isTerm,
@ -76,7 +78,7 @@ func runRoot(ctx context.Context, task *runtime.Task) func(cmd *cobra.Command, a
}
task.BuildID, _ = strconv.ParseInt(jobID, 10, 64)
task.Run(ctx, nil)
_ = task.Run(ctx, nil)
return nil
}
}