update protocol

This commit is contained in:
Lunny Xiao
2022-06-20 16:37:28 +08:00
committed by Jason Song
parent 2babadbc94
commit 5903c08c14
3 changed files with 105 additions and 11 deletions

View File

@ -7,9 +7,11 @@ import (
"path/filepath"
"github.com/nektos/act/pkg/artifacts"
"github.com/nektos/act/pkg/common"
"github.com/nektos/act/pkg/model"
"github.com/nektos/act/pkg/runner"
"github.com/rs/zerolog/log"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
@ -60,7 +62,10 @@ func (i *Input) newPlatforms() map[string]string {
}
func Execute(ctx context.Context) {
input := Input{}
input := Input{
reuseContainers: true,
forgeInstance: "gitea.com",
}
rootCmd := &cobra.Command{
Use: "act [event name to run]\nIf no event name passed, will default to \"on: push\"",
@ -103,6 +108,17 @@ func getWorkflowsPath() (string, error) {
return p, nil
}
type StepHook struct{}
func (hook *StepHook) Levels() []logrus.Level {
return logrus.AllLevels
}
func (hook *StepHook) Fire(entry *logrus.Entry) error {
fmt.Printf("====== %#v \n ", entry)
return nil
}
func runTask(ctx context.Context, input *Input, jobID string) error {
workflowsPath, err := getWorkflowsPath()
if err != nil {
@ -177,6 +193,11 @@ func runTask(ctx context.Context, input *Input, jobID string) error {
return fmt.Errorf("New config failed: %v", err)
}
log := logrus.StandardLogger()
log.AddHook(&StepHook{})
ctx = common.WithLogger(ctx, log)
cancel := artifacts.Serve(ctx, input.artifactServerPath, input.artifactServerPort)
executor := r.NewPlanExecutor(plan).Finally(func(ctx context.Context) error {