Skip to content

Commit c80d0ad

Browse files
committed
ci: apply idf-ci gitlab dynamic-pipeline-variables
Renamed env vars: - TEST_CASE_FILTERS -> IDF_CI_SELECT_BY_FILTER_EXPR - BUILD_AND_TEST_ALL_APPS -> IDF_CI_SELECT_ALL_PYTEST_CASES Removed env vars; - IS_MR_PIPELINE (could use CI_MERGE_REQUEST_IID) - REPORT_EXIT_CODE -> IDF_CI_IS_DEBUG_PIPELINE (fail fast) - PYTEST_IGNORE_COLLECT_IMPORT_ERROR -> always skip import error
1 parent 0d5b3e6 commit c80d0ad

File tree

11 files changed

+18
-62
lines changed

11 files changed

+18
-62
lines changed

.gitlab-ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ workflow:
88
- if: $CI_OPEN_MERGE_REQUESTS != null
99
variables:
1010
PIPELINE_COMMIT_SHA: $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA
11-
IS_MR_PIPELINE: 1
1211
- if: $CI_OPEN_MERGE_REQUESTS == null
1312
variables:
1413
PIPELINE_COMMIT_SHA: $CI_COMMIT_SHA
15-
IS_MR_PIPELINE: 0
1614
- when: always
1715

1816
# Place the default settings in `.gitlab/ci/common.yml` instead

.gitlab/ci/build.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,9 @@ build_child_pipeline:
307307
- pipeline_variables
308308
- generate_build_child_pipeline
309309
variables:
310-
IS_MR_PIPELINE: $IS_MR_PIPELINE
311310
MR_MODIFIED_COMPONENTS: $MR_MODIFIED_COMPONENTS
312311
MR_MODIFIED_FILES: $MR_MODIFIED_FILES
313312
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
314-
BUILD_AND_TEST_ALL_APPS: $BUILD_AND_TEST_ALL_APPS
315-
REPORT_EXIT_CODE: $REPORT_EXIT_CODE
316313
# https://gitlab.com/gitlab-org/gitlab/-/issues/214340
317314
inherit:
318315
variables: false

.gitlab/ci/pre_check.yml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,10 @@ pipeline_variables:
140140
# MODIFIED_FILES is a list of files that changed, could be used everywhere
141141
- MODIFIED_FILES=$(echo "$GIT_DIFF_OUTPUT" | xargs)
142142
- echo "MODIFIED_FILES=$MODIFIED_FILES" >> pipeline.env
143-
- echo "REPORT_EXIT_CODE=0" >> pipeline.env
144143
# MR_MODIFIED_FILES and MR_MODIFIED_COMPONENTS are semicolon separated lists that is used in MR only
145144
# for non MR pipeline, these are empty lists
146145
- |
147-
if [ $IS_MR_PIPELINE == "0" ]; then
146+
if [ -z "$CI_MERGE_REQUEST_IID" ]; then
148147
echo "MR_MODIFIED_FILES=\"\"" >> pipeline.env
149148
echo "MR_MODIFIED_COMPONENTS=\"\"" >> pipeline.env
150149
else
@@ -154,18 +153,9 @@ pipeline_variables:
154153
MR_MODIFIED_COMPONENTS=$(run_cmd python tools/ci/ci_get_mr_info.py components --modified-files $MODIFIED_FILES | tr '\n' ';')
155154
echo "MR_MODIFIED_COMPONENTS=\"$MR_MODIFIED_COMPONENTS\"" >> pipeline.env
156155
fi
157-
- |
158-
if echo "$CI_MERGE_REQUEST_LABELS" | egrep "(^|,)BUILD_AND_TEST_ALL_APPS(,|$)"; then
159-
echo "BUILD_AND_TEST_ALL_APPS=1" >> pipeline.env
160-
fi
161-
# run full pipeline if testing constraint branch
162-
- |
163-
if [ -n "$CI_PYTHON_CONSTRAINT_BRANCH" ]; then
164-
echo "BUILD_AND_TEST_ALL_APPS=1" >> pipeline.env
165-
fi
166156
- echo "OOCD_DISTRO_URL_ARMHF=$OOCD_DISTRO_URL_ARMHF" >> pipeline.env
167157
- echo "OOCD_DISTRO_URL_ARM64=$OOCD_DISTRO_URL_ARM64" >> pipeline.env
168-
- python tools/ci/ci_process_description.py
158+
- idf-ci gitlab pipeline-variables >> pipeline.env
169159
- cat pipeline.env
170160
- python tools/ci/artifacts_handler.py upload --type modified_files_and_components_report
171161
artifacts:

tools/ci/ci_build_apps.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44
This file is used in CI generate binary files for different kinds of apps
55
"""
6+
67
import argparse
78
import os
89
import sys
@@ -259,7 +260,7 @@ def main(args: argparse.Namespace) -> None:
259260
os.environ[_k] = _v # type: ignore
260261
print(f'env var {_k} set to "{_v}"')
261262

262-
if os.getenv('IS_MR_PIPELINE') == '0' or os.getenv('BUILD_AND_TEST_ALL_APPS') == '1':
263+
if not os.getenv('CI_MERGE_REQUEST_IID') or os.getenv('IDF_CI_SELECT_ALL_PYTEST_CASES') == '1':
263264
print('Build and run all test cases, and compile all cmake apps')
264265
arguments.modified_components = None
265266
arguments.modified_files = None

tools/ci/ci_process_description.py

Lines changed: 0 additions & 28 deletions
This file was deleted.

tools/ci/dynamic_pipelines/scripts/generate_build_child_pipeline.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,10 @@ def main(arguments: argparse.Namespace) -> None:
223223

224224
args = parser.parse_args()
225225

226-
if test_case_filters := os.getenv('TEST_CASE_FILTERS', None):
226+
if test_case_filters := os.getenv('IDF_CI_SELECT_BY_FILTER_EXPR', None):
227227
args.filter_expr = test_case_filters
228228

229-
if os.getenv('IS_MR_PIPELINE') == '0' or os.getenv('BUILD_AND_TEST_ALL_APPS') == '1':
229+
if not os.getenv('CI_MERGE_REQUEST_IID') or os.getenv('IDF_CI_SELECT_ALL_PYTEST_CASES') == '1':
230230
print('Build and run all test cases, and compile all cmake apps')
231231
args.modified_components = None
232232
args.modified_files = None

tools/ci/dynamic_pipelines/scripts/generate_target_test_child_pipeline.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ def get_target_test_jobs(
109109
else:
110110
extra_include_yml = ['tools/ci/dynamic_pipelines/templates/generate_target_test_report.yml']
111111

112-
fast_pipeline_flag = int(os.getenv('REPORT_EXIT_CODE', 0)) == 30
113-
if fast_pipeline_flag:
112+
if os.getenv('IDF_CI_IS_DEBUG_PIPELINE') == '1':
114113
extra_include_yml = ['tools/ci/dynamic_pipelines/templates/fast_pipeline.yml']
115114

116115
no_env_marker_test_cases.sort()

tools/ci/dynamic_pipelines/templates/.dynamic_jobs.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
needs:
2121
- pipeline: $PARENT_PIPELINE_ID
2222
job: generate_build_child_pipeline
23+
- pipeline: $PARENT_PIPELINE_ID
24+
job: pipeline_variables
2325
artifacts:
2426
paths:
2527
# The other artifacts patterns are defined under tools/ci/artifacts_handler.py
@@ -49,6 +51,9 @@
4951
image: $TARGET_TEST_ENV_IMAGE
5052
stage: target_test
5153
timeout: 1 hour
54+
needs:
55+
- pipeline: $PARENT_PIPELINE_ID
56+
job: pipeline_variables
5257
variables:
5358
SUBMODULES_TO_FETCH: "none"
5459
# set while generating the pipeline
@@ -70,10 +75,10 @@
7075
paths:
7176
- XUNIT_RESULT*.xml
7277
- pytest-embedded/
73-
# Child pipeline reports won't be collected in the main one
74-
# https://gitlab.com/groups/gitlab-org/-/epics/8205
75-
# reports:
76-
# junit: XUNIT_RESULT.xml
78+
# Child pipeline reports won't be collected in the main one
79+
# https://gitlab.com/groups/gitlab-org/-/epics/8205
80+
# reports:
81+
# junit: XUNIT_RESULT.xml
7782
when: always
7883
expire_in: 1 week
7984
script:

tools/ci/dynamic_pipelines/templates/test_child_pipeline.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ Pytest Target Test Jobs:
3939
- generate_pytest_child_pipeline
4040
variables:
4141
PARENT_PIPELINE_ID: $PARENT_PIPELINE_ID
42-
REPORT_EXIT_CODE: $REPORT_EXIT_CODE
4342
# https://gitlab.com/gitlab-org/gitlab/-/issues/214340
4443
inherit:
4544
variables: false

tools/ci/exclude_check_tools_files.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ tools/ci/check_test_files.py
1414
tools/ci/checkout_project_ref.py
1515
tools/ci/ci_fetch_submodule.py
1616
tools/ci/ci_get_mr_info.py
17-
tools/ci/ci_process_description.py
1817
tools/ci/cleanup_ignore_lists.py
1918
tools/ci/configure_ci_environment.sh
2019
tools/ci/deploy_docs.py

0 commit comments

Comments
 (0)