mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-03 12:44:33 +02:00
Merge branch 'bugfix/ci_auto_checkout_revision_of_project_used_in_ci' into 'master'
CI: get git describe from annotated tags Closes IDFCI-129 and IDFGH-721 See merge request espressif/esp-idf!10671
This commit is contained in:
@@ -196,7 +196,7 @@ def get_version():
|
|||||||
"""
|
"""
|
||||||
# Use git to look for a tag
|
# Use git to look for a tag
|
||||||
try:
|
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
|
is_stable = re.match(r"v[0-9\.]+$", tag) is not None
|
||||||
return (tag, "tag", is_stable)
|
return (tag, "tag", is_stable)
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
|
@@ -338,7 +338,7 @@ endif
|
|||||||
|
|
||||||
# If we have `version.txt` then prefer that for extracting IDF version
|
# If we have `version.txt` then prefer that for extracting IDF version
|
||||||
ifeq ("$(wildcard ${IDF_PATH}/version.txt)","")
|
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
|
else
|
||||||
IDF_VER_T := $(shell cat ${IDF_PATH}/version.txt)
|
IDF_VER_T := $(shell cat ${IDF_PATH}/version.txt)
|
||||||
endif
|
endif
|
||||||
|
@@ -33,7 +33,7 @@ cmake_ver_minor=$(get_ver_from_cmake IDF_VERSION_MINOR)
|
|||||||
cmake_ver_patch=$(get_ver_from_cmake IDF_VERSION_PATCH)
|
cmake_ver_patch=$(get_ver_from_cmake IDF_VERSION_PATCH)
|
||||||
version_from_cmake="${cmake_ver_major}.${cmake_ver_minor}.${cmake_ver_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]+))?.*$"
|
git_desc_regex="^v([0-9]+)\.([0-9]+)(\.([0-9]+))?.*$"
|
||||||
if [[ ! ${git_desc} =~ ${git_desc_regex} ]]; then
|
if [[ ! ${git_desc} =~ ${git_desc_regex} ]]; then
|
||||||
echo "Could not determine the version from 'git describe' output: ${git_desc}"
|
echo "Could not determine the version from 'git describe' output: ${git_desc}"
|
||||||
|
@@ -35,7 +35,7 @@ def target_branch_candidates(proj_name):
|
|||||||
pass
|
pass
|
||||||
# branch name read from IDF
|
# branch name read from IDF
|
||||||
try:
|
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())
|
match = IDF_GIT_DESCRIBE_PATTERN.search(git_describe.decode())
|
||||||
if match:
|
if match:
|
||||||
major_revision = match.group(1)
|
major_revision = match.group(1)
|
||||||
|
@@ -215,3 +215,15 @@ check_codeowners:
|
|||||||
extends: .check_job_template
|
extends: .check_job_template
|
||||||
script:
|
script:
|
||||||
- tools/codeowners.py ci-check
|
- tools/codeowners.py ci-check
|
||||||
|
|
||||||
|
# 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
|
||||||
|
@@ -857,7 +857,7 @@ def get_python_env_path():
|
|||||||
idf_version_str = version_file.read()
|
idf_version_str = version_file.read()
|
||||||
else:
|
else:
|
||||||
try:
|
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()
|
cwd=global_idf_path, env=os.environ).decode()
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
warn('Git describe was unsuccessul: {}'.format(e))
|
warn('Git describe was unsuccessul: {}'.format(e))
|
||||||
|
Reference in New Issue
Block a user