Common GitLFS cache configuration


Git LFS, powerful, yet not free. CI can generate a lot of bandwidth pulling the same files (e.g. binary frameworks) over and over again.

I am looking for a simple solution, how to:
Clone repository, but retrieve LFS objects from cache if possible. If LFS object(s) is missing or outdated pull it and put it in the cache, to improve next run.

I found similar topics: one, two, but they don’t contain a “copy-n-paste” answer or are still not fully answered. I am trying to understand how exactly cache-pull/push and clone steps are configured.

I think the use-case is so “normal” that it would be awesome if it was a default behaviour (optionally configurable).


I’ve managed to do something like this, but I believe it’s just too much…

    description: Whatever
    - script@1:
        - content: git lfs uninstall
        title: Uninstall LFS
    - git-clone@6.1: {}
    - cache-pull:
        - is_debug_mode: 'true'
    - script@1:
        - content: |-
            git lfs install
            git lfs pull
        title: Install LFS and Pull
    - cache-push@2:
        - compress_archive: 'true'
        - cache_paths: |-