1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2026-06-03 16:35:37 +02:00

Forward skipped step state asap it is known (#6295)

This commit is contained in:
6543
2026-03-22 18:20:44 +01:00
committed by GitHub
parent 8248949af3
commit 513011d1bf
10 changed files with 179 additions and 158 deletions
+20 -19
View File
@@ -36,24 +36,25 @@ func (r *Runner) createTracer(ctxMeta context.Context, uploads *sync.WaitGroup,
defer uploads.Done()
stepLogger := logger.With().
Str("image", state.Pipeline.Step.Image).
Str("image", state.CurrStep.Image).
Str("workflow_id", workflow.ID).
Err(state.Process.Error).
Int("exit_code", state.Process.ExitCode).
Bool("exited", state.Process.Exited).
Err(state.CurrStepState.Error).
Int("exit_code", state.CurrStepState.ExitCode).
Bool("exited", state.CurrStepState.Exited).
Logger()
stepState := rpc.StepState{
StepUUID: state.Pipeline.Step.UUID,
Exited: state.Process.Exited,
ExitCode: state.Process.ExitCode,
Started: state.Process.Started,
Canceled: errors.Is(state.Process.Error, pipeline_errors.ErrCancel),
StepUUID: state.CurrStep.UUID,
Exited: state.CurrStepState.Exited,
ExitCode: state.CurrStepState.ExitCode,
Started: state.CurrStepState.Started,
Canceled: errors.Is(state.CurrStepState.Error, pipeline_errors.ErrCancel),
Skipped: state.CurrStepState.Skipped,
}
if state.Process.Error != nil {
stepState.Error = state.Process.Error.Error()
if state.CurrStepState.Error != nil {
stepState.Error = state.CurrStepState.Error.Error()
}
if state.Process.Exited {
if state.CurrStepState.Exited {
stepState.Finished = time.Now().Unix()
}
@@ -68,21 +69,21 @@ func (r *Runner) createTracer(ctxMeta context.Context, uploads *sync.WaitGroup,
stepLogger.Debug().Msg("update step status complete")
}()
if state.Process.Exited {
if state.CurrStepState.Exited {
return nil
}
if state.Pipeline.Step.Environment == nil {
state.Pipeline.Step.Environment = map[string]string{}
if state.CurrStep.Environment == nil {
state.CurrStep.Environment = map[string]string{}
}
// TODO: find better way to update this state and move it to pipeline to have the same env in cli-exec
state.Pipeline.Step.Environment["CI_MACHINE"] = r.hostname
state.CurrStep.Environment["CI_MACHINE"] = r.hostname
state.Pipeline.Step.Environment["CI_PIPELINE_STARTED"] = strconv.FormatInt(state.Pipeline.Started, 10)
state.CurrStep.Environment["CI_PIPELINE_STARTED"] = strconv.FormatInt(state.Workflow.Started, 10)
state.Pipeline.Step.Environment["CI_STEP_STARTED"] = strconv.FormatInt(state.Pipeline.Started, 10)
state.CurrStep.Environment["CI_STEP_STARTED"] = strconv.FormatInt(state.Workflow.Started, 10)
state.Pipeline.Step.Environment["CI_SYSTEM_PLATFORM"] = runtime.GOOS + "/" + runtime.GOARCH
state.CurrStep.Environment["CI_SYSTEM_PLATFORM"] = runtime.GOOS + "/" + runtime.GOARCH
return nil
}