fix: Use HeadRepo instead of BaseRepo in --skip-clone-no-changes flow (#3891)#3900
Conversation
|
did you ever tried this : https://www.runatlantis.io/docs/server-configuration.html#checkout-depth |
|
I did not, but I was able to confirm that hasRepoCfg is always false for fork PRs. Since that is the case a clone will always performed, which seems to contradict the docs for Can you elaborate on how |
I thought your concern was the size of the clone and not the amount of git clone invocations |
The size is not an issue if Without this change the call to Since deploying this branch yesterday, many forked PRs have skipped the cloning flow: Logs |
|
Hi @jamengual, just bumping this thread in hopes this bug fix can get merged in! |
|
@Ulminator Can you resolve the file conflict and we'll get this in the next patch release. Thanks |
Head branch was pushed to by a user without write access
a0ca05d to
5e40641
Compare
|
@GenPage just letting you know that I fixed the merge conflicts! |
5e40641 to
aa58a11
Compare
| func (c *GiteaClient) GetFileContent(logger logging.SimpleLogging, pull models.PullRequest, fileName string) (bool, []byte, error) { | ||
| logger.Debug("Getting file content for %s in Gitea pull request %d", fileName, pull.Num) | ||
|
|
||
| content, resp, err := c.giteaClient.GetContents(pull.BaseRepo.Owner, pull.BaseRepo.Name, pull.HeadCommit, fileName) |
There was a problem hiding this comment.
With this change removing the models.PullRequest from the interface I opted to changing the head commit here to the branch name which seems to be supported by the docs.
https://pkg.go.dev/code.gitea.io/sdk/gitea#Client.GetContents
The name of the commit/branch/tag. Default the repository’s default branch (usually master)
|
@runatlantis/maintainers I know this has been stagnant for awhile, but I'd really like to get this merged. Since I originally wrote this PR the |
Signed-off-by: PePe Amengual <[email protected]>
|
@Ulminator do you have time to finish this? |
|
This issue is stale because it has been open for 1 month with no activity. Remove stale label or comment or this will be closed in 1 month. |
Signed-off-by: Matt Ulmer <[email protected]>
Signed-off-by: Matt Ulmer <[email protected]>
--skip-clone-no-changes flow (#3891)
--skip-clone-no-changes flow (#3891)|
Hey @X-Guardian & @jamengual ! Apologies for taking so long to come back around to this PR. I have addressed all comments and this should be good for another look + hopefully get merged. Please let me know if you need anything else! |
|
LGTM, just make sure to add signoff to your commits, it looks like DCO is failing https://github.com/runatlantis/atlantis/pull/3900/checks?check_run_id=53298787867 |
|
Thanks for the review/approval @lukemassa ! The DCO check seems to be failing due to the top |
|
Thanks @Ulminator for the contributor |
|
Thank you @jamengual ! I'm so glad to finally get this merged 😄 |
…runatlantis#3891) (runatlantis#3900) Signed-off-by: Matt Ulmer <[email protected]> Signed-off-by: PePe Amengual <[email protected]> Co-authored-by: PePe Amengual <[email protected]> Signed-off-by: dimisjim <[email protected]>
…runatlantis#3891) (runatlantis#3900) Signed-off-by: Matt Ulmer <[email protected]> Signed-off-by: PePe Amengual <[email protected]> Co-authored-by: PePe Amengual <[email protected]>
what
This PR modifies the function signature of
VCSClient.GetFileContentand enforces that when attempting to check therepoCfgFileof theHeadBranch, theHeadRepois used instead of theBaseRepo.why
If one is using a forked repo, the
HeadBranchwill not exist on theBaseRepo(or if it does, it's not the branch you actually want).While working in a monorepo that others would fork, the disk space on the VM that Atlantis runs on quickly filled up as every PR made would be cloned. This should not happen when the
--skip-clone-no-changesflag is used, but the logic for that currently ignores fork PRs.tests
I have deployed my branch and validated that PRs from forked repos are not cloned if the files changed in them are outside project directories.
make testpassed as well.Our workflow only uses the GitHub client so the implementation of the GitLab client has not been tested.
references