-
Notifications
You must be signed in to change notification settings - Fork 1
feat(ci): utilize file_not_deleted predicate #74
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
Conversation
f21b734
to
68c3c23
Compare
It looks good to me! Can you confirm how you've tested this please? Definitely the kind of check which it's easy to subtly get wrong in a way that a review is hard to catch. One way to do it would be to upgrade to a fixed version of |
@iainlane the only testing I've done so far is generating a policy and making sure the |
Okay I did some testing but... First I tried to test this using the grafana/github-policy-bot-dev, but the generated file got an invalid policy error. I am guessing it's because the policy-bot GitHub App attached to this repo does not contain the new commit to palantir/policy-bot that defined the logic for the I created this repo and installed a policy-bot GitHub App, ran the policy-bot server locally using ngrok to create a webhook URL. As you can see in the repo I have two test workflows. I used grafana/generate-policy-bot-config to generate a policy config and it spit out: policy:
approval:
- or:
- and:
- Workflow .github/workflows/test-a.yml succeeded or skipped
- Workflow .github/workflows/test-b.yml succeeded or skipped
- default to approval ...at the top-level. However, my understanding is that this setup says that each workflow must succeed in order for the PR to be approved. This negates the purpose of the policy:
approval:
- and:
- or:
- Workflow .github/workflows/test-a.yml succeeded or skipped
- or:
- Workflow .github/workflows/test-b.yml succeeded or skipped ...to ensure that each workflow must succeed or be skipped (and a deleted workflow definition file will result in a skipped rule). However, in testing this I found that even when one rule succeeds and another is skipped, the final evaluation is stuck in a pending state indefinitely--not approved as I want. I feel like this is not the correct/optimal setup here. I still don't fully understand how different teams are using this tool, but I assume most start with a base policy config? Is it the intention of this tool/this change that individual teams set up this top-level logic sufficient to enable the functionality of the new Thanks for any clarification you can give! |
28755fe
to
6123029
Compare
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.
looks great to me 👍
6123029
to
c014f1a
Compare
When a workflow file that a policy rule depends on is deleted in a PR, the rule should be skipped rather than fail. This is achieved by adding the file_not_deleted predicate to each workflow-based policy rule.
c014f1a
to
f801bb6
Compare
When a workflow file that a policy rule depends on is deleted in a PR, the rule should be skipped rather than fail. This is achieved by adding the
file_not_deleted
predicate to each workflow-based policy rule.Closes #178851.