diff --git a/core/worker/hooks/host/host.go b/core/worker/hooks/host/host.go index 16e93f9..c471f57 100644 --- a/core/worker/hooks/host/host.go +++ b/core/worker/hooks/host/host.go @@ -20,6 +20,7 @@ import ( "os" "os/exec" "path/filepath" + "strings" "github.com/zc2638/wslog" @@ -49,7 +50,8 @@ func (h *host) Begin(ctx context.Context, spec *worker.Workflow) error { args = step.Shell[1:] } cmdData := shell.Script(step.Command) - fp := filepath.Join(scriptPath, step.Name+shell.Suffix) + stepName := strings.ReplaceAll(step.Name, " ", "_") + fp := filepath.Join(scriptPath, stepName+shell.Suffix) if err := os.WriteFile(fp, []byte(cmdData), os.ModePerm); err != nil { log.Error("cannot write file", "error", err) return err diff --git a/core/worker/worker.go b/core/worker/worker.go index ad8982f..577ee43 100644 --- a/core/worker/worker.go +++ b/core/worker/worker.go @@ -306,6 +306,9 @@ func execute( stepLog.Debug("received exit code 78. early exit.") step.Phase = v1.PhaseSkipped failed = true + } else if state.ExitCode > 0 { + step.Phase = v1.PhaseFailed + failed = true } }