Skip to content

Commit

Permalink
eng, report error, but do not fail during regen SDK (#2976)
Browse files Browse the repository at this point in the history
  • Loading branch information
weidongxu-microsoft authored Nov 7, 2024
1 parent 9451366 commit 8f6843e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion eng/pipelines/post-publish-sdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ jobs:
filePath: $(Build.SourcesDirectory)/autorest.java/Build-TypeSpec.ps1
workingDirectory: $(Build.SourcesDirectory)/autorest.java

- script: npm install -g @azure-tools/[email protected]
- script: |
npm install -g @azure-tools/typespec-client-generator-cli
displayName: 'Install tsp-client'
- task: PowerShell@2
Expand Down
11 changes: 10 additions & 1 deletion eng/sdk/sync_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

skip_artifacts: List[str] = [
'azure-ai-anomalydetector', # deprecated
'azure-health-insights-cancerprofiling', # deprecated
'azure-ai-vision-imageanalysis' # temporary disabled for modification on Javadoc
]

Expand Down Expand Up @@ -89,6 +90,7 @@ def get_generated_folder_from_artifact(module_path: str, artifact: str, type: st


def update_sdks():
failed_modules = []
for tsp_location_file in glob.glob(os.path.join(sdk_root, 'sdk/*/*/tsp-location.yaml')):
module_path = os.path.dirname(tsp_location_file)
artifact = os.path.basename(module_path)
Expand Down Expand Up @@ -116,7 +118,11 @@ def update_sdks():
# one retry
# sometimes customization have intermittent failure
logging.warning(f'Retry generate for module {artifact}')
subprocess.check_call(['tsp-client', 'update', '--debug'], cwd=module_path)
try:
subprocess.check_call(['tsp-client', 'update', '--debug'], cwd=module_path)
except subprocess.CalledProcessError:
logging.error(f'Failed to generate for module {artifact}')
failed_modules.append(artifact)

if arm_module:
# revert mock test code
Expand All @@ -137,6 +143,9 @@ def update_sdks():
cmd = ['git', 'add', '.']
subprocess.check_call(cmd, cwd=sdk_root)

if failed_modules:
logging.error(f'Failed modules {failed_modules}')


def main():
global sdk_root
Expand Down

0 comments on commit 8f6843e

Please sign in to comment.