-
Notifications
You must be signed in to change notification settings - Fork 26
Add rollback #209
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
base: main
Are you sure you want to change the base?
Add rollback #209
Conversation
pkg/engine/common.go
Outdated
| type empty struct { | ||
| } | ||
|
|
||
| var badCommitList map[plumbing.Hash]empty = make(map[plumbing.Hash]empty) |
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.
super nit: it may be more idiomatic to see:
var badCommitList map[plumbing.Hash]struct{} = make(map[plumbing.Hash]struct{})
rather than defining empty
sallyom
left a comment
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 commented on the single-line errors nit that keeps me up at night.
If it's possible, add a workflow for this b4 merging.
Other than that, lgtm and rollback ftw!
566eee1 to
79a8c10
Compare
This commit adds simple rollback by trying to undo the changes made during a failed Apply by Applying in the opposite direction. Signed-off-by: Joseph Sawaya <[email protected]>
| } | ||
|
|
||
| if _, ok := BadCommitList[directory][m.GetKind()][latest]; ok { | ||
| klog.Infof("No changes applied to target %s this run, %s currently at %s", directory, m.GetKind(), current) |
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.
update klog.Infof to logger.Infof - we transitioned to using zap for logging #225
| if err = m.Apply(ctx, conn, current, latest, tag); err != nil { | ||
| if target.rollback { | ||
| // Roll back automatically | ||
| klog.Errorf("Failed to apply changes, rolling back to %v: %v", current, err) |
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.
klog.Errorf -> logger.Errorf
sallyom
left a comment
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.
- update klog to logger & then run go mod tidy; go mod vendor (might need to run go mod tidy -compat=1.17, since it will try to be compatible with go 1.16 and fail)
- I'm wondering if we should include the opt-in & the boolean type for Rollback - we're only doing that for now bc it's new, right? Maybe we should remove the option and make it the default - but still opt-in for trackBadCommits. wdyt? @cooktheryan ?
|
#242 discussion on whether fetchit should/should not track bad commits |
This PR adds rollback so fetchit won't
have deployed only part of a set of changes
so the state will only correspond to one commit
at a time.
This PR adds simple rollback by trying to
undo the changes made during a failed Apply by
Applying in the opposite direction.
Signed-off-by: Joseph Sawaya [email protected]