actions / checkout

Action for checking out a repo
https://github.com/features/actions
MIT License
5.92k stars 1.75k forks source link

Checkout with local mirror for self-hosted workers #212

Open zyga opened 4 years ago

zyga commented 4 years ago

Hello

I'd like to explore a way to expand the checkout action to be able to save bandwidth by fetching bulk of the data needed for the checkout from a locally managed mirror.

In my configuration a number of workers are much closer to a local mirror than to the rest of github. Ideally each worker would register the local remote and fetch baseline from said mirror and only then attempt to load the small delta between that an the commit that is being tested.

I'm open to suggestions and ideas on how this can be achieved.

ericsciple commented 4 years ago

Do you need the full history? If not, actions/checkout@v2 is optimized to fetch only a single commit.

ericsciple commented 4 years ago

Self hosted runners benefit between runs from .git folder. Only git objects that haven't already been fetched are downloaded.

zyga commented 4 years ago

@ericsciple hey, thank you for responding!

I don't need the full history but I can save significant bandwidth by synchronizing the full history onto the worker node (and keeping it up-to-date using a timer unit) and only fetching the delta from master.

A single checkout is still relatively significant in my case.

Meanwhile I was looking at the source code and I believe I could introduce a small change where, if a property is set, we first fetch from a helper remote, and then execute the rest of the code path as it is today. I haven't measured it directly but I believe that would bring me some savings.