Automatic PR Reversal of github in CI+CD+STO pipelines
pending feedback
D
Driving Mockingbird
Trinet requires a first class support for "Git PR reversal" to undoing or reverting changes introduced by a pull request (PR) in a Git repository. This can happen for various reasons, such as if the changes introduced by the PR are found to be problematic, introduce bugs, or if they are no longer needed. Currently, we're using a script as a condition in the rollbacks. We're looking for feature to auto-rollback or revert commits that undoes the changes introduced by the PR changes essentially by using
git revert
command followed by the commit hash of the PR or the specific commit(s) you want to revert.```bash
git revert <commit-hash>
```
Further, the following would be a high value add to Rollback our PR processes at Trinet.
```bash
git reset --hard <commit-hash>
```
```bash
git cherry-pick -m 1 <commit-hash>
```
If the changes introduced by the PR are scattered across multiple commits, you can use an interactive rebase (
git rebase -i
) to selectively remove or modify the commits associated with the PR.After reversing the changes and Rollback is executed, it's important to notify app teams about the reversal and any necessary follow-up actions to avoid any conflicts or confusion.
Log In
s
shivkumar.loka
pending feedback
s
shivkumar.loka
Hi Santhosh
We have implemented this change per our discussion. Here is a snippet of how you can achieve this in Harness CI:
``` yaml
step:
type: Plugin
name: Plugin_1
identifier: Plugin_1
spec:
connectorRef: account.harnessImage
image: plugins/git-revert-commit:linux-amd64
settings:
git_pat: <+secrets.getValue("<your-git-secret>")>
commit_sha: <+codebase.commitSha>
```
You can find more information (like the required and optional parameters) on this enhancement here: https://github.com/harness-community/drone-git-revert-commit/blob/main/README.md#parameters
Please give this a try and your feedback is appreciated.
Thank you
Regards
Shivkumar Loka
Product Team
This post was marked as
in progress
N
Nofar Bluestein
long-term
N
Nofar Bluestein
under review