ci: Use local mirrors on the public branches (master, release-) too

Use DONT_USE_MIRROR=1 to force using the original repositories if you need
This commit is contained in:
Anton Maklakov 2018-07-23 17:03:05 +08:00 committed by He Yin Ling
parent bcebf3e6f1
commit 84a32f3288

View File

@ -30,16 +30,16 @@ die() {
[ -z ${GITLAB_SSH_SERVER} ] && die "GITLAB_SSH_SERVER should be defined to run mirror-submodule-update.sh"
[ -z ${CI_REPOSITORY_URL} ] && die "CI_REPOSITORY_URL should be defined to run mirror-submodule-update.sh"
[ -z ${CI_COMMIT_SHA} ] && die "CI_COMMIT_SHA should be defined to run mirror-submodule-update.sh"
[[ ( -z ${IS_PRIVATE} ) && ( -z ${IS_PUBLIC} ) ]] && die "IS_PRIVATE or IS_PUBLIC should be defined in the CI environment."
DONT_USE_MIRROR=${DONT_USE_MIRROR:-"0"}
ERR_CANNOT_UPDATE=13
SCRIPT_DIR=$(dirname -- "${0}")
update_submodules() {
if [ "${IS_PRIVATE}" ]; then
${SCRIPT_DIR}/mirror-submodule-update.sh || return $?
else
if [ "${DONT_USE_MIRROR}" = "1" ]; then
git submodule update --init --recursive
else
${SCRIPT_DIR}/mirror-submodule-update.sh || return $?
fi
}