Support optional flag in depends_on for workflows and steps#6461
Conversation
6543
left a comment
There was a problem hiding this comment.
I'm against a new top level field and would rather alter tje depends on in a unified way ... so steps also can use it etc...
|
e.g. current -> need more consensus by all maintainers first |
|
looking at #3823 (comment) there is already consensus howbit should look like |
|
Thanks! I also agree to @6543, would prefer a config like depends_on:
- name: previous-step
optional: trueAnd I think we should also support that on step level. |
|
Updated per feedback from @6543 and @qwerty287. The separate depends_on:
- check-a
- name: check-b
optional: trueThis works at both workflow level and step level, as suggested. Plain strings and string arrays still work as before. Implementation follows the approach from #3823 (comment). The new |
e0602da to
2bc5771
Compare
|
Surge PR preview deployment was removed |
This comment was marked as resolved.
This comment was marked as resolved.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6461 +/- ##
==========================================
+ Coverage 42.15% 42.46% +0.31%
==========================================
Files 433 434 +1
Lines 28927 29044 +117
==========================================
+ Hits 12193 12334 +141
+ Misses 15630 15610 -20
+ Partials 1104 1100 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
we should make this ready ... i wana have this in for next release |
|
@qwerty287 I think it is ready ... but you as release manager should decide if we should merge it and release it now or in the next release ... PS: on release docs pull need update ... |
|
I'll check it tomorrow. |
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
…er-ci#6461) Extends `depends_on` to accept objects with `name` and `optional` fields, at both workflow and step level. When `optional: true`, the dependency is silently dropped if the referenced workflow/step is not part of the pipeline (e.g. filtered out by `when` conditions). If present, it is enforced as usual. Co-authored-by: 6543 <6543@obermui.de>
Fixes #6457
Fixes #3823
Summary
Extends
depends_onto accept objects withnameandoptionalfields, at both workflow and step level. Whenoptional: true, the dependency is silently dropped if the referenced workflow/step is not part of the pipeline (e.g. filtered out bywhenconditions). If present, it is enforced as usual.This is useful in monorepos where workflows use
when: pathorwhen: evaluateto only run when relevant files change, but a downstream workflow (like deploy) needs to wait for all checks that actually ran.Example
If
check-bandcheck-care filtered out by their when conditions, deploy runs after check-a succeeds. If they are present, deploy waits for all three.The same syntax works at step level within a workflow.
All existing formats (string, string[]) remain fully backward compatible.
Changes
Dependencystruct andDependsOntype (base/depends_on.go) with custom YAML marshal/unmarshal supporting string, string array, object array, and mixed arrayDependsOntype in bothWorkflowandContainer(step) structs