Skip to content

Commit 6300d67

Browse files
CopilotCopilot
andcommitted
ci: migrate sdk-regenerate pipeline from autorest.go
Bring over the ARM SDK regeneration pipeline that produces regenerate PRs against Azure/azure-sdk-for-go, replacing the real ARM service specs that were removed from typespec-go's local test set. Supports both released and dev (locally built) emitter modes, matching the original. Adaptations for typespec-azure: - checkout self as typespec-azure with submodules: recursive (core) - build via root pnpm install + turbo build of @azure-tools/typespec-go... (emitter plus its in-repo workspace deps) instead of a single-package build - add NodeVersion to globals.yml - dev mode: read the emitter's generation-time dependency versions from the packed .tgz (where pnpm rewrites workspace: specifiers to concrete ranges) instead of the source package.json, so emitter-package.json gets valid published versions rather than workspace: specifiers Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 86dd12d commit 6300d67

3 files changed

Lines changed: 513 additions & 0 deletions

File tree

eng/pipelines/sdk-regenerate.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
trigger: none
2+
pr: none
3+
4+
schedules:
5+
- cron: "0 2 * * 1" # Weekly at Monday 2 AM UTC
6+
displayName: Weekly regenerate SDK
7+
branches:
8+
include:
9+
- main
10+
11+
parameters:
12+
- name: UseLatestSpec
13+
default: false
14+
type: boolean
15+
- name: ServiceFilter
16+
type: string
17+
default: '.*'
18+
- name: UseDevPackage
19+
default: false
20+
type: boolean
21+
22+
variables:
23+
- template: /eng/pipelines/templates/variables/globals.yml
24+
- template: /eng/pipelines/templates/variables/image.yml
25+
- group: Release Secrets for GitHub
26+
27+
pool:
28+
name: $(LINUXPOOL)
29+
demands: ImageOverride -equals $(LINUXVMIMAGE)
30+
31+
resources:
32+
repositories:
33+
- repository: azure-sdk-for-go
34+
type: github
35+
name: Azure/azure-sdk-for-go
36+
endpoint: azure
37+
ref: main
38+
39+
jobs:
40+
- job: Generate_SDK
41+
42+
timeoutInMinutes: 120
43+
44+
steps:
45+
- checkout: self
46+
fetchDepth: 1
47+
submodules: recursive
48+
- checkout: azure-sdk-for-go
49+
50+
- task: NodeTool@0
51+
displayName: 'Install Node.js $(NodeVersion)'
52+
inputs:
53+
versionSpec: '$(NodeVersion)'
54+
55+
- script: |
56+
npm i -g corepack@latest
57+
corepack enable
58+
corepack prepare pnpm@latest-10 --activate
59+
displayName: Install pnpm
60+
61+
- script: pnpm install
62+
displayName: pnpm install
63+
workingDirectory: $(Build.SourcesDirectory)/typespec-azure
64+
65+
# Build the emitter together with its in-repo workspace dependencies
66+
# (TCGC, compiler via the core submodule, azure-resource-manager, etc.).
67+
- script: pnpm turbo run --filter "@azure-tools/typespec-go..." build
68+
displayName: pnpm build
69+
workingDirectory: $(Build.SourcesDirectory)/typespec-azure
70+
71+
- script: pnpm pack
72+
displayName: pnpm pack
73+
workingDirectory: $(Build.SourcesDirectory)/typespec-azure/packages/typespec-go
74+
75+
- script: npm install -g @azure-tools/typespec-client-generator-cli
76+
displayName: 'Install tsp-client'
77+
78+
- script: |
79+
python3 $(Build.SourcesDirectory)/typespec-azure/eng/scripts/sdk_regenerate.py --sdk-root=$(Build.SourcesDirectory)/azure-sdk-for-go --typespec-go-root=$(Build.SourcesDirectory)/typespec-azure/packages/typespec-go --typespec-go-branch=$(Build.SourceBranchName) --use-latest-spec=${{ parameters.UseLatestSpec }} --service-filter="${{ parameters.ServiceFilter }}" --use-dev-package=${{ parameters.UseDevPackage }}
80+
displayName: 'Generate SDK'
81+
workingDirectory: $(Build.SourcesDirectory)/azure-sdk-for-go
82+
83+
- template: /eng/common/pipelines/templates/steps/login-to-github.yml@azure-sdk-for-go
84+
parameters:
85+
ScriptDirectory: $(Build.SourcesDirectory)/azure-sdk-for-go/eng/common/scripts
86+
87+
- template: /eng/common/pipelines/templates/steps//create-pull-request.yml@azure-sdk-for-go
88+
parameters:
89+
WorkingDirectory: $(Build.SourcesDirectory)/azure-sdk-for-go
90+
ScriptDirectory: $(Build.SourcesDirectory)/azure-sdk-for-go/eng/common/scripts
91+
RepoName: azure-sdk-for-go
92+
PROwner: Azure
93+
BaseBranchName: 'refs/heads/main'
94+
PRBranchName: typespec-go-regenerate-$(Build.SourceBranchName)
95+
CommitMsg: 'Regenerate SDK based on typespec-go branch $(Build.SourceBranchName)'
96+
PRTitle: '[Automation] Regenerate SDK based on typespec-go branch $(Build.SourceBranchName)'
97+
OpenAsDraft: 'true'
98+
PushArgs: '--force'
99+
AuthToken: $(GH_TOKEN)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
variables:
22
# Disable CodeQL by default to prevent build timeouts
33
Codeql.SkipTaskAutoInjection: true
4+
# Node.js version used by pipelines that install Node via NodeTool (e.g. the
5+
# typespec-go SDK regeneration pipeline).
6+
NodeVersion: "24.x"

0 commit comments

Comments
 (0)