From 1a3fb6a18b655c9dd51e0e14bbce4ed265b9e863 Mon Sep 17 00:00:00 2001 From: ZelinWang Date: Tue, 11 Jul 2023 10:35:33 +0800 Subject: [PATCH] Update breaking_change_test.py --- scripts/ci/breaking_change_test.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/scripts/ci/breaking_change_test.py b/scripts/ci/breaking_change_test.py index 978d0b2aba3..25a41386db8 100644 --- a/scripts/ci/breaking_change_test.py +++ b/scripts/ci/breaking_change_test.py @@ -9,6 +9,8 @@ import logging import os import subprocess +import sys + from util import diff_code from azdev.utilities.path import get_cli_repo_path, get_ext_repo_paths @@ -30,14 +32,17 @@ output_path = '~/_work/1/output_meta' -def install_extensions(diif_ref): +def install_extensions(diif_ref, branch): for tname, ext_path in diif_ref: ext_name = ext_path.split('/')[-1] logger.info(f'installing extension: {ext_name}') cmd = ['azdev', 'extension', 'add', ext_name] logger.info(f'cmd: {cmd}') - out = run(cmd, check=True) - if out.returncode: + out = run(cmd) + if out.returncode and branch == 'base': + print(f"{cmd} failed, extesion {ext_name} is not exist on base branch, skip it.") + continue + else: raise RuntimeError(f"{cmd} failed") @@ -47,7 +52,7 @@ def uninstall_extensions(diif_ref): logger.info(f'uninstalling extension: {ext_name}') cmd = ['azdev', 'extension', 'remove', ext_name] logger.info(f'cmd: {cmd}') - out = run(cmd, check=True) + out = run(cmd) if out.returncode: raise RuntimeError(f"{cmd} failed") @@ -65,7 +70,7 @@ def get_diff_meta_files(diff_ref): cmd = ['git', 'rev-parse', 'HEAD'] print(cmd) subprocess.run(cmd) - install_extensions(diff_ref) + install_extensions(diff_ref, branch='target') cmd = ['azdev', 'command-change', 'meta-export', '--src', src_branch, '--tgt', target_branch, '--repo', get_ext_repo_paths()[0], '--meta-output-path', diff_meta_path] print(cmd) subprocess.run(cmd) @@ -82,7 +87,7 @@ def get_base_meta_files(diff_ref): cmd = ['git', 'rev-parse', 'HEAD'] print(cmd) subprocess.run(cmd) - install_extensions(diff_ref) + install_extensions(diff_ref, branch='base') cmd = ['azdev', 'command-change', 'meta-export', 'EXT', '--meta-output-path', base_meta_path] print(cmd) subprocess.run(cmd)