-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support _one of_ for required tasks #789
Support _one of_ for required tasks #789
Conversation
Created as draft, support for the pipeline rules needs to be added. |
} | ||
|
||
_any_missing(required, tasks) := missing if { | ||
# one of required tasks is required | ||
is_array(required) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use a helper method to avoid having to implement the logic for both cases, e.g.
_any_missing(required, tasks) := missing if {
req := setfy(required)
tsk := setfy(tasks)
...
}
setfy(o) := s if {
s := {v | some v in o}
} else := {o}
This could maybe reside in policy/lib/set_helpers.rego
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out we already have that helper there :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would've been nice to unify the two use cases (array vs non-array) which is what I was trying to drive at with this comment. But anyways, the current approach works just as well 😉
0f030b0
to
b3ae211
Compare
Codecov Report
@@ Coverage Diff @@
## main #789 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 86 86
Lines 3342 3425 +83
=========================================
+ Hits 3342 3425 +83
|
This adds support for the notion of _one of_ required tasks from the required tasks list. For example, given required tasks data as: ```yaml - A - [B, C, D] - E ``` Tasks "A", at least one of "B", "C" or "D", and "E" are required.
b3ae211
to
d4e9abf
Compare
With the enterprise-contract/ec-policies#789 merged we can support 'one of' semantic in required task. This changes the definition of required tasks so one of buildah task variants is required. reference: https://issues.redhat.com/browse/RHTAPBUGS-914
Nice. |
This adds support for the notion of one of required tasks from the required tasks list.
For example, given required tasks data as:
Tasks "A", at least one of "B", "C" or "D", and "E" are required.