Skip to content

Commit

Permalink
{CI} Regenerating breaking change report with only_break=True to cont…
Browse files Browse the repository at this point in the history
…rol length within 65535 (#7081)
  • Loading branch information
wangzelin007 authored Dec 13, 2023
1 parent 62e4123 commit b5fc09c
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions scripts/ci/breaking_change_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,21 @@ def get_base_meta_files(diff_ref):
subprocess.run(cmd)


def meta_diff():
def meta_diff(only_break=False):
if os.path.exists(diff_meta_path):
for file in os.listdir(diff_meta_path):
if file.endswith('.json'):
cmd = ['azdev', 'command-change', 'meta-diff', '--base-meta-file', os.path.join(base_meta_path, file), '--diff-meta-file', os.path.join(diff_meta_path, file), '--output-file', os.path.join(output_path, file)]
if only_break:
cmd.append('--only-break')
print(cmd)
subprocess.run(cmd)
cmd = ['ls', '-al', output_path]
print(cmd)
subprocess.run(cmd)


def get_pipeline_result():
def get_pipeline_result(only_break=False):
pipeline_result = {
"breaking_change_test": {
"Details": [
Expand Down Expand Up @@ -148,7 +150,18 @@ def get_pipeline_result():
"Status": "Succeeded",
"Content": ""
})
print(json.dumps(pipeline_result, indent=4))

result_length = len(json.dumps(pipeline_result, indent=4))
if result_length > 65535:
if only_break:
logger.error("Breaking change report exceeds 65535 characters even with only_break=True.")
return pipeline_result

logger.info("Regenerating breaking change report with only_break=True to control length within 65535.")
meta_diff(only_break=True)
pipeline_result = get_pipeline_result(only_break=True)
return pipeline_result

return pipeline_result


Expand Down

0 comments on commit b5fc09c

Please sign in to comment.