Repository navigation
Skip a plugin step (show it as “skipped”) based on a result computed in an earlier step #7405
Replies: 11 comments 10 replies
|
@zivklein21 i guess you need var eskaping: https://woodpecker-ci.org/docs/usage/environment there is a distinct difference between runtime and compile time variables |
|
A successful no-op does not mark the later step as skipped. The runtime's skip check uses pipeline error state and success/failure flags; exit-code handling treats nonzero codes as errors, without a special case for 78. A marker file and A configuration extension can generate the affected builds before agent steps run. It would need to compute Nx's affected projects itself, with the correct base/head commits and dependencies. It cannot consume Generate only the affected app builds if that meets the goal. Omitted builds will be absent from the graph, though—not grey skipped entries. If retaining every entry with runtime skip status is essential, this does not satisfy it. A planner that triggers child pipelines is another option, with separate pipeline results and authorization to manage. I have checked the runtime/extension contract, not run your Nx repository, and do not have a confirmed roadmap reference for runtime conditionals. |
|
you could also make a pipeline that first evaluates what to trigger and uses the trigger plugin and sets env var in the way to only trigger wanted workflow permutations etc... .. only downside is that you will get two pipelines not directly linked to each other ... |
|
To make the case concrete: I run one workflow with a I did try the trigger-plugin approach, and it was a worse fit for this:
So what I'm looking for is a way for a step to say "stop here, mark the rest as skipped, not failed", inside the same workflow. To address the magic-number concern, the behaviour could be explicit and opt-in instead of a hardcoded 78. For example, per step: steps:
- name: check
image: alpine
commands:
- ./should-run.sh
skip_on_exit_code: 78 # or a listNothing changes unless someone configures it. Users coming from Drone can use 78, and anyone else can pick a code that fits their scripts. Would something along these lines be acceptable? If so, I'm happy to rework the PR to match whatever shape you prefer. |
What I do todayIn my setup the first step of each matrix entry checks whether the app is affected. When it isn't, the step exits with code
The pipeline behaves the way I want, but the status it shows is wrong. With this change the same step exits with |
|
@6543 |
|
At our end, the tool is managed centrally, so updating versions requires an official release since it impacts multiple teams. Can we brainstorm together on how to implement this in a generic way? And if a generic approach isn't feasible right now, why does this capability exist in Drone while it's absent here, given that Woodpecker is originally based on Drone? |
|
If I manage to implement this signals part in a generic way in my fork, do you think it's realistic that it would be reviewed, approved, and merged into an upcoming release? |
|
Thanks for the feedback, both of you. I reworked the idea into a generic mechanism instead of a hardcoded exit code 78, following the SummaryA step can map its own exit codes to signals. When the step exits with a mapped code, the runtime performs the signal's action instead of failing the step. Nothing changes for steps without steps:
check-affected:
image: node
commands:
- npx nx show projects --affected --type app | grep -qx "${APP}" || exit 78
signals:
skip: 78Five signals are implemented:
Config shapeShort form, one code or a list: signals:
skip: 78
success: [1, 2]
restart: 75
cancel: 70
pause: 71Long form, for signals with options: signals:
restart:
exit_codes: [75, 76]
max_restarts: 5 # 1-10, default 2
pause:
exit_codes: 71
timeout: 30m # optional, no decision within 30m ...
on_timeout: resume # ... resume, or decline (default)Validation (compiler and linter): known signal names only, exit codes 1–255, an exit code may be mapped to only one signal per step, How it works
Acceptance cases from @GLec1er
Each case has a runtime test (see below). What I tested
Screenshots from a local instance
Open questions
I'll open the PR as a draft and link it here. |
|
PR: #7478 Thanks, I've applied all three points. I split the work as you suggested. The first PR has the For Thanks for catching the Nx example too. It's only a docs example, and it now checks Nx's exit status first and emits 78 only for grep's no-match status, so an Nx error fails the step. |
|
Would like this feature in the next release |



Uh oh!
There was an error while loading. Please reload this page.
I have an Nx monorepo with several frontend apps under
clients/and shared code underclients/libs/. I use a matrix workflow with one entry per app. Each entry builds and pushes a Docker image with thedocker-buildxplugin.A change in
clients/libs/should rebuild only the apps that depend on that lib. Which apps those are is dynamic. The only reliable way to know is to runnx show projects --affectedinside the pipeline. Path filters can’t express it, because the dependencies change over time.So every matrix entry starts. The first step runs Nx and decides whether this app is affected. If it isn’t, I want the later steps, especially the
docker-buildxplugin step, to be skipped (grey), while the workflow stays green.Simplified workflow
What I tried
exit 1incheck-affected: the following steps don’t run, but the workflow and pipeline turn red.exit 1withfailure: ignore: the workflow stays green, but the next steps still run.when: status: success / failureon the next step: this looks at the workflow status, not at a specific step’s result.when: evaluatechecking an env var or a file:evaluateis resolved before the pipeline starts, so it can’t see anything an earlier step produced..envfile that the buildx plugin reads withenv_file, pointing it to an emptyFROM scratchDockerfile withdry_run: true. It works, but the step still runs and shows green, and it’s a hack.Questions
when: step.check-affected.outcome.steps.<id>.outcomeor Drone’s exit code 78?Thanks!
All reactions