diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 13:16:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 13:16:36 +0000 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /.gitlab/ci/cache-repo.gitlab-ci.yml | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) | |
download | gitlab-ce-311b0269b4eb9839fa63f80c8d7a58f32b8138a0.tar.gz |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to '.gitlab/ci/cache-repo.gitlab-ci.yml')
-rw-r--r-- | .gitlab/ci/cache-repo.gitlab-ci.yml | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/.gitlab/ci/cache-repo.gitlab-ci.yml b/.gitlab/ci/cache-repo.gitlab-ci.yml deleted file mode 100644 index 98c8c72ae3a..00000000000 --- a/.gitlab/ci/cache-repo.gitlab-ci.yml +++ /dev/null @@ -1,63 +0,0 @@ -# Builds a cached .tar.gz of the $CI_DEFAULT_BRANCH branch with full history and -# uploads it to Google Cloud Storage. This archive is downloaded by a -# script defined by a CI/CD variable named CI_PRE_CLONE_SCRIPT. This has -# two benefits: -# -# 1. It speeds up builds. A 800 MB download only takes seconds. -# 2. It significantly reduces load on the file server. Smaller deltas -# means less time spent in git pack-objects. -# -# Since the destination directory of the archive depends on the project -# ID, this is only run on GitLab.com. -# -# CI_REPO_CACHE_CREDENTIALS contains the Google Cloud service account -# JSON for uploading to the gitlab-ci-git-repo-cache bucket. These -# credentials are stored in the Production vault. -# -# Note that this bucket should be located in the same continent as the -# runner, or network egress charges will apply: -# https://cloud.google.com/storage/pricing -cache-repo: - extends: .cache-repo:rules - image: gcr.io/google.com/cloudsdktool/cloud-sdk:alpine - stage: sync - variables: - GIT_STRATEGY: none - SHALLOW_CLONE_TAR_FILENAME: gitlab-master-shallow.tar - FULL_CLONE_TAR_FILENAME: gitlab-master.tar - before_script: - - '[ -z "$CI_REPO_CACHE_CREDENTIALS" ] || gcloud auth activate-service-account --key-file=$CI_REPO_CACHE_CREDENTIALS' - script: - # 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 [ -z "$DISABLE_SHALLOW_REPO_CACHING" ]; then - cd .. && rm -rf $CI_PROJECT_NAME; - today=$(date +%Y-%m-%d); - year=$(date +%Y); - last_year=`expr $year - 1`; - one_year_ago=$(echo $today | sed "s/$year/$last_year/"); - echo "Cloning $CI_REPOSITORY_URL into $CI_PROJECT_NAME with commits from $one_year_ago."; - time git clone --progress --no-checkout --shallow-since=$one_year_ago $CI_REPOSITORY_URL $CI_PROJECT_NAME; - cd $CI_PROJECT_NAME; - time git repack -d; - echo "Archiving $CI_PROJECT_NAME into /tmp/$SHALLOW_CLONE_TAR_FILENAME."; - time git remote rm origin; - time tar cf /tmp/$SHALLOW_CLONE_TAR_FILENAME .; - echo "GZipping /tmp/$SHALLOW_CLONE_TAR_FILENAME."; - 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 - # 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; - cd $CI_PROJECT_NAME; - time git repack -d; - echo "Archiving $CI_PROJECT_NAME into /tmp/$FULL_CLONE_TAR_FILENAME."; - time git remote rm origin; - time tar cf /tmp/$FULL_CLONE_TAR_FILENAME .; - echo "GZipping /tmp/$FULL_CLONE_TAR_FILENAME."; - time gzip /tmp/$FULL_CLONE_TAR_FILENAME; - [ -z "$CI_REPO_CACHE_CREDENTIALS" ] || (echo "Uploading /tmp/$FULL_CLONE_TAR_FILENAME.gz to GCloud." && time gsutil cp /tmp/$FULL_CLONE_TAR_FILENAME.gz gs://gitlab-ci-git-repo-cache/project-$CI_PROJECT_ID/$FULL_CLONE_TAR_FILENAME.gz); - fi |