ci: use full fetch while checking git tags

pull/13338/head
Fu Hanxi 2024-03-05 14:51:22 +01:00
rodzic 65515487a9
commit 4b17811c86
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 19399699CF3C4B16
2 zmienionych plików z 22 dodań i 19 usunięć

Wyświetl plik

@ -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.
@ -299,21 +305,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_STRATEGY: 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 $PIPELINE_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:

Wyświetl plik

@ -11,7 +11,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
@ -106,7 +112,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)