Skip to content

Exit-codes are not used by server #3848

Open
@anbraten

Description

@anbraten

The state send to the server contains an exit-code for the workflow. However as workflows have no exit-code they get simply ignored and are only considered by logging:

woodpecker/agent/runner.go

Lines 159 to 175 in 2bda190

if canceled.IsSet() {
state.Error = ""
state.ExitCode = pipeline.ExitCodeKilled
} else if err != nil {
pExitError := &pipeline.ExitError{}
switch {
case errors.As(err, &pExitError):
state.ExitCode = pExitError.Code
case errors.Is(err, pipeline.ErrCancel):
state.Error = ""
state.ExitCode = pipeline.ExitCodeKilled
canceled.SetTo(true)
default:
state.ExitCode = 1
state.Error = err.Error()
}
}

In case of a canceled pipeline we even seem to remove the error:

state.Error = ""

sounds to be related to #2197

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingrefactordelete or replace old code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions