diff options
Diffstat (limited to '.gitlab/ci/cache-repo.gitlab-ci.yml')
-rw-r--r-- | .gitlab/ci/cache-repo.gitlab-ci.yml | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/.gitlab/ci/cache-repo.gitlab-ci.yml b/.gitlab/ci/cache-repo.gitlab-ci.yml index 475cbca3156..98c8c72ae3a 100644 --- a/.gitlab/ci/cache-repo.gitlab-ci.yml +++ b/.gitlab/ci/cache-repo.gitlab-ci.yml @@ -28,9 +28,9 @@ cache-repo: before_script: - '[ -z "$CI_REPO_CACHE_CREDENTIALS" ] || gcloud auth activate-service-account --key-file=$CI_REPO_CACHE_CREDENTIALS' script: - # Enable shallow repo caching only if the $ENABLE_SHALLOW_REPO_CACHING variable exists + # Enable shallow repo caching unless the $DISABLE_SHALLOW_REPO_CACHING variable exists (in the case the shallow clone caching isn't working well) # The `git repack` call works around a Git bug with shallow clones: https://gitlab.com/gitlab-org/git/-/issues/86 - - if [ -n "$ENABLE_SHALLOW_REPO_CACHING" ]; then + - if [ -z "$DISABLE_SHALLOW_REPO_CACHING" ]; then cd .. && rm -rf $CI_PROJECT_NAME; today=$(date +%Y-%m-%d); year=$(date +%Y); @@ -47,8 +47,8 @@ cache-repo: time gzip /tmp/$SHALLOW_CLONE_TAR_FILENAME; [ -z "$CI_REPO_CACHE_CREDENTIALS" ] || (echo "Uploading /tmp/$SHALLOW_CLONE_TAR_FILENAME.gz to GCloud." && time gsutil cp /tmp/$SHALLOW_CLONE_TAR_FILENAME.gz gs://gitlab-ci-git-repo-cache/project-$CI_PROJECT_ID/$SHALLOW_CLONE_TAR_FILENAME.gz); fi - # By default, we want to cache the full repo, unless the $DISABLE_FULL_REPO_CACHING variable exists (in the case the shallow clone caching is working well) - - if [ -z "$DISABLE_FULL_REPO_CACHING" ]; then + # Disable the full repo caching unless the $DISABLE_SHALLOW_REPO_CACHING variable exists (in the case the shallow clone caching isn't working well) + - if [ -n "$DISABLE_SHALLOW_REPO_CACHING" ]; then cd .. && rm -rf $CI_PROJECT_NAME; echo "Cloning $CI_REPOSITORY_URL into $CI_PROJECT_NAME."; time git clone --progress $CI_REPOSITORY_URL $CI_PROJECT_NAME; |