diff --git a/.gitlab/ci/build.yml b/.gitlab/ci/build.yml index a62517c6ba..25a558181f 100644 --- a/.gitlab/ci/build.yml +++ b/.gitlab/ci/build.yml @@ -179,10 +179,10 @@ build_clang_test_apps_esp32c6: script: - ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh - cd ${IDF_PATH}/tools/test_build_system - - retry_failed git clone $KNOWN_FAILURE_CASES_REPO known_failure_cases + - python tools/ci/get_known_failure_cases_file.py - pytest --parallel-count ${CI_NODE_TOTAL:-1} --parallel-index ${CI_NODE_INDEX:-1} --work-dir ${CI_PROJECT_DIR}/test_build_system --junitxml=${CI_PROJECT_DIR}/XUNIT_RESULT.xml - --ignore-result-files known_failure_cases/known_failure_cases.txt + --ignore-result-files ${KNOWN_FAILURE_CASES_FILE_NAME} pytest_build_system: extends: .test_build_system_template diff --git a/.gitlab/ci/common.yml b/.gitlab/ci/common.yml index 32beb8b84e..e0d994c288 100644 --- a/.gitlab/ci/common.yml +++ b/.gitlab/ci/common.yml @@ -78,6 +78,9 @@ variables: # This is used only if CI_PYTHON_TOOL_REPO is not empty. CI_PYTHON_TOOL_BRANCH: "" + # Set this variable to specify the file name for the known failure cases. + KNOWN_FAILURE_CASES_FILE_NAME: "master.txt" + IDF_CI_BUILD: 1 ################################################ diff --git a/.gitlab/ci/host-test.yml b/.gitlab/ci/host-test.yml index ed71ead85c..9da0101494 100644 --- a/.gitlab/ci/host-test.yml +++ b/.gitlab/ci/host-test.yml @@ -291,13 +291,13 @@ test_pytest_qemu: --collect-app-info "list_job_${CI_JOB_NAME_SLUG}.txt" --modified-components ${MR_MODIFIED_COMPONENTS} --modified-files ${MR_MODIFIED_FILES} - - retry_failed git clone $KNOWN_FAILURE_CASES_REPO known_failure_cases + - python tools/ci/get_known_failure_cases_file.py - run_cmd pytest --target $IDF_TARGET -m qemu --embedded-services idf,qemu --junitxml=XUNIT_RESULT.xml - --ignore-result-files known_failure_cases/known_failure_cases.txt + --ignore-result-files ${KNOWN_FAILURE_CASES_FILE_NAME} --app-info-filepattern \"list_job_*.txt\" --qemu-extra-args \"-global driver=timer.$IDF_TARGET.timg,property=wdt_disable,value=true\" @@ -320,12 +320,12 @@ test_pytest_linux: --collect-app-info "list_job_${CI_JOB_NAME_SLUG}.txt" --modified-components ${MR_MODIFIED_COMPONENTS} --modified-files ${MR_MODIFIED_FILES} - - retry_failed git clone $KNOWN_FAILURE_CASES_REPO known_failure_cases + - python tools/ci/get_known_failure_cases_file.py - run_cmd pytest --target linux -m host_test --junitxml=XUNIT_RESULT.xml - --ignore-result-files known_failure_cases/known_failure_cases.txt + --ignore-result-files ${KNOWN_FAILURE_CASES_FILE_NAME} --app-info-filepattern \"list_job_*.txt\" test_idf_pytest_plugin: diff --git a/tools/ci/dynamic_pipelines/templates/.dynamic_jobs.yml b/tools/ci/dynamic_pipelines/templates/.dynamic_jobs.yml index fc0a0e2289..34234de032 100644 --- a/tools/ci/dynamic_pipelines/templates/.dynamic_jobs.yml +++ b/tools/ci/dynamic_pipelines/templates/.dynamic_jobs.yml @@ -69,7 +69,7 @@ expire_in: 1 week script: # get known failure cases - - retry_failed git clone $KNOWN_FAILURE_CASES_REPO known_failure_cases + - python tools/ci/get_known_failure_cases_file.py # get runner env config file - retry_failed git clone $TEST_ENV_CONFIG_REPO - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs @@ -79,7 +79,7 @@ -m ${ENV_MARKERS} --pipeline-id $PARENT_PIPELINE_ID --junitxml=XUNIT_RESULT_${CI_JOB_NAME_SLUG}.xml - --ignore-result-files known_failure_cases/known_failure_cases.txt + --ignore-result-files ${KNOWN_FAILURE_CASES_FILE_NAME} --parallel-count ${CI_NODE_TOTAL:-1} --parallel-index ${CI_NODE_INDEX:-1} ${PYTEST_EXTRA_FLAGS} diff --git a/tools/ci/exclude_check_tools_files.txt b/tools/ci/exclude_check_tools_files.txt index f8986d11aa..ead47535d0 100644 --- a/tools/ci/exclude_check_tools_files.txt +++ b/tools/ci/exclude_check_tools_files.txt @@ -39,6 +39,7 @@ tools/templates/sample_component/include/main.h tools/templates/sample_component/main.c tools/ci/cleanup_ignore_lists.py tools/ci/artifacts_handler.py +tools/ci/get_known_failure_cases_file.py tools/unit-test-app/**/* tools/ci/gitlab_yaml_linter.py tools/ci/dynamic_pipelines/**/* diff --git a/tools/ci/get_known_failure_cases_file.py b/tools/ci/get_known_failure_cases_file.py new file mode 100644 index 0000000000..dd0f8eefd4 --- /dev/null +++ b/tools/ci/get_known_failure_cases_file.py @@ -0,0 +1,22 @@ +# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Apache-2.0 + +import os + +import urllib3 +from minio import Minio + +from artifacts_handler import get_minio_client + + +def getenv(env_var: str) -> str: + try: + return os.environ[env_var] + except KeyError as e: + raise Exception(f'Environment variable {env_var} not set') from e + + +if __name__ == '__main__': + client = get_minio_client() + file_name = getenv('KNOWN_FAILURE_CASES_FILE_NAME') + client.fget_object('ignore-test-result-files', file_name, file_name)