Skip to content

Add Git partial clone support to run-task #1025

Description

@ahal

In Gecko when cloning from Mercurial, we define a set of sparse profiles that then get passed on to robustcheckout.py which then uses them with Mercurial's sparse checkout extension. There's currently no equivalent supported for Git checkouts.

We'll need to add support for partial cloning in Git checkouts if we want to avoid regressing clone performance after switching those tasks.

Delivery Mechanism

We need a way to obtain the sparse profile in the task prior to the proper clone. There are a few options:

  1. Fetch just the sparse-profile blob prior to the proper clone. This is essentially what robustcheckout does, but it's made efficient by the remotefilelog extension on HGMO. I'm unsure if we'd be able to do something similar with Github.
  2. Bake it into the task definition (e.g as an env var)
  3. Upload it as an artifact on the decision task and fetch it

I lean towards option 2 as it seems the simplest and fastest.

Some other implementation notes:

  1. We should only support native Git sparse profile formats (not the bespoke format in Gecko). For compatibility, we'll need a translation layer in gecko_taskgraph to convert the build/sparse-profiles format to the Git one.
  2. We'll need to make sure checkout caches contain the sparse profile name in them so they don't get mixed.
  3. We should only use no-cone mode for now. cone mode should be much faster, but it only works with directories which means won't be compatible with Gecko's existing profiles. In the future we should probably re-write these profiles so we can use cone mode, but that can be a follow-up. This can be achieved with something like:
    git clone --filter=blob:none --no-checkout <url> <dir>
    git -C <dir> sparse-checkout init --no-cone
    git -C <dir> sparse-checkout set --stdin < patterns
    git -C <dir> checkout <rev>
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions