Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit-codes are not used by server #3848

Open
anbraten opened this issue Jun 27, 2024 · 0 comments · May be fixed by #3849
Open

Exit-codes are not used by server #3848

anbraten opened this issue Jun 27, 2024 · 0 comments · May be fixed by #3849
Labels
bug Something isn't working refactor delete or replace old code

Comments

@anbraten
Copy link
Member

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

@anbraten anbraten added bug Something isn't working refactor delete or replace old code labels Jun 27, 2024
This was referenced Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working refactor delete or replace old code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant