Hello. I have a project with binary large files stored using LFS, and was trying to deploy to PyPI using the gitlab-runner. The problem I was facing is that as soon as the repository is cloned by the runner, it is immediately dirty, indicating that the LFS-stored files have changes.
After some digging, I found out that git-lfs is not actually installed on the runner, and I assume that the files are downloaded in some other way, making git think that they have changed. Finally, my solution was to bypass this procedure using the
GIT_LFS_SKIP_SMUDGE: "1" variable, downloading and installing git-lfs and using
git lfs pull to get the large files. This way, the local version was still clean and I could use it to deploy.
Here is the relevant part of the .gitlab-ci.yml script:
pypi: stage: deploy image: python:3.5 variables: GIT_LFS_SKIP_SMUDGE: "1" script: - pip install --upgrade pip setuptools wheel twine - curl -L https://github.com/github/git-lfs/releases/download/v1.4.1/git-lfs-linux-amd64-1.4.1.tar.gz | tar xz - pushd git-lfs-1.4.1 - ./install.sh - popd - rm -rf git-lfs-1.4.1 - git lfs pull - python setup.py sdist bdist_wheel - twine upload --username=$PYPI_USERNAME --password=$PYPI_PASSWORD --skip-existing dist/* only: - tags