-
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: clone repository before getting working dir #3867
Conversation
I don't know all the inner workings of Atlantis very well, but the comment above the lock for atlantis/server/events/project_command_builder.go Lines 371 to 375 in 793aafb
Is there any downside to moving the TryLock up as well? |
I missed this, thank you. I don't see any downsides: ab78b2b. I'll test it again and report if I see any issues. |
No issues |
Tested creating a PR with a |
Nice work fixing this. Thank you for contributing the pr. Would it be possible to add a golang test for this as well to ensure this feature doesn't break in the future? |
defer unlockFn() | ||
|
||
ctx.Log.Debug("cloning repository") | ||
_, _, err = p.WorkingDir.Clone(ctx.HeadRepo, ctx.Pull, DefaultWorkspace) |
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.
It's necessary to clone DefaultWorkspace
at this point and not workspace
if DefaultWorkspace != workspace { | ||
ctx.Log.Debug("cloning repository with workspace %s", workspace) | ||
_, _, err = p.WorkingDir.Clone(ctx.HeadRepo, ctx.Pull, workspace) | ||
if err != nil { | ||
return pcc, err | ||
} |
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.
This whole block is unnecessary because this call happens later anyway, but I kept it just in case it's needed for cases that I didn't notice
@nitrocode I adjusted the e2e tests here: 9f4d3e1 Please also check my comments in server/events/project_command_builder.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.
Thanks @ghaiszaher . Approved.
Ill defer to a follow up review before merging.
* fix: clone repository before getting working dir * unrelated change * move TryLock up * fix workspace and add e2e tests * fix description --------- Co-authored-by: PePe Amengual <[email protected]>
* fix: clone repository before getting working dir * unrelated change * move TryLock up * fix workspace and add e2e tests * fix description --------- Co-authored-by: PePe Amengual <[email protected]>
* fix: clone repository before getting working dir * unrelated change * move TryLock up * fix workspace and add e2e tests * fix description --------- Co-authored-by: PePe Amengual <[email protected]>
what
atlantis plan
on specific projects, the repository is not cloned firstatlantis plan -d <dir>
oratlantis plan -p <project>
in either one of the following situations:ATLANTIS_DISABLE_AUTOPLAN = true
is usedATLANTIS_DISABLE_AUTOPLAN_LABEL = "no-autoplan"
is used and the pr is labeled withno-autoplan
why
tests
I have done the tests by running the service locally and using a webhook in a private GitHub project:
sudo rm -r .atlantis
atlantis plan -d my-dir
references