Add a pending remediation status and support tracking opened PRs#2833
Conversation
| // Case 1 - Do nothing if the evaluation status has not changed and remediation did not errored-out | ||
| if newEval == prevEval && prevRemediation != db.RemediationStatusTypesError { | ||
| return engif.ActionCmdDoNothing | ||
| } |
There was a problem hiding this comment.
aren't there legitimate cases for the PR evaluator where we want to push a new version of the PR even if the evaluation was failure before and is still failing?
e.g. I want frizbee to unroll tags to shas. The evaluation is failing and there is a PR. While the PR is open, someone pushes another workflow with more actions..
There was a problem hiding this comment.
That's a good point, I haven't thought about the frizbee action as I assumed we are proposing only new files so far (dependabot, codeql, trivy, etc). I'll try to think about how to implement that 👍 Do you know if it's working like that right now and this will break it or?
There was a problem hiding this comment.
with frizbee in particular I think the additional changes are the way it works now, yes, because unllike dependabot and codeql where we just put in the content, with frizbee you feed the content you get from evaluation to the frizbee library which modifies it and gives you back the modified content.
There was a problem hiding this comment.
I'm fine fixing this in a follow-up, but could this be solved by:
- if the old status is failure always defer to the remediator
- in the PR remediator, check what HEAD the PR points to. If it is the same as the hash of the commit we created locally, shortcut, otherwise go forward and force-push
- the other remediators we have at least for now are "atomic" so this should not happen in the first place and if it does, then we should have anotoher mechanism that prevents an infinite remediate loop anyway
There was a problem hiding this comment.
I think so 👍 We can also filter this fallback by remediation type, i.e. pull_request to make sure we do that only for this remediation type and not for anything else in future 👍
|
These are the rest of the changes I think we can do in a follow-up PR:
|
Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
jhrozek
left a comment
There was a problem hiding this comment.
Thank you the logic reads much better now. I'm fine merging this and following up on this work with figuring out how to update the pending remediations.
|
Thanks! For anyone else looking at the PR, let's wait a bit until we merge this so we have the smoke test updates in a PR ready for merging too 👍 |
Summary
The following PR:
rule_details_remediatetable for storing the opened PR numberpendingwhen evaluation failed and remediation opened a PRskippedif we don't need remediationsuccessif remediation was considered instant (i.e.rest) but we haven't re-evaluated yet (so rule is still failing).skipped.ClosePullRequest()handlerWhat's left (can be done in a follow-up PR):
Supersedes #2530
Fixes #2526
Fixes #1207
Fixes #1201
Change Type
Mark the type of change your PR introduces:
Testing
Tested locally with a demo repository using the
dependabot_configuredruletype:Start with a failing repo:
Case 1 - Merged the PR
Case 2 - Fixed the issue through another PR
Review Checklist: