Skip to content

eng sys: retain only TypeSpec generation path in eng/automation#49549

Open
Copilot wants to merge 4 commits into
mainfrom
copilot/remove-autorest-path-generation
Open

eng sys: retain only TypeSpec generation path in eng/automation#49549
Copilot wants to merge 4 commits into
mainfrom
copilot/remove-autorest-path-generation

Conversation

Copilot AI commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

With the AutoRest toolchain deprecated, the eng/automation generation 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: dropped sdk_automation_autorest(), the AutoRest fallback in sdk_automation(), update_parameters(), and the readme-based main() branch. Also removed the now-unused manual --tsp-config generation path in main() along with its CLI options (--tsp-config, --version, --auto-commit-external-change, --user-name, --user-email), since only the removed generation.yml pipeline invoked it. The CLI now only accepts the positional config (input/output file) arguments used by the spec-gen-sdk CI via sdk_automation.
  • generate_data.py: kept only the TypeSpec data-plane path (sdk_automation_typespec_project) and compile_package; removed all readme/swagger functions and the standalone CLI.
  • generate_utils.py: removed the AutoRest generate(), is_mgmt_premium(), the api-specs.yaml read/write helpers, ListIndentDumper, and now-unused imports. Legacy-code cleanup (deleting old AutoRest-header files on regen) is retained.
  • parameters.py: removed AutoRest-only constants (AUTOREST_*, FLUENT*, MODELERFOUR_ARGUMENTS, README_FORMAT, API_SPECS_FILE, mutable SUFFIX/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-config path in generate.py.
  • Removed the unused/broken legacy pipeline: sdk_generate.py (imported a non-existent symbol — already non-functional), sdk_init.sh, and eng/codegen_to_sdk_config.json.

Intentionally retained

  • api-specs.yaml — still consumed by sdk/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 through generate.py.

Copilot AI and others added 2 commits June 18, 2026 03:40
…omation

Co-authored-by: XiaofeiCao <92354331+XiaofeiCao@users.noreply.github.com>
Co-authored-by: XiaofeiCao <92354331+XiaofeiCao@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove autorest-path from generation scripts eng sys: retain only TypeSpec generation path in eng/automation Jun 18, 2026
Copilot AI requested a review from XiaofeiCao June 18, 2026 03:42
@XiaofeiCao

Copy link
Copy Markdown
Contributor

@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>

Copilot AI commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

@copilot remove unused generation.yml and related path in generate.py

Removed eng/automation/generation.yml and its related manual --tsp-config generation path in generate.py (the CLI args and the main() branch it drove). The spec-gen-sdk CI path via sdk_automation (positional config) is retained. Done in 6f2... (latest commit).

@XiaofeiCao XiaofeiCao marked this pull request as ready for review June 18, 2026 07:08
Copilot AI review requested due to automatic review settings June 18, 2026 07:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py to only support the CI sdk_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 from parameters.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.

Comment on lines 35 to 39
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 weidongxu-microsoft left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. If changelog.py is also dead code, delete it in this PR.
  2. If it's still used, remove the update_parameters call and import from changelog.py — it doesn't actually use the globals that update_parameters sets (it only passes service directly to compile_arm_package and compare_with_maven_package).

🟢 Looks Good

  • generation.yml removal is safe — trigger: none / pr: none, no references from other pipelines.
  • sdk_generate.py removal is safe — already imported a non-existent symbol (non-functional).
  • sdk_init.sh and codegen_to_sdk_config.json removal is safe.
  • api-specs.yaml correctly retained (used by autocent.js).
  • TypeSpec-only sdk_automation() flow preserved correctly.
  • parameters.py cleanup is consistent with remaining code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants