-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat(automerge): implement --merge-method flag for apply command #4895
Open
a1k0u
wants to merge
4
commits into
runatlantis:main
Choose a base branch
from
a1k0u:specify-merge-method
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+274
−107
Conversation
This file contains 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
a1k0u
requested review from
GenPage,
lukemassa and
X-Guardian
and removed request for
a team
September 4, 2024 09:26
github-actions
bot
added
docs
Documentation
go
Pull requests that update Go code
provider/github
labels
Sep 4, 2024
chenrui333
added
feature
New functionality/enhancement
and removed
docs
Documentation
labels
Sep 5, 2024
chenrui333
previously approved these changes
Sep 12, 2024
@a1k0u Thanks for implementing this feature. Looks like there is some conflict before merging the PR. |
a1k0u
force-pushed
the
specify-merge-method
branch
from
September 13, 2024 06:12
aeabb57
to
43e0a7a
Compare
@chenrui333 |
a1k0u
force-pushed
the
specify-merge-method
branch
from
September 17, 2024 12:51
43e0a7a
to
20cbcc6
Compare
@chenrui333, hi! Can you review this PR again, please? |
a1k0u
force-pushed
the
specify-merge-method
branch
from
September 25, 2024 18:31
20cbcc6
to
22788e2
Compare
a1k0u
force-pushed
the
specify-merge-method
branch
2 times, most recently
from
October 7, 2024 14:40
2d2aebe
to
138d163
Compare
@chenrui333 @jamengual @X-Guardian, hi! Can you review this PR again, please? |
a1k0u
force-pushed
the
specify-merge-method
branch
2 times, most recently
from
October 11, 2024 16:09
8054e51
to
022e7eb
Compare
a1k0u
force-pushed
the
specify-merge-method
branch
from
October 14, 2024 08:09
022e7eb
to
2fded7d
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
docs
Documentation
feature
New functionality/enhancement
go
Pull requests that update Go code
provider/github
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.
what
Implemented flag which allows to specify merge method for the VCS (GitHub only for now) in automerge process.
why
In our company Atlantis is using not only by DevOps/SRE/Ops Engineers, but also by lot of developers from other teams. They have different git commit message style, different way to split code changes into commits. Sometime we need to ask them to squash/rewrite commit message. These cause problems - after review developers force push changes (squash/rewrite commit message) and later start second
atlantis plan
which should be reviewed second time. Squash fix this, because the result commit message is PR title which can be change without any changes git history.In old logic all methods except of squash can be off and that will fix previous case, but sometimes maintenance engineers work with big task where one pull request has several independent commits which be able to be revert after merge into master (rebase way)
So, these two cases are conflict with each other. We need to control merge method in automerge.
In our company, Atlantis is used not only by DevOps/SRE/Ops engineers, but also by many developers from other teams. They have a different style of git commit messages, a different way of dividing code changes into commits. Sometimes we need to ask them to squash commits/rewrite the commit message.
This causes problems - after first review, the developers force changes (squash commits/rewrite the commit message), and then start the second
atlantis plan
, which must be reviewed a second time. Squash fixes this because the result commit message is a PR header that can be changed without any changes to the git history.In the old logic, all methods except squash can be disabled, and this will fix the previous case, but maintenance engineers often work with a large task where a single pull request contains several independent commits that can be revert after merging into master.
Thus, these two cases conflict with each other, because we need to use different merge strategies in different situations.
This can be fixed if any flag is able to control the merge method for automerge function.
tests
I have tested my changes by extend
TestGithubClient_MergePullCorrectMethod
. Added tests in which the--merge-method
flag has the correct value, where correct value is not allowed and where value is not correct.make test
references
(opened issue) Automerge support for "require linear history" #1176
(opened issue) Feature Request: Allow Auto Merge with Squash or Rebase option #2047