Skip to content
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: Check for upstream changes to merge only when planning #3493

Merged

Conversation

finnag
Copy link
Contributor

@finnag finnag commented Jun 6, 2023

what

When using the merge checkout strategy, only check for upstream changes and re-clone when creating a plan.

why

Previously we would check for upstream changes and merge them during any call to Clone(), but if we had already made a plan, this would remove the generated plan. This would always happen if any workflow hooks were defined, and any other PRs had been merged between plan and apply.

It is only safe to re-clone and merge new upstream changes and after grabbing the directory lock, but before creating a plan.

tests

  • I have tested my changes by make test-all and running atlantis against a test-repo.

references

When using the merge checkout strategy, we would peviously
re-clone on upstream updates on any call to Clone(), for example
when running workflow hooks or runing import commands.

If we had already ran a plan, and master was updated, this
would delete the plan and apply would not have anything to
apply.

Modified to only re-clone on upstream updates in doPlan()
@finnag finnag requested a review from a team as a code owner June 6, 2023 10:43
@github-actions github-actions bot added the go Pull requests that update Go code label Jun 6, 2023
@finnag finnag changed the title Check for upstream changes to merge only when planning Fix: Check for upstream changes to merge only when planning Jun 6, 2023
@finnag finnag changed the title Fix: Check for upstream changes to merge only when planning fix: Check for upstream changes to merge only when planning Jun 6, 2023
@jamengual
Copy link
Contributor

@GenPage @nitrocode any comments? It looks good to me

@nitrocode nitrocode added this to the v0.24.3 milestone Jun 6, 2023
@nitrocode nitrocode enabled auto-merge (squash) June 6, 2023 23:12
@nitrocode nitrocode merged commit d1c6851 into runatlantis:main Jun 6, 2023
15 checks passed
mtavaresmedeiros pushed a commit to mtavaresmedeiros/atlantis that referenced this pull request Jul 3, 2023
…tis#3493)

* whitespace fixes

* Only re-clone on upstream updates just before planning

When using the merge checkout strategy, we would peviously
re-clone on upstream updates on any call to Clone(), for example
when running workflow hooks or runing import commands.

If we had already ran a plan, and master was updated, this
would delete the plan and apply would not have anything to
apply.

Modified to only re-clone on upstream updates in doPlan()

* Apply suggestions from code review

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
ijames-gc pushed a commit to gocardless/atlantis that referenced this pull request Feb 13, 2024
…tis#3493)

* whitespace fixes

* Only re-clone on upstream updates just before planning

When using the merge checkout strategy, we would peviously
re-clone on upstream updates on any call to Clone(), for example
when running workflow hooks or runing import commands.

If we had already ran a plan, and master was updated, this
would delete the plan and apply would not have anything to
apply.

Modified to only re-clone on upstream updates in doPlan()

* Apply suggestions from code review

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
ijames-gc pushed a commit to gocardless/atlantis that referenced this pull request Feb 13, 2024
…tis#3493)

* whitespace fixes

* Only re-clone on upstream updates just before planning

When using the merge checkout strategy, we would peviously
re-clone on upstream updates on any call to Clone(), for example
when running workflow hooks or runing import commands.

If we had already ran a plan, and master was updated, this
would delete the plan and apply would not have anything to
apply.

Modified to only re-clone on upstream updates in doPlan()

* Apply suggestions from code review

---------

Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code
Projects
None yet
3 participants