Merge branch 'bugfix/ci_use_local_mirror_for_getting_submodules_v3.3' into 'release/v3.3'

ci: Use local git mirror for getting submodules v3.3

See merge request espressif/esp-idf!10383
This commit is contained in:
Angus Gratton 2020-11-11 08:05:52 +08:00
commit 7a08ec735f
3 changed files with 13 additions and 1 deletions

View File

@ -77,6 +77,7 @@ before_script:
- base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- if [ "${LOCAL_GITLAB_SSH_SERVER:-}" ]; then SRV=${LOCAL_GITLAB_SSH_SERVER##*@};SRV=${SRV%%:*};printf "Host %s\n\tStrictHostKeyChecking no\n" "${SRV}" >> ~/.ssh/config; fi
# Download and install tools, if needed
- *setup_tools_unless_target_test
@ -119,6 +120,7 @@ before_script:
- base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- if [ "${LOCAL_GITLAB_SSH_SERVER:-}" ]; then SRV=${LOCAL_GITLAB_SSH_SERVER##*@};SRV=${SRV%%:*};printf "Host %s\n\tStrictHostKeyChecking no\n" "${SRV}" >> ~/.ssh/config; fi
build_template_app:
stage: build

View File

@ -29,6 +29,12 @@ die() {
[ -z ${CI_PROJECT_DIR} ] && die "This internal script should only be run by a Gitlab CI runner."
[ -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"
REPOSITORY_URL="${CI_REPOSITORY_URL}"
if [ "${LOCAL_GITLAB_SSH_SERVER:-}" ]; then
REPOSITORY_URL="https://gitlab-ci-token:${CI_JOB_TOKEN}@${LOCAL_GITLAB_HTTPS_HOST}/${CI_PROJECT_PATH}"
fi
[ -z ${CI_COMMIT_SHA} ] && die "CI_COMMIT_SHA should be defined to run mirror-submodule-update.sh"
DONT_USE_MIRROR=${DONT_USE_MIRROR:-"0"}
@ -81,7 +87,7 @@ for try in `seq $RETRIES`; do
cd ${CI_PROJECT_DIR} # we are probably already here but pays to be certain
echo "Trying a clean clone of IDF..."
del_files
git clone ${CI_REPOSITORY_URL} . &&
git clone ${REPOSITORY_URL} . &&
git checkout ${CI_COMMIT_SHA} &&
update_submodules &&
echo "Clone strategy succeeded" &&

View File

@ -26,6 +26,10 @@ die() {
[ -z ${GITLAB_SSH_SERVER:-} ] && die "Have to set up GITLAB_SSH_SERVER environment variable"
if [ "${LOCAL_GITLAB_SSH_SERVER:-}" ]; then
GITLAB_SSH_SERVER="${LOCAL_GITLAB_SSH_SERVER}"
fi
ERR_CANNOT_UPDATE=13
REPO_DIR=${1:-"${PWD}"}