woodpecker-ci / woodpecker

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

Skip steps who depend on an failed step witch ignores failure #3823

Open 6543 opened 1 week ago

6543 commented 1 week ago
when:
  - event: push
    branch: main

steps:
  failing-step:
    image: alpine
    commands:
      - printenv
      - exit 1
    failure: ignore
  should-not-start:
    image: alpine
    commands:
      - printenv
      - exit 1
    depends_on: 
      - failing-step

we should add a new failure mode: skip_dependencies or so ...

so we can make checks and skip things based on that ...

blocked by: #3009

anbraten commented 1 week ago

I don't get your request yet. Isn't your pasted config working already?

Are you talking about a "soft" depends_on that is optional if the previous step was skipped:


steps:
  should-even-start-if-prev-was-skipped:
    image: alpine
    commands:
      - printenv
      - exit 1
    depends_on: 
      - name: skipped-step
        optional: true
6543 commented 1 week ago

huh ... well yes you solution looks better!

it would be:

when:
  - event: push
    branch: main

steps:
  failing-step:
    image: alpine
    commands:
      - printenv
      - exit 1
    failure: ignore
  should-not-start:
    image: alpine
    commands:
      - printenv
      - exit 1
    depends_on: 
      - name: failing-step
        optional: false

where if not set optional would be true by default (to behave backwards comp.)