Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
85bf1b4
Add post-publish-sdk pipeline to regenerate TypeSpec SDKs
XiaofeiCao Jul 8, 2026
dd2e7c0
Simplify TypeSpecJavaPRId parameter displayName
XiaofeiCao Jul 8, 2026
813a81f
Update TypeSpecJavaPRId parameter displayName
XiaofeiCao Jul 8, 2026
90259c8
Use DevPackage boolean toggle with sentinel PRId default
XiaofeiCao Jul 8, 2026
08711ba
Build emitter from main when DevPackage=true and no PRId given
XiaofeiCao Jul 8, 2026
9438cc5
Shorten parameter displayNames
XiaofeiCao Jul 8, 2026
7896b12
Init typespec-azure submodules for dev build
XiaofeiCao Jul 8, 2026
ad234fb
Resolve catalog:/workspace: deps for dev emitter package
XiaofeiCao Jul 9, 2026
e10c21e
Make version-pinned regen the default route (post-publish)
XiaofeiCao Jul 9, 2026
377b2d8
Drop DevPackage; infer route from TypeSpecJavaVersion
XiaofeiCao Jul 9, 2026
7ea6d69
Default TypeSpecJavaVersion to 'none' sentinel
XiaofeiCao Jul 9, 2026
fc918d8
Refine parameter displayNames (Emitter Version)
XiaofeiCao Jul 9, 2026
2247118
Rename to post-publish-emitter.yaml and sync_emitter.py
XiaofeiCao Jul 9, 2026
fc517a5
Rename pipeline parameter TypeSpecJavaVersion to EmitterVersion
XiaofeiCao Jul 9, 2026
5de30fc
Use tsp-client generate-config-files for the published route
XiaofeiCao Jul 9, 2026
fc1b881
Pin dev-route emitter deps to exact versions
XiaofeiCao Jul 9, 2026
e0e3229
Revert "Pin dev-route emitter deps to exact versions"
XiaofeiCao Jul 9, 2026
d844208
Only update emitter version in emitter-package.json, not peer deps
XiaofeiCao Jul 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 157 additions & 0 deletions eng/pipelines/post-publish-emitter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
# Regenerates all TypeSpec-based SDKs in azure-sdk-for-java using the typespec-java emitter,
# then opens an automated draft PR with the results.
#
# The typespec-java emitter lives in Azure/typespec-azure (packages/typespec-java).
# Published route (EmitterVersion set): pins eng/emitter-package.json to that published
# @azure-tools/typespec-java version, then regenerates. This is the post-publish path and does
# not touch typespec-azure sources.
# Dev route (EmitterVersion is 'none'): builds the emitter dev package from source instead
# - from the typespec-azure PR given by PRId, or from the default branch (main) when PRId is 'none'.
trigger: none
pr: none

parameters:
# Set EmitterVersion for the default (post-publish) route. Leave it as 'none' to build the
# emitter from source, in which case PRId selects the typespec-azure PR (or main).
- name: EmitterVersion
displayName: 'Emitter Version — published @azure-tools/typespec-java to regenerate with (e.g. 0.45.4; none = build from source)'
type: string
default: 'none'
- name: PRId
displayName: 'typespec-azure PR ID — used only when Emitter Version is none (e.g. 43321; none = main)'
type: string
default: 'none'

jobs:
- job: Generate_SDK

timeoutInMinutes: 120

variables:
- template: /eng/pipelines/templates/variables/globals.yml
- template: /eng/pipelines/templates/variables/image.yml
- name: NodeVersion
value: '24.x'
# Local clone target for the (public) Azure/typespec-azure emitter repo (dev route only).
- name: TypeSpecAzureDirectory
value: $(Agent.BuildDirectory)/typespec-azure
# For the published route this is the given version. For the dev route it is overwritten at
# runtime from the built emitter's package.json (see 'Get Package Version').
- name: PackageVersion
${{ if ne(parameters.EmitterVersion, 'none') }}:
value: ${{ parameters.EmitterVersion }}
${{ else }}:
value: ''
- name: PullRequestTitleSuffix
${{ if eq(parameters.EmitterVersion, 'none') }}:
${{ if ne(parameters.PRId, 'none') }}:
value: " DEV (typespec-azure PR ${{ parameters.PRId }})"
${{ else }}:
value: " DEV (typespec-azure main)"
${{ else }}:
value: ""

pool:
name: $(LINUXPOOL)
image: $(LINUXVMIMAGE)
os: linux

steps:
# azure-sdk-for-java (self) is the only repo resource, so it is checked out to
# $(Build.SourcesDirectory). Azure/typespec-azure is public, so it is cloned directly
# (below) instead of via a repository resource + GitHub service connection.
- checkout: self

- task: NodeTool@0
displayName: 'Install Node.js $(NodeVersion)'
inputs:
versionSpec: '$(NodeVersion)'

- template: /eng/pipelines/templates/steps/maven-authenticate.yml
parameters:
SourceDirectory: $(Build.SourcesDirectory)

- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml
parameters:
registryUrl: https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/

# Clone the public Azure/typespec-azure repo (dev route only; no service connection required).
# With a PRId specified, fetch and check out that PR ref (a bare number is expanded to
# refs/pull/<id>/merge; a full ref is used as-is). When PRId is 'none', the emitter is built
# from the default branch (main). Submodules are then initialized because typespec-azure
# vendors the TypeSpec compiler and the http-client-java generator via the 'core' submodule,
# which build:generator (Build-Generator.ps1) and tspd both require.
- task: PowerShell@2
displayName: 'Clone typespec-azure'
condition: and(succeeded(), eq('${{ parameters.EmitterVersion }}', 'none'))
inputs:
pwsh: true
targetType: 'inline'
script: |
git clone https://github.com/Azure/typespec-azure.git "$(TypeSpecAzureDirectory)"
$prId = '${{ parameters.PRId }}'
if ($prId -and $prId -ne 'none') {
if ($prId -match '^\d+$') {
$ref = "refs/pull/$prId/merge"
} else {
$ref = $prId
}
Write-Host "Fetching typespec-azure ref $ref"
git -C "$(TypeSpecAzureDirectory)" fetch origin $ref
git -C "$(TypeSpecAzureDirectory)" checkout FETCH_HEAD
}
git -C "$(TypeSpecAzureDirectory)" submodule update --init --recursive

# Build the emitter dev package (.tgz) from the typespec-azure PR.
# typespec-java depends on other workspace packages (workspace:^). First build only those
# upstream dependencies with turbo (the `^...` filter selects dependencies but excludes
# typespec-java itself). Then Build-TypeSpec.ps1 builds and packs typespec-java (its
# build:generator step runs Build-Generator.ps1, which needs JDK 11+ and Maven), producing
# the .tgz next to the package.json for sync_emitter.py to pick up.
- task: PowerShell@2
retryCountOnTaskFailure: 1
condition: and(succeeded(), eq('${{ parameters.EmitterVersion }}', 'none'))
displayName: 'Build typespec-java dev package'
inputs:
pwsh: true
targetType: 'inline'
script: |
corepack enable
pnpm install
pnpm turbo run build --filter "@azure-tools/typespec-java^..."
./packages/typespec-java/Build-TypeSpec.ps1
workingDirectory: $(TypeSpecAzureDirectory)

- script: |
npm install -g @azure-tools/typespec-client-generator-cli
displayName: 'Install tsp-client'

# Dev route only: the built emitter's version drives the PR title. For the published route
# PackageVersion is already the given EmitterVersion.
- task: PowerShell@2
displayName: 'Get Package Version'
condition: and(succeeded(), eq('${{ parameters.EmitterVersion }}', 'none'))
inputs:
pwsh: true
targetType: 'inline'
script: |
$PACKAGE_VERSION = node -p -e "require('./packages/typespec-java/package.json').version"
Write-Host("##vso[task.setvariable variable=PackageVersion]$PACKAGE_VERSION")
workingDirectory: $(TypeSpecAzureDirectory)

- script: |
python3 ./eng/pipelines/scripts/sync_emitter.py --sdk-root=$(Build.SourcesDirectory) --emitter-version='${{ parameters.EmitterVersion }}' --package-json-path=$(TypeSpecAzureDirectory)/packages/typespec-java/package.json
displayName: 'Generate SDK'
workingDirectory: $(Build.SourcesDirectory)

- template: /eng/common/pipelines/templates/steps/create-pull-request.yml
parameters:
WorkingDirectory: $(Build.SourcesDirectory)
ScriptDirectory: $(Build.SourcesDirectory)/eng/common/scripts
RepoName: azure-sdk-for-java
BaseBranchName: 'refs/heads/main'
PRBranchName: typespec-java-generation-$(Build.BuildId)
CommitMsg: '[Automation] Generate SDK based on TypeSpec $(PackageVersion)$(PullRequestTitleSuffix)'
PRTitle: '[Automation] Generate SDK based on TypeSpec $(PackageVersion)$(PullRequestTitleSuffix)'
PRLabels: 'DPG'
OpenAsDraft: 'true'
239 changes: 239 additions & 0 deletions eng/pipelines/scripts/patches/0001-key-certificates-impl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
From e2df7de3f5643ff2006a8244e28ed9aa3598ecf3 Mon Sep 17 00:00:00 2001
From: Weidong Xu <weidxu@microsoft.com>
Date: Thu, 11 Jun 2026 20:39:16 +0800
Subject: [PATCH] Revert "regen"

This reverts commit 7ccefe36941cc38f14a52ca796167a95f263ce3f.
---
.../models/CertificatePolicy.java | 66 ++++++++++++++-----
1 file changed, 51 insertions(+), 15 deletions(-)

diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificatePolicy.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificatePolicy.java
index e16ea8f5900..33d11980151 100644
--- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificatePolicy.java
+++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificatePolicy.java
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.
+
package com.azure.security.keyvault.certificates.implementation.models;

import com.azure.core.annotation.Fluent;
@@ -9,6 +10,7 @@ import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
+import com.azure.security.keyvault.certificates.models.PlatformManaged;
import java.io.IOException;
import java.util.List;

@@ -17,7 +19,6 @@ import java.util.List;
*/
@Fluent
public final class CertificatePolicy implements JsonSerializable<CertificatePolicy> {
-
/*
* The certificate id.
*/
@@ -60,6 +61,12 @@ public final class CertificatePolicy implements JsonSerializable<CertificatePoli
@Generated
private CertificateAttributes attributes;

+ /*
+ * Configuration that enables the platform to manage the certificate on behalf of the user.
+ */
+ @Generated
+ private PlatformManaged platformManaged;
+
/**
* Creates an instance of CertificatePolicy class.
*/
@@ -69,7 +76,7 @@ public final class CertificatePolicy implements JsonSerializable<CertificatePoli

/**
* Get the id property: The certificate id.
- *
+ *
* @return the id value.
*/
@Generated
@@ -79,7 +86,7 @@ public final class CertificatePolicy implements JsonSerializable<CertificatePoli

/**
* Get the keyProperties property: Properties of the key backing a certificate.
- *
+ *
* @return the keyProperties value.
*/
@Generated
@@ -89,7 +96,7 @@ public final class CertificatePolicy implements JsonSerializable<CertificatePoli

/**
* Set the keyProperties property: Properties of the key backing a certificate.
- *
+ *
* @param keyProperties the keyProperties value to set.
* @return the CertificatePolicy object itself.
*/
@@ -101,7 +108,7 @@ public final class CertificatePolicy implements JsonSerializable<CertificatePoli

/**
* Get the secretProperties property: Properties of the secret backing a certificate.
- *
+ *
* @return the secretProperties value.
*/
@Generated
@@ -111,7 +118,7 @@ public final class CertificatePolicy implements JsonSerializable<CertificatePoli

/**
* Set the secretProperties property: Properties of the secret backing a certificate.
- *
+ *
* @param secretProperties the secretProperties value to set.
* @return the CertificatePolicy object itself.
*/
@@ -123,7 +130,7 @@ public final class CertificatePolicy implements JsonSerializable<CertificatePoli

/**
* Get the x509CertificateProperties property: Properties of the X509 component of a certificate.
- *
+ *
* @return the x509CertificateProperties value.
*/
@Generated
@@ -133,7 +140,7 @@ public final class CertificatePolicy implements JsonSerializable<CertificatePoli

/**
* Set the x509CertificateProperties property: Properties of the X509 component of a certificate.
- *
+ *
* @param x509CertificateProperties the x509CertificateProperties value to set.
* @return the CertificatePolicy object itself.
*/
@@ -145,7 +152,7 @@ public final class CertificatePolicy implements JsonSerializable<CertificatePoli

/**
* Get the lifetimeActions property: Actions that will be performed by Key Vault over the lifetime of a certificate.
- *
+ *
* @return the lifetimeActions value.
*/
@Generated
@@ -155,7 +162,7 @@ public final class CertificatePolicy implements JsonSerializable<CertificatePoli

/**
* Set the lifetimeActions property: Actions that will be performed by Key Vault over the lifetime of a certificate.
- *
+ *
* @param lifetimeActions the lifetimeActions value to set.
* @return the CertificatePolicy object itself.
*/
@@ -167,7 +174,7 @@ public final class CertificatePolicy implements JsonSerializable<CertificatePoli

/**
* Get the issuerParameters property: Parameters for the issuer of the X509 component of a certificate.
- *
+ *
* @return the issuerParameters value.
*/
@Generated
@@ -177,7 +184,7 @@ public final class CertificatePolicy implements JsonSerializable<CertificatePoli

/**
* Set the issuerParameters property: Parameters for the issuer of the X509 component of a certificate.
- *
+ *
* @param issuerParameters the issuerParameters value to set.
* @return the CertificatePolicy object itself.
*/
@@ -189,7 +196,7 @@ public final class CertificatePolicy implements JsonSerializable<CertificatePoli

/**
* Get the attributes property: The certificate attributes.
- *
+ *
* @return the attributes value.
*/
@Generated
@@ -199,7 +206,7 @@ public final class CertificatePolicy implements JsonSerializable<CertificatePoli

/**
* Set the attributes property: The certificate attributes.
- *
+ *
* @param attributes the attributes value to set.
* @return the CertificatePolicy object itself.
*/
@@ -209,6 +216,30 @@ public final class CertificatePolicy implements JsonSerializable<CertificatePoli
return this;
}

+ /**
+ * Get the platformManaged property: Configuration that enables the platform to manage the certificate on behalf of
+ * the user.
+ *
+ * @return the platformManaged value.
+ */
+ @Generated
+ public PlatformManaged getPlatformManaged() {
+ return this.platformManaged;
+ }
+
+ /**
+ * Set the platformManaged property: Configuration that enables the platform to manage the certificate on behalf of
+ * the user.
+ *
+ * @param platformManaged the platformManaged value to set.
+ * @return the CertificatePolicy object itself.
+ */
+ @Generated
+ public CertificatePolicy setPlatformManaged(PlatformManaged platformManaged) {
+ this.platformManaged = platformManaged;
+ return this;
+ }
+
/**
* {@inheritDoc}
*/
@@ -223,12 +254,13 @@ public final class CertificatePolicy implements JsonSerializable<CertificatePoli
(writer, element) -> writer.writeJson(element));
jsonWriter.writeJsonField("issuer", this.issuerParameters);
jsonWriter.writeJsonField("attributes", this.attributes);
+ jsonWriter.writeJsonField("platformManaged", this.platformManaged);
return jsonWriter.writeEndObject();
}

/**
* Reads an instance of CertificatePolicy from the JsonReader.
- *
+ *
* @param jsonReader The JsonReader being read.
* @return An instance of CertificatePolicy if the JsonReader was pointing to an instance of it, or null if it was
* pointing to JSON null.
@@ -241,6 +273,7 @@ public final class CertificatePolicy implements JsonSerializable<CertificatePoli
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
+
if ("id".equals(fieldName)) {
deserializedCertificatePolicy.id = reader.getString();
} else if ("key_props".equals(fieldName)) {
@@ -258,10 +291,13 @@ public final class CertificatePolicy implements JsonSerializable<CertificatePoli
deserializedCertificatePolicy.issuerParameters = IssuerParameters.fromJson(reader);
} else if ("attributes".equals(fieldName)) {
deserializedCertificatePolicy.attributes = CertificateAttributes.fromJson(reader);
+ } else if ("platformManaged".equals(fieldName)) {
+ deserializedCertificatePolicy.platformManaged = PlatformManaged.fromJson(reader);
} else {
reader.skipChildren();
}
}
+
return deserializedCertificatePolicy;
});
}
--
2.53.0.windows.2

Loading
Loading