guitarrapc / git-shallow-clone-orb

circleci orb to execute git shallow clone for faster checkout.
https://circleci.com/orbs/registry/orb/guitarrapc/git-shallow-clone
MIT License
21 stars 11 forks source link

Request: Support Source caching #51

Closed lorencr7 closed 1 year ago

lorencr7 commented 1 year ago

Is there an existing issue that is already proposing this?

Describe the problem imposed by not having this feature

When using shallow checkout in addition with the source caching in CCI https://circleci.com/docs/caching/#source-caching the clone fails because the folder isn't empty. This is because the .git folder is restored from a previous build.

The benefits of this is that the shallow checkout generates cache much smaller than the regular checkout (in our case 347MB vs 940MB) and it speeds up a lot the checkout process and cache recovering, consuming less credits as well

Describe the solution you'd like

If you analyze the source code of the default CCI checkout step you can see that they have a condition for this, and instead of cloning the repo, they do a "remote set-url"

if [ -e '/Users/distiller/project/.git' ] ; then echo 'Fetching into existing repository' existing_repo='true' cd '/Users/distiller/project' git remote set-url origin "$CIRCLE_REPOSITORY_URL" || true else echo 'Cloning git repository' existing_repo='false' mkdir -p '/Users/distiller/project' cd '/Users/distiller/project' git clone --no-checkout "$CIRCLE_REPOSITORY_URL" . fi

Could you please add support to your orb to the source-caching provided by CCI?

Thank you

Other

No response

lorencr7 commented 1 year ago

Hi, is there a plan to implement this enhancement? We would really love to start using this orb in our project

guitarrapc commented 1 year ago

Yes, I would like to implement this feature for next. Please wait a momennt.

guitarrapc commented 1 year ago

Confirm current implementation failed with source caching.

https://app.circleci.com/pipelines/github/guitarrapc/git-shallow-clone-orb/368/workflows/c28040dd-b849-4807-a4c3-4ae63b8aa702

image

guitarrapc commented 1 year ago

@lorencr7 I've published v2.7.0 with Source caching support. Can you try it? Please reopen issue when you have issue with.

https://circleci.com/developer/orbs/orb/guitarrapc/git-shallow-clone?version=2.7.0

lorencr7 commented 1 year ago

Yes. If I can't this week, I'll definitely next week. Got some events to attend earlier. I'll let you know, thank you very much

lorencr7 commented 1 year ago

Hello. I just tested it and it is working fine. Thank you very much again