woodpecker-ci / woodpecker

Woodpecker is a simple, yet powerful CI/CD engine with great extensibility.
https://woodpecker-ci.org
Apache License 2.0
4.17k stars 361 forks source link

Wrong pipeline status #2197

Closed xoxys closed 1 month ago

xoxys commented 1 year ago

Component

server

Describe the bug

Pipeline status for cancelled pipeline is wrong:

image

image

System Info

{"source":"https://github.com/woodpecker-ci/woodpecker","version":"next-63d5c40a"}


### Additional context

_No response_

### Validations

- [X] Read the [Contributing Guidelines](https://github.com/woodpecker-ci/woodpecker/blob/main/CONTRIBUTING.md).
- [X] Read the [docs](https://woodpecker-ci.org/docs/intro).
- [X] Check that there isn't [already an issue](https://github.com/woodpecker-ci/woodpecker/issues) that reports the same bug to avoid creating a duplicate.
- [X] Checked that the bug isn't fixed in the `next` version already [https://woodpecker-ci.org/faq#which-version-of-woodpecker-should-i-use]
- [X] Check that this is a concrete bug. For Q&A join our [Discord Chat Server](https://discord.gg/fcMQqSMXJy) or the [Matrix room](https://matrix.to/#/#woodpecker:matrix.org).
pat-s commented 1 year ago

related #1871 #1893

xoxys commented 1 year ago

It gets even worse. Even if the pipeline status is correct in the UI, CI_PIPELINE_STATUS is wrong, which makes it pretty useless to use for notifications :see_no_evil:

image

while CI_PIPELINE_STATUS has reported success during a notification step

anbraten commented 11 months ago

Maybe related. Pipeline is already show as error, but is still running and no steps has an error 🤔 https://ci.woodpecker-ci.org/repos/3780/pipeline/9551

anbraten commented 7 months ago

image

Step failed, but pipeline was marked as successful: https://ci.woodpecker-ci.org/repos/3780/pipeline/13542

anbraten commented 6 months ago

Found another interesting status mismatch: https://ci.woodpecker-ci.org/repos/3780/pipeline/14498

anbraten commented 3 months ago

I think this line could be the issue: https://github.com/woodpecker-ci/woodpecker/blob/2bda19024ece0bf0deab5244fb8799f653d5adfc/agent/runner.go#L168

In case of a canceled workflow the error is set to "" (no error). The configured exit code doesn't seem to be considered by any logic at all and is only used for logging: #3848