Can Git LFS be added to a machine image?


#1

I’m using circleci/classic:201711-01 on machine executor. Apparently git lfs is not available, and wondering if there’s any plan to add it. Installing git lfs on the fly adds extra 30 seconds which is not great.

And, it’s kind of a related question, I’d like to know what’s the machine executor’s roadmap. It seems it’s not updated for almost a half year.

Thanks!

UPDATE:

I just found a good workaround to shorten the installation step. Git LFS actually works with just one file in $PATH, so it can skip regular apt-get install. In the config.yml the step would look like this:

- restore_cache:
    keys:
      - v1-git-lfs

- run:
    name: "Install git lfs"
    command: |
    if ! [ -x "$(command -v git-lfs)" ]; then
        curl -L -o /tmp/git-lfs.tar.gz \
          https://github.com/git-lfs/git-lfs/releases/download/v2.4.0/git-lfs-linux-amd64-2.4.0.tar.gz
        tar xf /tmp/git-lfs.tar.gz -C /tmp
        sudo /tmp/git-lfs-2.4.0/install.sh
    fi

- save_cache:
    key: v1-gif-lfs
    paths:
      - /usr/local/bin/git-lfs

#2

I think it is possible: try building your own custom image with LFS installed, and then specify the name of the custom image in your config. It will pull from a public or private registry that you specify. See the “custom images” section in the docs.


#3

Custom images is not available for machine :frowning:
https://circleci.com/docs/2.0/executor-types/

I get Specified image is not supported error with one of the pre-built CircleCI docker images.


#4

Ah, righto. I’m in danger of asking an obvious question, but can you use the Docker executor?

Alternatively, 30 seconds is rather hard to improve on, but you could also try making a small image and then launching your own processes inside Docker within a Machine. The delay here would be pulling an image from a remote registry. However, I’ve found I can pull nearly 1G in ~50 seconds, so if you can make a <200M image then that might indeed be faster than what you have now.


#5

I have to use machine as I need the Run privileged containers option available.

Thanks for the workaround! git lfs itself could be containerized.

I still would like to know if there’s any plan updating machine images in the future.


#6

Coolio. If you can base it on Alpine, you might be able to get a very small image. A few of mine are ~50M, and I have several under 100M.


#7