feat: allow to filter compose policies based on policy id#8246
Merged
Conversation
Signed-off-by: Olblak <me@olblak.com>
Signed-off-by: Olblak <me@olblak.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for assigning an id to compose policies and filtering which compose policies are processed via new CLI flags, enabling selective execution of policies within a compose file.
Changes:
- Extend compose policy spec with an
idfield and add CLI flags--only-policy-ids/--ignored-policy-idsoncompose {show,diff,apply}. - Implement filtering logic in
Compose.GetPoliciesbased on policy IDs. - Add tests and new compose testdata covering “only” and “ignore” policy ID filtering.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/core/compose/testdata/policies/updatecli-compose.yaml | New compose fixture defining multiple policies, some with id, for filter tests. |
| pkg/core/compose/spec.go | Adds compose-level Values/Secrets and policy-level ID fields to the compose spec. |
| pkg/core/compose/main.go | Updates GetPolicies signature; applies policy ID filtering and prepends global values/secrets to each policy. |
| pkg/core/compose/main_test.go | Adds test cases for onlyPolicyIDs and ignorePolicyIDs filtering behavior. |
| cmd/compose_show.go | Adds --only-policy-ids / --ignored-policy-ids flags and passes them into GetPolicies. |
| cmd/compose_diff.go | Adds --only-policy-ids / --ignored-policy-ids flags and passes them into GetPolicies. |
| cmd/compose_apply.go | Adds --only-policy-ids / --ignored-policy-ids flags and passes them into GetPolicies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Olblak <me@olblak.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a new policy parameter "id" such as
which can then be filtered using either the cli flag
--ignored-policy-idsor--only-policy-idssuch asTest
To test this pull request, you can run the following commands:
Additional Information
Checklist
Tradeoff
Potential improvement