-
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
The "merge" strategy is broken, wants to revert changes with "The branch we're merging into is ahead, it is recommended to pull new commits first." #2084
Comments
Also running |
is this still happening with |
We still have this issue on v0.19.8 |
Hrm... still seems like an issue |
Thanks @bschaeffer for confirming this is still an issue. Let's reopen it. |
I'm still seeing this behavior in 0.21.0. Looking at server/events/working_dir.go#Clone(), it appears that Atlantis only clones the repo once each time the PR's Is there any reason why Atlantis cannot just fall back to re-cloning the repo if the upstream base branch has diverged? |
@Fabianoshz something to keep in mind to test in your PR. no reason @greghensley this could very well be a bug, if you think that it is and you have tested with different settings and repos, please feel free to submit a PR. |
Hey guys, sorry for the late reply, I'm almost finishing my work on #2921 I can certainly look at this, I didn't changed @greghensley could you pinpoint exactly what code are you referring to? |
@Fabianoshz I'm referring to atlantis/server/events/working_dir.go Lines 115 to 118 in 677fa8f
and suggesting it could be changed to if strings.HasPrefix(currCommit, p.HeadCommit) {
if !w.warnDiverged(log, p, headRepo, cloneDir) {
log.Debug("repo is at correct commit %q so will not re-clone", p.HeadCommit)
return cloneDir, false, nil
}
} Such that, when the local base branch has diverged from the upstream base (and we're using the atlantis/server/events/working_dir.go Line 125 in 677fa8f
That results in the same code-path when either the PR branch is out-of-date or the base branch is out-of-date (and the |
Ok, that makes sense to me, I can try to implement and test this but I might take some time because I still need to finish some work on the single clone PR, if you wish you can open a PR and I can help reviewing and testing or you can wait until I can fix this. |
Community Note
Overview of the Issue
We set
ATLANTIS_CHECKOUT_STRATEGY=merge
in our server. I opened a PR and saw that the lock for the project was held by another PR. No big deal. Once that PR was applied and merged I re-planned my PR only to notice that it wanted to revert the changes just merged to master by the other PR. I see the revert in the plan output and also this comment from atlantis:Reproduction Steps
Open two PRs from the same master commit. PR1 gets the lock, makes a change, merges to master. PR2 now is able to get the lock, but wants to revert the change from PR1. Get this comment:
Expected Results
I expect the
merge
strategy to use a plan based off master AND the changes in my branch. Otherwise what is the point of the locks?Also,
it is recommended
is too soft a comment for this issue. More likeyou will revert the work in master if you do not rebase or merge master into your branch
.Environment details
ATLANTIS_CHECKOUT_STRATEGY=merge
Logs
Additional Context
The text was updated successfully, but these errors were encountered: