diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b8ab5bd4b4..6025fce2e2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/tools/ci/get-full-sources.sh b/tools/ci/get-full-sources.sh index f5df2ddcc5..16884094bc 100755 --- a/tools/ci/get-full-sources.sh +++ b/tools/ci/get-full-sources.sh @@ -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" && diff --git a/tools/ci/mirror-submodule-update.sh b/tools/ci/mirror-submodule-update.sh index 3a15dbe993..624bf857c3 100755 --- a/tools/ci/mirror-submodule-update.sh +++ b/tools/ci/mirror-submodule-update.sh @@ -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}"}