Skip to content

Commit

Permalink
Merge branch 'bugfix/ci_auto_checkout_revision_of_project_used_in_ci_…
Browse files Browse the repository at this point in the history
…v4.2' into 'release/v4.2'

CI: get git describe from annotated tags (v4.2)

See merge request espressif/esp-idf!10673
  • Loading branch information
projectgus committed Oct 8, 2020
2 parents 22a6e21 + 144f459 commit e849a77
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ If the issue cannot be solved after the steps before, please follow these instru
- Development Kit: [ESP32-Wrover-Kit|ESP32-DevKitC|ESP32-PICO-Kit|ESP32-LyraT|ESP32-LyraTD-MSC|none]
- Kit version (for WroverKit/PicoKit/DevKitC): [v1|v2|v3|v4]
- Module or chip used: [ESP32-WROOM-32|ESP32-WROOM-32D|ESP32-WROOM-32U|ESP32-WROVER|ESP32-WROVER-I|ESP32-WROVER-B|ESP32-WROVER-IB|ESP32-SOLO-1|ESP32-PICO-D4|ESP32]
- IDF version (run ``git describe --tags`` to find it):
- IDF version (run ``git describe`` to find it):
// v3.2-dev-1148-g96cd3b75c
- Build System: [Make|CMake|idf.py]
- Compiler version (run ``xtensa-esp32-elf-gcc --version`` to find it):
Expand Down
2 changes: 1 addition & 1 deletion docs/idf_extensions/gen_version_specific_includes.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def get_version():
"""
# Use git to look for a tag
try:
tag = subprocess.check_output(["git", "describe", "--tags", "--exact-match"]).strip().decode('utf-8')
tag = subprocess.check_output(["git", "describe", "--exact-match"]).strip().decode('utf-8')
is_stable = re.match(r"v[0-9\.]+$", tag) is not None
return (tag, "tag", is_stable)
except subprocess.CalledProcessError:
Expand Down
2 changes: 1 addition & 1 deletion make/project.mk
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ endif

# If we have `version.txt` then prefer that for extracting IDF version
ifeq ("$(wildcard ${IDF_PATH}/version.txt)","")
IDF_VER_T := $(shell cd ${IDF_PATH} && git describe --always --tags --dirty)
IDF_VER_T := $(shell cd ${IDF_PATH} && git describe --always --dirty)
else
IDF_VER_T := $(shell cat ${IDF_PATH}/version.txt)
endif
Expand Down
2 changes: 1 addition & 1 deletion tools/ci/check_idf_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ cmake_ver_minor=$(get_ver_from_cmake IDF_VERSION_MINOR)
cmake_ver_patch=$(get_ver_from_cmake IDF_VERSION_PATCH)
version_from_cmake="${cmake_ver_major}.${cmake_ver_minor}.${cmake_ver_patch}"

git_desc=$(git describe --tags)
git_desc=$(git describe)
git_desc_regex="^v([0-9]+)\.([0-9]+)(\.([0-9]+))?.*$"
if [[ ! ${git_desc} =~ ${git_desc_regex} ]]; then
echo "Could not determine the version from 'git describe' output: ${git_desc}"
Expand Down
2 changes: 1 addition & 1 deletion tools/ci/checkout_project_ref.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def target_branch_candidates(proj_name):
pass
# branch name read from IDF
try:
git_describe = subprocess.check_output(["git", "describe", "--tags", "HEAD"])
git_describe = subprocess.check_output(["git", "describe", "HEAD"])
match = IDF_GIT_DESCRIBE_PATTERN.search(git_describe.decode())
if match:
major_revision = match.group(1)
Expand Down
12 changes: 12 additions & 0 deletions tools/ci/config/pre_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,15 @@ check_public_headers:
script:
- python tools/ci/check_public_headers.py --jobs 4 --prefix xtensa-esp32-elf-

# For release tag pipelines only, make sure the tag was created with 'git tag -a' so it will update
# the version returned by 'git describe'
check_version_tag:
extends: .check_job_template
only:
refs:
- /^v\d+\.\d+(\.\d+)?($|-)/
variables:
- $BOT_TRIGGER_WITH_LABEL == null
script:
- (git cat-file -t $CI_COMMIT_REF_NAME | grep tag) || echo "ESP-IDF versions must be annotated tags." && exit 1

2 changes: 1 addition & 1 deletion tools/idf_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ def get_python_env_path():
idf_version_str = version_file.read()
else:
try:
idf_version_str = subprocess.check_output(['git', 'describe', '--tags'],
idf_version_str = subprocess.check_output(['git', 'describe'],
cwd=global_idf_path, env=os.environ).decode()
except subprocess.CalledProcessError as e:
warn('Git describe was unsuccessul: {}'.format(e))
Expand Down

0 comments on commit e849a77

Please sign in to comment.