Commit c0bde996 authored by Stan Hu's avatar Stan Hu

Adjust cache-repo CI stage run conditions

The cache-repo CI stage was failing on gitlab-org/gitlab-foss because
the CI_REPO_CACHE_CREDENTIALS wasn't defined.

We now loosen the restriction of this CI stage to run under two
conditions:

1. On a schedule
2. When CI_REPO_CACHE_CREDENTIALS is defined.

That way, dev.gitlab.org and other instances can produce their own
caches if necessary.

Also this changes the GIT_STRATEGY to none to reduce the overall size of
the pack files and avoid the pre-clone step. The current cache crept up
to close to a 1 GB as a result of an incremental update.
parent 6024c4be
...@@ -18,16 +18,23 @@ ...@@ -18,16 +18,23 @@
# runner, or network egress charges will apply: # runner, or network egress charges will apply:
# https://cloud.google.com/storage/pricing # https://cloud.google.com/storage/pricing
cache-repo: cache-repo:
extends:
- .only:variables_refs-canonical-dot-com-schedules
image: gcr.io/google.com/cloudsdktool/cloud-sdk:alpine image: gcr.io/google.com/cloudsdktool/cloud-sdk:alpine
stage: sync stage: sync
allow_failure: true allow_failure: true
variables: variables:
GIT_DEPTH: 0 GIT_STRATEGY: none
TAR_FILENAME: /tmp/gitlab-master.tar TAR_FILENAME: /tmp/gitlab-master.tar
script: script:
- cd ..
- rm -rf $CI_PROJECT_NAME
- git clone --progress $CI_REPOSITORY_URL $CI_PROJECT_NAME
- cd $CI_PROJECT_NAME
- gcloud auth activate-service-account --key-file=$CI_REPO_CACHE_CREDENTIALS - gcloud auth activate-service-account --key-file=$CI_REPO_CACHE_CREDENTIALS
- tar cf $TAR_FILENAME . - tar cf $TAR_FILENAME .
- gzip $TAR_FILENAME - gzip $TAR_FILENAME
- gsutil cp $TAR_FILENAME.gz gs://gitlab-ci-git-repo-cache/project-$CI_PROJECT_ID/gitlab-master.tar.gz - gsutil cp $TAR_FILENAME.gz gs://gitlab-ci-git-repo-cache/project-$CI_PROJECT_ID/gitlab-master.tar.gz
only:
variables:
- $CI_REPO_CACHE_CREDENTIALS
refs:
- schedules
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment