diff --git a/.gitlab/ci/common.yml b/.gitlab/ci/common.yml index 4e326d675c51..08f5a745a18a 100644 --- a/.gitlab/ci/common.yml +++ b/.gitlab/ci/common.yml @@ -20,8 +20,14 @@ variables: MAKEFLAGS: "-j5 --no-keep-going" # GitLab-CI environment - - # now we have pack-objects cache, so clone strategy is faster than fetch + # Thanks to pack-objects cache, clone strategy should behave faster than fetch + # so we pick "clone" as default git strategy + # Shiny runners by default remove the CI_PROJECT_DIR every time at the beginning of one job + # and clone with a --depth=1 + # Brew runners will fetch from locally mirror first, and cache the local CI_PROJECT_DIR + # In conclusion + # - set GIT_STRATEGY: "clone" to shiny runners + # - set GIT_STRATEGY: "fetch" to brew runners GIT_STRATEGY: clone # we will download archive for each submodule instead of clone. # we don't do "recursive" when fetch submodule as they're not used in CI now. @@ -291,22 +297,6 @@ variables: - *setup_tools_and_idf_python_venv - add_gitlab_ssh_keys -# git describe requires commit history until the latest tag -.before_script:fetch:git_describe: - variables: - GIT_STRAEGY: none - before_script: - - *git_init - - *git_fetch_from_mirror_url_if_exists - - | - git fetch origin refs/tags/"${LATEST_GIT_TAG}":refs/tags/"${LATEST_GIT_TAG}" --depth=1 - git repack -d - git fetch origin $CI_COMMIT_SHA --shallow-since=$(git log -1 --format=%as "${LATEST_GIT_TAG}") - - *git_checkout_fetch_head - - *common-before_scripts - - *setup_tools_and_idf_python_venv - - add_gitlab_ssh_keys - # target test runners may locate in different places # for runners set git mirror, we fetch from the mirror first, then fetch the HEAD commit .before_script:fetch:target_test: diff --git a/.gitlab/ci/pre_check.yml b/.gitlab/ci/pre_check.yml index fe19bad39be3..0ee3dc7a95e8 100644 --- a/.gitlab/ci/pre_check.yml +++ b/.gitlab/ci/pre_check.yml @@ -50,7 +50,13 @@ check_version: extends: - .pre_check_template - .rules:protected - - .before_script:fetch:git_describe + tags: [ brew, github_sync ] + variables: + # need a full clone to get the latest tag + # the --shallow-since=$(git log -1 --format=%as $LATEST_GIT_TAG) option is not accurate + GIT_STRATEGY: fetch + SUBMODULES_TO_FETCH: "none" + GIT_DEPTH: 0 script: - export IDF_PATH=$PWD - tools/ci/check_idf_version.sh @@ -144,7 +150,13 @@ check_version_tag: extends: - .pre_check_template - .rules:tag:release - - .before_script:fetch:git_describe + tags: [ brew, github_sync ] + variables: + # need a full clone to get the latest tag + # the --shallow-since=$(git log -1 --format=%as $LATEST_GIT_TAG) option is not accurate + GIT_STRATEGY: fetch + SUBMODULES_TO_FETCH: "none" + GIT_DEPTH: 0 script: - (git cat-file -t $CI_COMMIT_REF_NAME | grep tag) || (echo "ESP-IDF versions must be annotated tags." && exit 1)