From d26edd8ddceef7e962af74eae1876f8053809340 Mon Sep 17 00:00:00 2001 From: Winnie Hellmann Date: Wed, 4 Dec 2019 14:46:07 +0000 Subject: [PATCH] Add Git LFS --- .gitlab-ci.yml | 4 ++++ Dockerfile.custom | 7 +++++++ scripts/custom-docker-build | 15 +++++++++++++++ scripts/install-lfs | 14 ++++++++++++++ 4 files changed, 40 insertions(+) create mode 100755 scripts/install-lfs diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7f328c4..dd2b51d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -64,10 +64,12 @@ ruby-2.6-golang-1.13-git-2.24 test: *test_custom # Used by GitLab: https://gitlab.com/gitlab-org/gitlab/blob/master/.gitlab-ci.yml ruby-2.6.3-golang-1.12-git-2.22-chrome-73.0-node-12.x-yarn-1.16-postgresql-9.6-graphicsmagick-1.3.33 test: *test_custom ruby-2.6.3-golang-1.12-git-2.22-chrome-73.0-node-12.x-yarn-1.16-postgresql-10-graphicsmagick-1.3.33 test: *test_custom +ruby-2.6.3-golang-1.12-git-2.22-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-postgresql-10-graphicsmagick-1.3.33 test: *test_custom ruby-2.6.3-golang-1.12-git-2.22-chrome-73.0-node-12.x-yarn-1.16-postgresql-11-graphicsmagick-1.3.33 test: *test_custom # gitlab:assets:compile step ruby-2.6.3-git-2.22-chrome-73.0-node-12.x-yarn-1.16-graphicsmagick-1.3.33-docker-19.03.1 test: *test_custom +ruby-2.6.3-git-2.22-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-graphicsmagick-1.3.33-docker-19.03.1 test: *test_custom # Used by www-gitlab-com's rspec job: https://gitlab.com/gitlab-com/www-gitlab-com/blob/master/.gitlab-ci.yml ruby-2.6.3-git-2.22-chrome-74.0-node-12.x-yarn-1.16-docker-19.03.1 test: *test_custom @@ -120,12 +122,14 @@ ruby-2.6-golang-1.13-git-2.24: *build_and_deploy_custom ruby-2.6.3-golang-1.12-git-2.22-chrome-73.0-node-12.x-yarn-1.16-postgresql-9.6-graphicsmagick-1.3.33: *build_and_deploy_custom ruby-2.6.3-golang-1.12-git-2.22-chrome-73.0-node-12.x-yarn-1.16-postgresql-10-graphicsmagick-1.3.33: *build_and_deploy_custom ruby-2.6.3-golang-1.12-git-2.22-chrome-73.0-node-12.x-yarn-1.16-postgresql-11-graphicsmagick-1.3.33: *build_and_deploy_custom +ruby-2.6.3-golang-1.12-git-2.22-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-postgresql-11-graphicsmagick-1.3.33: *build_and_deploy_custom ruby-2.6.3-golang-1.12-git-2.24-chrome-73.0-node-12.x-yarn-1.16-postgresql-9.6-graphicsmagick-1.3.33: *build_and_deploy_custom ruby-2.6.3-golang-1.12-git-2.24-chrome-73.0-node-12.x-yarn-1.16-postgresql-10-graphicsmagick-1.3.33: *build_and_deploy_custom ruby-2.6.3-golang-1.12-git-2.24-chrome-73.0-node-12.x-yarn-1.16-postgresql-11-graphicsmagick-1.3.33: *build_and_deploy_custom # gitlab:assets:compile step ruby-2.6.3-git-2.22-chrome-73.0-node-12.x-yarn-1.16-graphicsmagick-1.3.33-docker-19.03.1: *build_and_deploy_custom +ruby-2.6.3-git-2.22-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-graphicsmagick-1.3.33-docker-19.03.1: *build_and_deploy_custom # Used by www-gitlab-com's rspec job: https://gitlab.com/gitlab-com/www-gitlab-com/blob/master/.gitlab-ci.yml ruby-2.6.3-git-2.22-chrome-74.0-node-12.x-yarn-1.16-docker-19.03.1: *build_and_deploy_custom diff --git a/Dockerfile.custom b/Dockerfile.custom index a06ef6b..dfeb798 100644 --- a/Dockerfile.custom +++ b/Dockerfile.custom @@ -36,6 +36,13 @@ ARG INSTALL_GOLANG_VERSION ARG GOLANG_DOWNLOAD_SHA256 RUN if [ -n "$INSTALL_GOLANG_VERSION" ] ; then /scripts/install-golang "${INSTALL_GOLANG_VERSION}" "${GOLANG_DOWNLOAD_SHA256}" && go version; fi +# Git LFS (https://git-lfs.github.com/) +ARG LFS_VERSION +ARG LFS_DOWNLOAD_URL=https://github.com/git-lfs/git-lfs/releases/download/v${LFS_VERSION}/git-lfs-linux-amd64-v${LFS_VERSION}.tar.gz +ARG LFS_DOWNLOAD_SHA256 + +RUN if [ -n "$LFS_VERSION" ]; then /scripts/install-lfs && git lfs --version; fi + # Postgres ARG POSTGRES_VERSION RUN if [ -n "$POSTGRES_VERSION" ] ; then /scripts/install-postgresql $POSTGRES_VERSION; fi diff --git a/scripts/custom-docker-build b/scripts/custom-docker-build index b9ed7c4..b171f4f 100755 --- a/scripts/custom-docker-build +++ b/scripts/custom-docker-build @@ -85,6 +85,20 @@ function print_git_args() { printf -- "--build-arg GIT_DOWNLOAD_SHA256=%s " "$GIT_DOWNLOAD_SHA256" } +# see https://github.com/git-lfs/git-lfs/releases +function print_lfs_args() { + case "$1" in + 2.9) + LFS_VERSION=2.9.1 + LFS_DOWNLOAD_SHA256=2a8e60cf51ec45aa0f4332aa0521d60ec75c76e485d13ebaeea915b9d70ea466 + ;; + *) echo "Unknown Git LFS version $1"; exit 1; + esac + + printf -- "--build-arg LFS_VERSION=%s " "$LFS_VERSION" + printf -- "--build-arg LFS_DOWNLOAD_SHA256=%s " "$LFS_DOWNLOAD_SHA256" +} + function print_node_args() { case "$1" in 8.x) NODE_INSTALL_VERSION=8.16.0 ;; @@ -165,6 +179,7 @@ function parse_arguments() { chrome) print_chrome_args $version ;; docker) print_docker_args $version ;; git) print_git_args $version ;; + lfs) print_lfs_args $version ;; node) print_node_args $version ;; yarn) print_yarn_args $version ;; postgresql) print_postgres_args $version ;; diff --git a/scripts/install-lfs b/scripts/install-lfs new file mode 100755 index 0000000..93ba1e9 --- /dev/null +++ b/scripts/install-lfs @@ -0,0 +1,14 @@ +#!/bin/bash + +set -xeuo pipefail +IFS=$'\n\t' + +mkdir build \ + && curl -fsSL "$LFS_DOWNLOAD_URL" -o git-lfs.tar.gz \ + && echo "$LFS_DOWNLOAD_SHA256 git-lfs.tar.gz" | sha256sum -c - \ + && tar -C build -xzf git-lfs.tar.gz \ + && cd build \ + && cp git-lfs /usr/local/bin/ \ + && cd .. \ + && rm -rf build \ + && rm git-lfs.tar.gz