-
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
fix: fetch before checking status #3832
fix: fetch before checking status #3832
Conversation
I don't think this PR works as intended, since it's behind a Note also: If you have managed to plan, apply is safe even if you update main, the project lock should keep you covered. |
I'm not sure I follow. To be clear, I'm not attempting to merge here, or really affect the local checkout in any way. The only goal is to fetch remotes, so that the determination of "has diverged" can be made. Without this change, HasDiverged is only checking to see if the constructed branch has diverged from the local copy of main, which it never will.
This may be true but, from my reading of the From https://www.runatlantis.io/docs/command-requirements.html#meaning-2
This comparison to remote is not currently happening, which my PR attempts to fix. I don't have any recommendation of what to do from the undiverged state, other than to fail the apply per the documentation. |
interesting video related to the conversation https://www.youtube.com/watch?app=desktop&v=rLDKhjJbg3A |
We discussed this at office hours today and I changed the command to |
4cbb7ab
to
a9b86be
Compare
* fix: fetch before checking status * Switch to fetch
* fix: fetch before checking status * Switch to fetch
* fix: fetch before checking status * Switch to fetch
what
Run a fetch (specifically
git remote update
) before runninggit status
when checkingHasDiverged()
why
If you don't pull down any remote refs, there's no point in checking for divergence.
I believe this bug has been present since
undiverged
was introduced as an apply requirement in #1587. The original implementation ofHasDiverged()
, unlikewarnDiverged()
that it was based off, did not run any remote updates (https://github.com/runatlantis/atlantis/pull/1587/files#diff-46caccf1d70c25419bae0a880c70ef586a884d76cb826e1a08e48e11f87c4363R173).I did what I believed to be the minimal possible change to make this work, there might be tweaks in terms of
fetch
vsremote update
, depth, etc.tests
I did the following before and after this change
atlantis plan
main
atlantis apply
Before, the apply went through, and the working directory on disk did not show any divergence.
After, the apply was blocked with the message "Default branch must be rebased onto pull request before running apply.", and on disk divergence was shown
references
closes #3254
introduced in #1587