-
Notifications
You must be signed in to change notification settings - Fork 11
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
Merge on successful apply #39
Conversation
0d98b79
to
0779625
Compare
Signed-off-by: davidwin93 <dave.winiarski@zapier.com>
Signed-off-by: davidwin93 <dave.winiarski@zapier.com>
Signed-off-by: davidwin93 <dave.winiarski@zapier.com>
Signed-off-by: davidwin93 <dave.winiarski@zapier.com>
0779625
to
9f7e0e2
Compare
Signed-off-by: davidwin93 <dave.winiarski@zapier.com>
Signed-off-by: davidwin93 <dave.winiarski@zapier.com>
874a425
to
66c18e4
Compare
Signed-off-by: davidwin93 <dave.winiarski@zapier.com>
Signed-off-by: davidwin93 <dave.winiarski@zapier.com>
2424d9a
to
2438df8
Compare
Signed-off-by: davidwin93 <dave.winiarski@zapier.com>
pkg/tfc_trigger/tfc_trigger.go
Outdated
@@ -639,6 +639,8 @@ func (t *TFCTrigger) publishRunToStream(ctx context.Context, run *tfe.Run) error | |||
DiscussionID: t.GetMergeRequestDiscussionID(), | |||
RootNoteID: t.GetMergeRequestRootNoteID(), | |||
VcsProvider: t.GetVcsProvider(), | |||
//set Auto Merge if both conditions are met. | |||
AutoMerge: cfgWS.AutoMerge && cfgWS.Mode == "apply-before-merge", |
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.
do we want to surface some kind of error message if auto merge is configured for "merge-before-apply" or "tfc-vcs-repo"?
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.
oh, similar question for "automerge=true" but global auto merge is disabled.
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.
We now log if either condition occurs. Plus the help text in the MR will indicate that a manual merge is required.
) | ||
|
||
func getProperApplyText(rmd runstream.RunMetadata, wsName string) string { | ||
if rmd.GetAutoMerge() && vcs.IsGlobalAutoMergeEnabled() { |
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.
rather than check both rmd.GetAutoMerge() && vcs.IsGlobalAutoMergeEnabled()
in 5 different places, any reason to either put the global check into GetAutoMerge
or check it once before creating the runstream.TFRunMetadata
in tfc_trigger.go?
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 like the idea of putting it in GetAutoMerge. That way if there's a long queued run and the global setting changes it would be respected.
bdca8a3
to
58bf1cb
Compare
docs/usage.md
Outdated
@@ -50,6 +50,8 @@ env: | |||
TFBUDDY_PROJECT_ALLOW_LIST: tfc-project/ | |||
TFBUDDY_WORKSPACE_ALLOW_LIST: tfc-workspace | |||
TFBUDDY_DEFAULT_TFC_ORGANIZATION: companyX | |||
# Optional setting to disable auto merging MRs after a successful apply. This is enabled by default. | |||
TFBUDDY_ENABLE_AUTO_MERGE: "false" |
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.
sorry, one last thing. since this doesn't enable it, but rather prevents it from being enabled per repo, can we rename this "ALLOW_AUTO_MERGE", or something similar?
Signed-off-by: davidwin93 <dave.winiarski@zapier.com>
58bf1cb
to
eaed084
Compare
Signed-off-by: davidwin93 <dave.winiarski@zapier.com>
Signed-off-by: davidwin93 <dave.winiarski@zapier.com>
Signed-off-by: davidwin93 <dave.winiarski@zapier.com>
Signed-off-by: davidwin93 <dave.winiarski@zapier.com>
…for nats dedupe timeout Signed-off-by: davidwin93 <dave.winiarski@zapier.com>
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 good to me! only thing i can see in your most recent commits is the rmd.GetAction() == "apply"
is kind of scary, it'd be nice to have an enum or something there, but go kind of suck w/ enums. maybe just a constant to avoid the strings? not important though, still approved!
Signed-off-by: davidwin93 <dave.winiarski@zapier.com>
Resolves issue #19
Remaining work:
This will only merge after a full apply. This allows multiple targeted applies to be used without concern that the MR will be auto merged.
Tested the following situations: