Skip to content

Commit 20b953b

Browse files
authored
Merge branch 'main' into idickers/2026-04-01-java-sdk
2 parents e9e9e78 + b916dc0 commit 20b953b

13,789 files changed

Lines changed: 614959 additions & 327197 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@
362362

363363
# AzureSdkOwners: @Azure/azure-sdk-write-keyvault
364364
# ServiceLabel: %KeyVault
365-
# ServiceOwners: @Azure/azure-sdk-write-keyvault @chen-karen
365+
# ServiceOwners: @Azure/azure-sdk-write-keyvault
366366

367367
# PRLabel: %Load Testing
368368
/sdk/loadtesting/ @Azure/azure-java-sdk @Harshan01 @mitsha-microsoft @ninallam @prativen

.github/hooks/hooks.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"hooks": {
3+
"PostToolUse": [
4+
{
5+
"type": "command",
6+
"command": "pwsh eng/common/scripts/azsdk_tool_telemetry.ps1",
7+
"timeoutSec": 5
8+
}
9+
]
10+
}
11+
}

.github/workflows/event-processor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
run: >
6969
dotnet tool install
7070
Azure.Sdk.Tools.GitHubEventProcessor
71-
--version 1.0.0-dev.20260129.1
71+
--version 1.0.0-dev.20260403.1
7272
--add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json
7373
--global
7474
shell: bash

.github/workflows/post-apiview.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions:
1111
jobs:
1212
post-apiview:
1313
name: After APIView
14-
runs-on: ["self-hosted", "1ES.Pool=azsdk-pool-github-runners"]
14+
runs-on: ["self-hosted", "1ES.Pool=azsdk-pool-github-runners", "JobId=azsdk-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}"]
1515
if: |
1616
toJson(github.event.check_run.pull_requests) != '[]' &&
1717
github.event.check_run.check_suite.app.name == 'Azure Pipelines' && (

.github/workflows/scheduled-event-processor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
run: >
4040
dotnet tool install
4141
Azure.Sdk.Tools.GitHubEventProcessor
42-
--version 1.0.0-dev.20260129.1
42+
--version 1.0.0-dev.20260403.1
4343
--add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json
4444
--global
4545
shell: bash

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,6 @@ stress-test-addons*
126126

127127
# Temp typespec files
128128
TempTypeSpecFiles/
129+
130+
# Azure Artifacts Credential Provider runtime
131+
.azure-artifacts/

CONTRIBUTING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,14 @@ For detailed instructions, refer to the [Maven Credential Provider documentation
125125

126126
> **Note:** For Maven Azure DevOps pipeline authentication, use the [MavenAuthenticate@0](https://learn.microsoft.com/azure/devops/pipelines/tasks/reference/maven-authenticate-v0) pipeline task.
127127
128+
##### Matching CI behavior locally
129+
130+
All Maven dependency and artifact resolution already uses the Azure Artifacts feed by default via `<repositories>` declarations in the project POMs. However, Maven plugins and extensions do not honor POM-level repositories. To route plugin traffic through the Azure Artifacts feed as well (matching CI behavior), copy the mirror settings:
131+
132+
```bash
133+
cp eng/settings.xml ~/.m2/settings.xml
134+
```
135+
128136
##### Troubleshooting 401 Unauthorized errors
129137

130138
If you encounter a `401 Unauthorized` error when running Maven commands:

NuGet.Config

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<clear />
5+
<!-- Do not add any additional feeds. If new packages are needed they need to
6+
come from the azure-sdk-for-net DevOps feed which has an upstream set to nuget.org -->
7+
<add key="azure-sdk-for-net" value="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json" />
8+
</packageSources>
9+
<disabledPackageSources>
10+
<clear />
11+
</disabledPackageSources>
12+
</configuration>

doc/deprecation_process.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Clone the repository and update the following files of your package:
2424
2525
- `CHANGELOG.md` add a new version with the current date and the same disclaimer. For instance:
2626

27-
> ## 1.2.3 (2023-04-03)
27+
> ## 1.0.1 (2023-04-03)
2828
>
2929
> Please note, this package has been deprecated and will no longer be maintained after $EOLDate. We encourage you to
3030
> upgrade to the replacement package, $Replacement, to continue receiving updates. Refer to the migration guide
@@ -38,6 +38,17 @@ Clone the repository and update the following files of your package:
3838
> $ReplaceGuide for guidance on upgrading. Refer to our deprecation policy (https://aka.ms/azsdk/support-policies) for
3939
> more details.
4040
41+
Additionally, update the following repo-level file if needed:
42+
43+
- `eng/versioning/version_client.txt` set the `current-version` (third field) to the release
44+
version if they differ.
45+
For instance:
46+
47+
```diff
48+
- com.azure:azure-example;1.0.0;1.1.0-beta.1
49+
+ com.azure:azure-example;1.0.0;1.0.1
50+
```
51+
4152
Do a PR targeting the `main` branch. Post your PR in our [channel for Java](https://teams.microsoft.com/l/channel/19%3a5e673e41085f4a7eaaf20823b85b2b53%40thread.skype/Language%2520-%2520Java?groupId=3e17dcb0-4257-4a30-b843-77f47f1d4121&tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47).
4253

4354
You're responsible to fix any CI issues related to this PR, if any.
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
# Java SDK Generation Pipeline Troubleshooting Guide
2+
3+
This guide helps you **identify which category** a pipeline failure belongs to and **apply the solution**.
4+
5+
> Applies to: **Java SDK generation pipeline** (spec PR validation / spec PR generation)
6+
7+
- [Quick Triage](#quick-triage)
8+
- [tspconfig.yaml Errors](#1-tspconfig-errors) — misconfigurations in the spec repo's `tspconfig.yaml`
9+
- [Customization Errors](#2-customization-errors) — hand-written SDK code conflicts with regenerated code
10+
- [Intermittent Errors](#3-intermittent-errors) — transient failures, usually resolved by rerun
11+
- [Escalation](#escalation)
12+
13+
> Related: [SDK Validation FAQ](https://aka.ms/azsdk/sdk-automation-faq) | [SDK Generation Pipelines](https://eng.ms/docs/products/azure-developer-experience/develop/sdk-generation-pipelines) | [SDK Release Pipeline](https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-pipeline) | [Language - Java Teams channel][teams-java]
14+
15+
---
16+
17+
## Quick Triage
18+
19+
Find the most specific signal in the failure log and jump directly:
20+
21+
| Log Signal | Category | Jump |
22+
|---|---|---|
23+
| `[COMPILE] Maven build fail.` + Checkstyle `PackageName` `must match pattern` | tspconfig | [1.1 Namespace Segment Too Long](#11-namespace-segment-too-long) |
24+
| `not supported by Fluent Premium` | tspconfig | [1.2 Unsupported Emitter Option (Fluent Premium)](#12-unsupported-emitter-option-fluent-premium) |
25+
| Verify Swagger and TypeSpec Code Generation check fails | tspconfig | [1.3 Verify Swagger and TypeSpec Code Generation fails](#13-verify-swagger-and-typespec-code-generation-fails) |
26+
| `[COMPILE] Maven build fail.` + customization class/method referenced | customization | [2. Customization Errors](#2-customization-errors) |
27+
| `Could not resolve dependencies` / `Could not transfer artifact` | intermittent | [3.1 Maven Dependency Download Failure](#31-maven-dependency-download-failure) |
28+
| None match | unknown | [Escalation](#escalation) |
29+
30+
---
31+
32+
## 1. tspconfig Errors
33+
34+
**How to identify:** The error message contains `[VALIDATE][tspconfig.yaml]` or `[GENERATE] ...`, or generation output lands in the wrong directory.
35+
36+
**References:**
37+
- TypeSpec configuration (tspconfig): https://typespec.io/docs/handbook/configuration/configuration/
38+
- Azure TypeSpec Autorest emitter reference: https://azure.github.io/typespec-azure/docs/emitters/typespec-autorest/reference/emitter/
39+
- Azure TypeSpec Java emitter reference: https://azure.github.io/typespec-azure/docs/emitters/clients/typespec-java/reference/emitter/
40+
41+
### 1.1 Namespace Segment Too Long
42+
43+
**Log signal:**
44+
- `[COMPILE] Maven build fail.`
45+
- Checkstyle `PackageName` error with `must match pattern`
46+
47+
**Error (real-world example):**
48+
```
49+
[ERROR] Name 'com.azure.resourcemanager.<verylongsegment>...' must match pattern
50+
'^(?=.{9,80}$)((com.microsoft|com.azure)(\.[a-z][a-z0-9]{1,31})*)+$'. [PackageName]
51+
[ERROR] Failed to execute goal ... maven-checkstyle-plugin ... There are N errors reported by Checkstyle
52+
```
53+
54+
**Root cause:** The namespace does not match the repository's Checkstyle `PackageName` rule.
55+
56+
**Solution:**
57+
58+
1. **Check whether the namespace is approved.** If the long namespace has been reviewed and approved (e.g. it matches the service name exactly):
59+
- Add a Checkstyle suppression to [`eng/lintingconfigs/checkstyle/track2/checkstyle-suppressions.xml`](https://github.com/Azure/azure-sdk-for-java/blob/main/eng/lintingconfigs/checkstyle/track2/checkstyle-suppressions.xml#L109-L110). For example:
60+
```xml
61+
<!-- Suppress the long package name in yourservice -->
62+
<suppress checks="PackageName" files="com.azure.resourcemanager.yourverylongservicename.*" />
63+
```
64+
2. **If the namespace is not approved**, rename or shorten the namespace until it matches the `PackageName` rule shown in the error log. In practice, check the generated package name against the regex and reduce any part of the namespace that causes the mismatch, such as an overly long segment or an overall package name that is too long.
65+
66+
### 1.2 Unsupported Emitter Option (Fluent Premium)
67+
68+
**Log signal:**
69+
- `not supported by Fluent Premium`
70+
71+
**Error (real-world example):**
72+
```
73+
error @azure-tools/typespec-java/generator-error: ... - Unhandled error.
74+
java.lang.IllegalStateException: Package 'com.azure.resourcemanager.<pkg>' is not supported by Fluent Premium
75+
```
76+
77+
**Root cause:** `tspconfig.yaml` enables an emitter option (for example `premium: true`) that is not supported for the target package.
78+
79+
**Solution:** Remove the unsupported option from `options.@azure-tools/typespec-java`.
80+
81+
---
82+
83+
### 1.3 Verify Swagger and TypeSpec Code Generation fails
84+
**Log signal:**
85+
- Verify Swagger and TypeSpec Code Generation check fails in Java SDK CI - java-pullrequest
86+
87+
**Error (real-world example):**
88+
```
89+
Exception: /mnt/vss/_work/1/s/eng/scripts/Compare-CurrentToCodegeneration.ps1:225
90+
Line |
91+
225 | $job | Receive-Job 2>$null | Out-Null
92+
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
93+
| ScriptHalted
94+
95+
##[error]PowerShell exited with code '1'.
96+
```
97+
98+
**Root cause:**
99+
The **Verify Swagger and TypeSpec Code Generation** step in the Java SDK PR pipeline re-runs code generation using repository-local configuration and compares regenerated output with committed code. This check usually fails because regeneration produces large diffs.
100+
Common causes include:
101+
- `tspconfig.yaml` has incorrect Java emitter settings.
102+
- In `tspconfig.yaml`, `api-version` changes can directly change operation/model counts.
103+
- In `tspconfig.yaml`, `enable-sync-stack` changes can add or remove a large set of sync client classes.
104+
- In `tspconfig.yaml`, `flavor` changes (for example, `azure` vs `standard`) change generated code style and shape.
105+
106+
When operation counts change significantly, **api-version drift** is the most common cause. If `api-version` is not explicitly fixed in `tspconfig.yaml`, it may default to the latest version, which can differ from the version used when the checked-in SDK was originally generated.
107+
108+
**Solution:**
109+
1. Check the pipeline code-generation diff, re-run local generation with the same repository configuration, compare against the SDK output in the generated PR, and update the relevant `tspconfig.yaml` settings (for example `api-version`, `enable-sync-stack`, `flavor`).
110+
2. Update `tspconfig.yaml` in the spec repo PR, commit the change, and rerun generation to regenerate the SDK PR.
111+
112+
Example (API version mismatch): pin `api-version` in `tspconfig.yaml` so the Verify step and SDK generation use the same version, then rerun generation.
113+
```yaml
114+
options:
115+
"@azure-tools/typespec-java":
116+
api-version: "2025-12-01" # ✅ pin the api-version used for generation
117+
```
118+
119+
---
120+
121+
## 2. Customization Errors
122+
123+
**How to identify:** `[COMPILE] Maven build fail.` with Java compilation errors referencing hand-written classes/methods that no longer exist in generated code. The pipeline may auto-retry with customization disabled and show:
124+
```
125+
Generate a fresh package from TypeSpec. If there was prior customization on the package,
126+
please check whether it causes failure, and fix them before apiview.
127+
```
128+
129+
> **Background:** Azure SDK packages usually contain both *generated code* (auto-produced from TypeSpec) and *customization code* (hand-written by SDK developers):
130+
> - *generated code*: produced by the generator; API surface may change when the spec or generator changes, which can break compilation.
131+
> - *customization code*: maintained by SDK developers; commonly wired via `customization-class` and preserved during regeneration with `partial-update: true`.
132+
>
133+
> Reference: autorest.java customization-base: https://github.com/Azure/autorest.java/tree/main/customization-base
134+
135+
**Prerequisites for customization:** When adding customization code, two options must be set in `tspconfig.yaml`:
136+
```yaml
137+
options:
138+
"@azure-tools/typespec-java":
139+
customization-class: "com.azure.resourcemanager.yourservice.customization"
140+
partial-update: true
141+
```
142+
- **`customization-class`** — the Java package containing your hand-written customization classes
143+
- **`partial-update`** — set to `true` so the generator preserves your custom files instead of overwriting the entire output directory
144+
145+
---
146+
147+
## 3. Intermittent Errors
148+
149+
**How to identify:** The failure is in dependency download, npm install, or CI infrastructure — not in generation/compilation logic. Error messages mention network timeouts, `Could not resolve dependencies`, `Could not transfer artifact`, or failures in injected DevOps tasks.
150+
151+
**Solution for all intermittent errors: Re-run the pipeline.**
152+
153+
> **If failure persists after 2-3 retries**, it is likely a genuine issue, not intermittent. Review the error details and consult sections 1 or 2 above.
154+
155+
### 3.1 Maven Dependency Download Failure
156+
157+
**Error:** `[COMPILE] Maven build fail.` with `Could not resolve dependencies` / `Could not transfer artifact` / connection timeout.
158+
159+
**Error (real-world example):**
160+
```
161+
[FATAL] Non-resolvable parent POM for com.azure:customization-loader:1.0.0-beta.1:
162+
Could not transfer artifact ... from/to central (https://repo.maven.apache.org/maven2):
163+
Connect to repo.maven.apache.org:443 ... failed: Network is unreachable (connect failed)
164+
and 'parent.relativePath' points at wrong local POM
165+
```
166+
167+
---
168+
169+
## Escalation
170+
171+
If the issue persists after following this guide, post in the [Language - Java Teams channel][teams-java] with:
172+
- Spec PR link
173+
- Pipeline build link and build ID
174+
- Exact error message
175+
- What you've already tried
176+
177+
Other resources: [TypeSpec GitHub](https://github.com/microsoft/typespec) | [Troubleshoot PR failures](https://eng.ms/docs/products/azure-developer-experience/support/troubleshoot/PR-failing) | [SDK support](https://eng.ms/docs/products/azure-developer-experience/support/support#get-help-with-the-azure-sdks-development)
178+
179+
<!-- Reference Links -->
180+
[teams-java]: https://teams.microsoft.com/l/channel/19%3a5e673e41085f4a7eaaf20823b85b2b53%40thread.skype/Language%2520-%2520Java?groupId=3e17dcb0-4257-4a30-b843-77f47f1d4121&tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47 "Language - Java Teams channel"

0 commit comments

Comments
 (0)