[typespec-go] Refine SDK regenerate pipeline - #2021
Closed
Jiaqi Zhang (JiaqiZhang-Dev) wants to merge 13 commits into
Closed
[typespec-go] Refine SDK regenerate pipeline#2021Jiaqi Zhang (JiaqiZhang-Dev) wants to merge 13 commits into
Jiaqi Zhang (JiaqiZhang-Dev) wants to merge 13 commits into
Conversation
…on, optional spec PR
Jiaqi Zhang (JiaqiZhang-Dev)
requested a review
from Ben Broderick Phillips (benbp)
as a code owner
June 29, 2026 05:03
Copilot started reviewing on behalf of
Jiaqi Zhang (JiaqiZhang-Dev)
June 29, 2026 05:04
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refines the SDK regeneration automation to avoid committing regeneration result JSON, preserve Go module paths after regeneration, and optionally open a spec PR to update tspconfig.yaml module suffixes when regeneration bumps module versions.
Changes:
- Stop committing
regenerate-sdk-result.json; instead log it and publish it as a pipeline artifact. - Record each package’s original Go module path from
go.modand restore it across package files after regeneration to avoid unintended/vNbumps. - Add an optional (
CreateSpecPR) workflow to updatetspconfig.yamlmodule entries inazure-rest-api-specsand open an automated PR.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| eng/scripts/sdk_regenerate.py | Adds module-path capture/restore, artifact output, and optional spec PR creation logic. |
| eng/pipelines/sdk-regenerate.yml | Adds CreateSpecPR parameter, checks out azure-rest-api-specs, publishes the result JSON artifact, and wires new script flags. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot started reviewing on behalf of
Jiaqi Zhang (JiaqiZhang-Dev)
June 30, 2026 02:06
View session
Member
|
We are working on the repo migration. Could you put the regen pipeline into this PR? |
Member
|
Move to Azure/azure-sdk-for-go#27137 |
Chenjie Shi (tadelesh)
pushed a commit
to Azure/azure-sdk-for-go
that referenced
this pull request
Jul 20, 2026
Port the metadata parsing refinement from Azure/autorest.go#2021 into the migrated regeneration script. get_api_version_from_metadata now understands the current `{"apiVersions": {namespace: version}}` map in addition to the legacy `{"apiVersion": "..."}` string: it returns a single version when all namespaces share one, otherwise a compact namespace->version JSON map passed to the emitter so each service namespace regenerates at its recorded version. (The result-report-as-artifact change from that PR is already handled here by the --result-file mechanism; the CreateSpecPR / tspconfig module-suffix bump is intentionally not ported.)
Chenjie Shi (tadelesh)
added a commit
to Azure/azure-sdk-for-go
that referenced
this pull request
Jul 20, 2026
* ci: add typespec-go SDK regeneration ADO pipeline Migrated from the Azure DevOps sdk-regenerate.yml pipeline in Azure/autorest.go and relocated here, next to the SDK it regenerates. Regenerates the resource manager SDKs from the @azure-tools/typespec-go emitter and opens a draft PR via the repo's native create-pull-request template. Supports both emitter modes from the original pipeline: - released (default): pin eng/emitter-package.json to the latest published @azure-tools/typespec-go from npm. - dev: build the emitter from an Azure/typespec-azure branch, pnpm pack it, and point eng/emitter-package.json at the tarball. Dependency versions are read from the packed tarball (where pnpm rewrites workspace: specifiers to concrete published ranges) rather than the source package.json. Compile-time path variables select the correct source layout for released (self only) vs dev (self + typespec-azure) runs. Branch/commit/push/PR are handled by the create-pull-request template; sdk_regenerate.py only updates the emitter package and regenerates the SDKs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * ci: keep regeneration report out of the SDK PR Write regenerate-sdk-result.json to a --result-file path outside the SDK working tree (the pipeline points it at ArtifactStagingDirectory and publishes it as a build artifact) so the create-pull-request template's git add -A no longer sweeps it into the regeneration PR. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * ci: support the current _metadata.json apiVersions map format Port the metadata parsing refinement from Azure/autorest.go#2021 into the migrated regeneration script. get_api_version_from_metadata now understands the current `{"apiVersions": {namespace: version}}` map in addition to the legacy `{"apiVersion": "..."}` string: it returns a single version when all namespaces share one, otherwise a compact namespace->version JSON map passed to the emitter so each service namespace regenerates at its recorded version. (The result-report-as-artifact change from that PR is already handled here by the --result-file mechanism; the CreateSpecPR / tspconfig module-suffix bump is intentionally not ported.) * Use authenticated internal npm feed in regen pipeline Sync the approach from Azure/typespec-azure#4663: invoke the create-authenticated-npmrc.yml eng/common step after installing Node so an authenticated \C:\Users\chenjieshi/.npmrc points npm / pnpm / npx at the azure-sdk-for-js internal registry. Every subsequent install (corepack, pnpm install, tsp-client) then resolves packages from the authenticated internal feed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 293999d7-677c-45c7-8ba5-a576210b29cf * Resolve gen-time deps outside the emitter's dependency closure emitter-package.json lists gen-time libraries that some specs import directly but that are not part of @azure-tools/typespec-go's own dependency closure -- notably @azure-tools/typespec-azure-portal-core and @azure-tools/typespec-liftr-base. update_dev_dependencies only refreshed versions found in the emitter's deps, so these were left pinned at a stale wave (e.g. portal-core stuck at 0.68.0 while the rest of the wave moved to 0.70.0), breaking generation. Now these leftover devDependencies are resolved explicitly: from the checked-out typespec-azure workspace package version in dev mode, falling back to the latest published version from the npm registry. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 293999d7-677c-45c7-8ba5-a576210b29cf * Address Copilot review: schedule always:true and skip unused commit lookup - sdk-regenerate.yml: set always:true on the weekly schedule so it keeps running even when main has not changed (the pipeline reacts to external typespec-go emitter releases, which are not commits to this repo). - sdk_regenerate.py: only fetch the latest azure-rest-api-specs commit when use_latest_spec is enabled, so released-emitter runs do not depend on an unrelated (and otherwise unused) GitHub request. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 293999d7-677c-45c7-8ba5-a576210b29cf --------- Co-authored-by: Copilot <copilot@github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: tadelesh <chenjieshi@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refinements to the SDK regenerate pipeline:
regenerate-sdk-result.jsonto the PR, just print it to logs and publish it as a pipeline artifact.CreateSpecPRparameter. When enabled, the pipeline will open a PR toazure-rest-api-specsto bump the go module suffix in tspconfig.yaml for packages whose module version changed.About the module suffix in tspconfig.yaml, there is an existing discussion about it: #1644
Test