Эх сурвалжийг харах

Merge branch 'bugfix/ci_auto_checkout_revision_of_project_used_in_ci_v4.0' into 'release/v4.0'

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

See merge request espressif/esp-idf!10675
Angus Gratton 5 жил өмнө
parent
commit
3e44ebd3d7

+ 1 - 1
docs/en/versions.rst

@@ -79,7 +79,7 @@ Checking the Current Version
 The local ESP-IDF version can be checked by using git::
 The local ESP-IDF version can be checked by using git::
 
 
   cd $IDF_PATH
   cd $IDF_PATH
-  git describe --tags --dirty
+  git describe --dirty
 
 
 The ESP-IDF version is also compiled into the firmware and can be accessed (as a string) via the macro ``IDF_VER``. The default ESP-IDF bootloader will print the version on boot (the version information is not always updated in code, it only changes if that particular source file is recompiled).
 The ESP-IDF version is also compiled into the firmware and can be accessed (as a string) via the macro ``IDF_VER``. The default ESP-IDF bootloader will print the version on boot (the version information is not always updated in code, it only changes if that particular source file is recompiled).
 
 

+ 1 - 1
docs/gen-version-specific-includes.py

@@ -198,7 +198,7 @@ def get_version():
 
 
     # Otherwise, use git to look for a tag
     # Otherwise, use git to look for a tag
     try:
     try:
-        tag = subprocess.check_output(["git", "describe", "--tags", "--exact-match"]).strip()
+        tag = subprocess.check_output(["git", "describe", "--exact-match"]).strip()
         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:

+ 1 - 1
docs/issue_template.md

@@ -27,7 +27,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]
 - 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]
 - 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]
 - 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
     // v3.2-dev-1148-g96cd3b75c
 - Build System:         [Make|CMake]
 - Build System:         [Make|CMake]
 - Compiler version (run ``xtensa-esp32-elf-gcc --version`` to find it):
 - Compiler version (run ``xtensa-esp32-elf-gcc --version`` to find it):

+ 1 - 1
docs/zh_CN/versions.rst

@@ -60,7 +60,7 @@ ESP-IDF 采用了 `语义版本管理方法 <http://semver.org/>`_,即您可
 查看 ESP-IDF 本地副本的版本,请使用 git 命令::
 查看 ESP-IDF 本地副本的版本,请使用 git 命令::
 
 
     cd $IDF_PATH
     cd $IDF_PATH
-    git describe --tags --dirty
+    git describe --dirty
 
 
 此外,由于 ESP-IDF 的版本也已编译至固件中,因此您也可以使用宏 ``IDF_VER`` 查看 ESP-IDF 的版本(以字符串的格式)。ESP-IDF 默认引导程序可以在设备启动时打印 ESP-IDF 的版本,但注意代码中的版本信息仅会在源代码重新编译时才会更新,因此打印出来的版本可能并不是最新的。
 此外,由于 ESP-IDF 的版本也已编译至固件中,因此您也可以使用宏 ``IDF_VER`` 查看 ESP-IDF 的版本(以字符串的格式)。ESP-IDF 默认引导程序可以在设备启动时打印 ESP-IDF 的版本,但注意代码中的版本信息仅会在源代码重新编译时才会更新,因此打印出来的版本可能并不是最新的。
 
 

+ 1 - 1
make/project.mk

@@ -327,7 +327,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

+ 1 - 1
tools/ci/check_idf_version.sh

@@ -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}"

+ 1 - 1
tools/ci/checkout_project_ref.py

@@ -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)

+ 13 - 0
tools/ci/config/check.yml

@@ -125,3 +125,16 @@ check_pipeline_triggered_by_label:
     # If the pipeline is triggered with label, the pipeline will only succeeded if "regular_test" label is added.
     # If the pipeline is triggered with label, the pipeline will only succeeded if "regular_test" label is added.
     # We want to make sure some jobs are always executed to detect regression.
     # We want to make sure some jobs are always executed to detect regression.
     - test "$BOT_LABEL_REGULAR_TEST" = "true" || { echo "CI can only pass if 'regular_test' label is included"; exit -1; }
     - test "$BOT_LABEL_REGULAR_TEST" = "true" || { echo "CI can only pass if 'regular_test' label is included"; exit -1; }
+
+# 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
+

+ 1 - 1
tools/idf_tools.py

@@ -843,7 +843,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))