Skip to content

Commit

Permalink
Merge branch 'ci/full_fetch_while_check_version_v5.2' into 'release/v…
Browse files Browse the repository at this point in the history
…5.2'

ci: use full fetch while checking git tags (v5.2)

See merge request espressif/esp-idf!29427
  • Loading branch information
dobairoland committed Mar 5, 2024
2 parents 7ec8266 + 112488f commit 99daa62
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
26 changes: 8 additions & 18 deletions .gitlab/ci/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down
16 changes: 14 additions & 2 deletions .gitlab/ci/pre_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 99daa62

Please sign in to comment.