woodpecker-ci / woodpecker

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

when.status:failure doesn't work across workflows (runs_on:failure) #4355

Open zc-devs opened 1 week ago

zc-devs commented 1 week ago

Component

server

Describe the bug

Step with when.status: [failure] doesn't run on failed pipeline, instead runs step with when.status: [success].

Steps to reproduce

  1. Woodpecker + some Forge
  2. Make a pipeline
# build.yaml
skip_clone: true
steps:
  build:
    image: alpine
    commands:
      - echo 'Building the app'
      - exit 1 # 0 - success, 1 - fail
# notifications.yaml
skip_clone: true
depends_on: [build]
runs_on: [success, failure]
steps:
  fail-notification:
    when:
      - status: [failure]
    image: alpine
    commands:
      - echo 'Build failed'
  success-notification:
    when:
      - status: [success]
    image: alpine
    commands:
      - echo 'Build succeed'
  1. Run manually and get wrong step execution Screenshot 2024-11-11 1

Expected behavior

  1. fail-notification step runs
  2. success-notification skips

System Info

WP `next-f87e80381b`, `2.7.1`, Gitea, Postgres 16

Additional context

https://github.com/woodpecker-ci/woodpecker/issues/4337#issuecomment-2468498847

Validations

pat-s commented 3 days ago

It works within a pipeline but not across, hence the title should likely be updated to include this condition/detail.