eng sys: retain only TypeSpec generation path in eng/automation#49549
eng sys: retain only TypeSpec generation path in eng/automation#49549Copilot wants to merge 4 commits into
Conversation
…omation Co-authored-by: XiaofeiCao <92354331+XiaofeiCao@users.noreply.github.com>
Co-authored-by: XiaofeiCao <92354331+XiaofeiCao@users.noreply.github.com>
|
@copilot remove unused generation.yml and related path in generate.py |
…h in generate.py Co-authored-by: XiaofeiCao <92354331+XiaofeiCao@users.noreply.github.com>
Removed |
There was a problem hiding this comment.
Pull request overview
Removes the deprecated AutoRest/Swagger generation path and legacy generation pipeline from eng/automation, leaving only the TypeSpec-based generation flow used by spec-gen-sdk CI and related tooling.
Changes:
- Simplified
eng/automation/generate.pyto only support the CIsdk_automation(input_config, output_config)flow (TypeSpec only), removing the legacy AutoRest/manual CLI branches. - Removed AutoRest- and swagger/readme-driven helpers from
generate_data.py,generate_utils.py, and pruned AutoRest-only constants fromparameters.py. - Deleted unused/broken legacy pipeline and scripts (
generation.yml,sdk_generate.py,sdk_init.sh,eng/codegen_to_sdk_config.json).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| eng/codegen_to_sdk_config.json | Removed unused legacy codegen-to-sdk config. |
| eng/automation/sdk_init.sh | Removed legacy init script (no longer used). |
| eng/automation/sdk_generate.py | Removed broken/legacy generation driver script. |
| eng/automation/parameters.py | Dropped AutoRest-only constants; retained TypeSpec-era constants used by current scripts. |
| eng/automation/generation.yml | Removed unused legacy pipeline that was the only consumer of the manual --tsp-config path. |
| eng/automation/generate.py | Removed AutoRest fallback/manual CLI; now TypeSpec-only via CI config input/output. |
| eng/automation/generate_utils.py | Removed AutoRest generation + api-specs.yaml Python helpers; retained TypeSpec utilities and cleanup logic. |
| eng/automation/generate_data.py | Kept only TypeSpec data-plane generation path and compile helper. |
| def parse_args() -> (argparse.ArgumentParser, argparse.Namespace): | ||
| parser = argparse.ArgumentParser() | ||
| parser.add_argument( | ||
| "--spec-root", | ||
| default="https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/", | ||
| help="Spec root folder", | ||
| ) | ||
| parser.add_argument( | ||
| "-r", | ||
| "--readme", | ||
| help='Readme path, Sample: "storage" or "specification/storage/resource-manager/readme.md"', | ||
| ) | ||
| parser.add_argument( | ||
| "-c", | ||
| "--tsp-config", | ||
| help="The top level directory where the tspconfig.yaml for the service lives. " | ||
| "Currently only support remote url with specific commitID " | ||
| "e.g. https://github.com/Azure/azure-rest-api-specs/blob/042e4045dedff4baaf5ae551bf6c8087fbdacd40/specification/deviceregistry/DeviceRegistry.Management/tspconfig.yaml", | ||
| ) | ||
| parser.add_argument("-t", "--tag", help="Specific tag") | ||
| parser.add_argument("-v", "--version", help="Specific sdk version") | ||
| parser.add_argument( | ||
| "-s", | ||
| "--service", | ||
| help="Service Name if not the same as spec name", | ||
| ) | ||
| parser.add_argument( | ||
| "-u", | ||
| "--use", | ||
| default=AUTOREST_JAVA, | ||
| help="Autorest java plugin", | ||
| ) | ||
| parser.add_argument( | ||
| "--autorest", | ||
| default=AUTOREST_CORE_VERSION, | ||
| help="Autorest version", | ||
| ) | ||
| parser.add_argument( | ||
| "--autorest-options", | ||
| default="", | ||
| help="Additional autorest options", | ||
| ) | ||
| parser.add_argument("--suffix", help="Suffix for namespace and artifact") | ||
| parser.add_argument( | ||
| "--auto-commit-external-change", | ||
| action="store_true", | ||
| help="Automatic commit the generated code", | ||
| ) | ||
| parser.add_argument("--user-name", help="User Name for commit") | ||
| parser.add_argument("--user-email", help="User Email for commit") | ||
| parser.add_argument( | ||
| "config", | ||
| nargs="*", |
weidongxu-microsoft
left a comment
There was a problem hiding this comment.
PR Review Summary
Overall: Clean, well-scoped removal of dead AutoRest code. The PR description is thorough.
🔴 Bug: changelog.py will break
eng/automation/changelog.py (not modified by this PR) imports update_parameters from generate.py at line 10:
\\python
from generate import update_parameters
\\
This PR removes update_parameters from generate.py, so changelog.py will fail with an ImportError at import time.
Fix options:
- If
changelog.pyis also dead code, delete it in this PR. - If it's still used, remove the
update_parameterscall and import fromchangelog.py— it doesn't actually use the globals thatupdate_parameterssets (it only passesservicedirectly tocompile_arm_packageandcompare_with_maven_package).
🟢 Looks Good
generation.ymlremoval is safe —trigger: none/pr: none, no references from other pipelines.sdk_generate.pyremoval is safe — already imported a non-existent symbol (non-functional).sdk_init.shandcodegen_to_sdk_config.jsonremoval is safe.api-specs.yamlcorrectly retained (used byautocent.js).- TypeSpec-only
sdk_automation()flow preserved correctly. parameters.pycleanup is consistent with remaining code.
With the AutoRest toolchain deprecated, the
eng/automationgeneration scripts carried a dual AutoRest/Swagger + TypeSpec code path plus a dead legacy pipeline. This removes the AutoRest path, keeping only TypeSpec.Test
local generation looks good:
Generation scripts
generate.py: droppedsdk_automation_autorest(), the AutoRest fallback insdk_automation(),update_parameters(), and the readme-basedmain()branch. Also removed the now-unused manual--tsp-configgeneration path inmain()along with its CLI options (--tsp-config,--version,--auto-commit-external-change,--user-name,--user-email), since only the removedgeneration.ymlpipeline invoked it. The CLI now only accepts the positionalconfig(input/output file) arguments used by the spec-gen-sdk CI viasdk_automation.generate_data.py: kept only the TypeSpec data-plane path (sdk_automation_typespec_project) andcompile_package; removed all readme/swagger functions and the standalone CLI.generate_utils.py: removed the AutoRestgenerate(),is_mgmt_premium(), theapi-specs.yamlread/write helpers,ListIndentDumper, and now-unused imports. Legacy-code cleanup (deleting oldAutoRest-header files on regen) is retained.parameters.py: removed AutoRest-only constants (AUTOREST_*,FLUENT*,MODELERFOUR_ARGUMENTS,README_FORMAT,API_SPECS_FILE, mutableSUFFIX/format params).Pipelines
generation.yml: removed entirely — it was an unused pipeline (trigger: none,pr: none, not referenced anywhere) and the only consumer of the manual--tsp-configpath ingenerate.py.sdk_generate.py(imported a non-existent symbol — already non-functional),sdk_init.sh, andeng/codegen_to_sdk_config.json.Intentionally retained
api-specs.yaml— still consumed bysdk/resourcemanager/autocent.js, so the data file stays even though its Python read/write helpers are gone.swagger_to_sdk_config.json,init.sh,install_instruction.py— still drive active TypeSpec generation throughgenerate.py.