From d0a79c9cc9fc041726796c6707de153e7a6a1e4b Mon Sep 17 00:00:00 2001 From: Chen Yudong Date: Tue, 24 Oct 2023 16:52:47 +0800 Subject: [PATCH] ci(fix): integration test download test bin --- .gitlab/ci/target-test.yml | 2 +- .../ci/integration_test/prepare_test_bins.py | 67 ------------------- 2 files changed, 1 insertion(+), 68 deletions(-) delete mode 100644 tools/ci/integration_test/prepare_test_bins.py diff --git a/.gitlab/ci/target-test.yml b/.gitlab/ci/target-test.yml index 6bd24dcf71..53ecb74549 100644 --- a/.gitlab/ci/target-test.yml +++ b/.gitlab/ci/target-test.yml @@ -816,7 +816,7 @@ component_ut_test_lan8720: CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/tools/ci/integration_test/test_configs" KNOWN_ISSUE_FILE: "${CI_PROJECT_DIR}/tools/ci/integration_test/KnownIssues" CI_RUNNER_SCRIPT: "${CI_PROJECT_DIR}/auto_test_script/bin/CIRunner.py" - PREPARE_TEST_BIN_SCRIPT: "${CI_PROJECT_DIR}/tools/ci/integration_test/prepare_test_bins.py" + PREPARE_TEST_BIN_SCRIPT: "${CI_PROJECT_DIR}/auto_test_script/tools/ci/idf_prepare_test_bins.py" PYTHONPATH: "${CI_PROJECT_DIR}/auto_test_script/packages:${CI_PROJECT_DIR}/tools/ci/python_packages:${PYTHONPATH}" INITIAL_CONDITION_RETRY_COUNT: "1" GIT_LFS_SKIP_SMUDGE: 1 diff --git a/tools/ci/integration_test/prepare_test_bins.py b/tools/ci/integration_test/prepare_test_bins.py deleted file mode 100644 index 8e6598a37e..0000000000 --- a/tools/ci/integration_test/prepare_test_bins.py +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env python -# -# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD -# SPDX-License-Identifier: Apache-2.0 - -import argparse -import os - -import gitlab -import gitlab_api -from AutoTestScript.RunnerConfigs.Config import Config - -SSC_BUILD_JOB_MAP = { - 'ESP32': 'build_ssc_esp32', - 'ESP32C3': 'build_ssc_esp32c3', -} -NEEDED_FILES = [ - 'flasher_args.json', - 'bootloader/bootloader.bin', - 'partition_table/partition-table.bin', - 'ssc.bin', - 'ssc.elf', -] -IDF_PATH = os.environ.get('IDF_PATH') - - -def try_to_download_artifacts(bin_path: str) -> None: - ''' - bin_path: "SSC/ssc_bin/ESP32[C3]/SSC[_APP]" - ''' - project_id = os.getenv('CI_PROJECT_ID') - pipeline_id = os.getenv('CI_PIPELINE_ID') - gitlab_inst = gitlab_api.Gitlab(project_id) - build_job_name = SSC_BUILD_JOB_MAP[bin_path.split('/')[-2]] - job_list = gitlab_inst.find_job_id(build_job_name, pipeline_id=pipeline_id) - files_to_download = [os.path.join(bin_path, f) for f in NEEDED_FILES] - for job_info in job_list: - try: - gitlab_inst.download_artifact(job_info['id'], files_to_download, IDF_PATH) - print('Downloaded {} from {}'.format(bin_path, job_info['id'])) - break - except gitlab.exceptions.GitlabError as e: - if e.response_code == 404: - continue - raise - - -def main() -> None: - parser = argparse.ArgumentParser() - parser.add_argument( - 'test_config_file', - help='The test config file to be used.' - ) - args = parser.parse_args() - - configs = Config.parse(args.test_config_file) - test_bin_paths = configs.get_bin_paths() - - for _path in test_bin_paths: - if os.path.exists(_path): - continue - relative_path = os.path.relpath(_path, IDF_PATH) - try_to_download_artifacts(relative_path) - - -if __name__ == '__main__': - main()