Conversation
jeffvance
reviewed
Jul 18, 2022
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.
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
reviewed
Jul 22, 2022
sallyom
reviewed
Jul 25, 2022
sallyom
reviewed
Jul 25, 2022
sallyom
reviewed
Jul 25, 2022
sallyom
reviewed
Jul 25, 2022
sallyom
reviewed
Jul 25, 2022
sallyom
reviewed
Jul 25, 2022
sallyom
reviewed
Jul 25, 2022
sallyom
reviewed
Jul 25, 2022
Collaborator
sallyom
left a comment
There was a problem hiding this comment.
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 <jsawaya@redhat.com>
sallyom
reviewed
Sep 1, 2022
| } | ||
|
|
||
| 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) |
Collaborator
There was a problem hiding this comment.
update klog.Infof to logger.Infof - we transitioned to using zap for logging #225
sallyom
reviewed
Sep 1, 2022
| 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) |
Collaborator
There was a problem hiding this comment.
klog.Errorf -> logger.Errorf
sallyom
requested changes
Sep 1, 2022
Collaborator
sallyom
left a comment
There was a problem hiding this comment.
- 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 ?
Collaborator
|
#242 discussion on whether fetchit should/should not track bad commits |
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.
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 jsawaya@redhat.com