|
| 1 | +# Go Management SDK Release Guideline |
| 2 | + |
| 3 | +## Goal: |
| 4 | +Generate and release Azure SDK for Go package from Swagger or TypeSpec. |
| 5 | + |
| 6 | +--- |
| 7 | + |
| 8 | +## Table of Contents |
| 9 | +1. [Prerequisites](#prerequisites) |
| 10 | +2. [Release Process](#release-process) |
| 11 | +4. [Special Case in PR](#special-case-in-pr) |
| 12 | +5. [Add Live Test and Record](#add-live-test-and-record) |
| 13 | +6. [Breaking Change Review](#breaking-change-review) |
| 14 | + |
| 15 | +--- |
| 16 | + |
| 17 | +## Prerequisites |
| 18 | + |
| 19 | +### 1. GitHub Account |
| 20 | +- Link to Microsoft/Azure organization: [Link GitHub Account](https://dev.azure.com/azure-sdk/internal/_wiki/wikis/internal.wiki/111/Linking-Your-GitHub-Account) |
| 21 | +- Optionally, update your GitHub profile with your Microsoft email and real name. |
| 22 | + |
| 23 | +### 2. Permissions |
| 24 | +- **SDK Repo**: Request SDK permissions [here](https://coreidentity.microsoft.com/manage/Entitlement/entitlement/azuresdkpart-heqj). |
| 25 | +- **Asset Repo**: For vendors, join the Azure SDK team via [this link](https://github.com/orgs/Azure/teams/azure-sdk-write-vendors). |
| 26 | +- **Azure Subscription**: Vendors must request access to the TME subscription or ask MSFT employees to add them. |
| 27 | + |
| 28 | +### 3. Repositories to Clone |
| 29 | +- [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs) |
| 30 | +- [azure-sdk-for-go](https://github.com/Azure/azure-sdk-for-go) |
| 31 | + |
| 32 | +### 4. Install Necessary Tools |
| 33 | +- **Generator Tool**: Run `go get github.com/Azure/azure-sdk-for-go/tools/generator`. If this fails, run `cd eng/tools/generator && go install` (Reference [link](https://github.com/Azure/azure-sdk-for-go/blob/72fe46870cff900262d54be73aa9a1eccfde12f2/documentation/code-generation.md#L46)). |
| 34 | +- **Test Proxy**: Install by following [this guide](https://github.com/Azure/azure-sdk-tools/blob/main/tools/test-proxy/Azure.Sdk.Tools.TestProxy/README.md#installation). |
| 35 | +- **TSP Client**: Run `npm install -g @azure-tools/typespec-client-generator-cli` (Ensure Node v20.18.0 is installed). |
| 36 | + |
| 37 | +--- |
| 38 | + |
| 39 | +## Release Process |
| 40 | + |
| 41 | +### 1. Release Request |
| 42 | +- Release requests are initiated by the service team and should be submitted monthly. |
| 43 | +- A request is created as an issue at: [Release Request Issues](https://github.com/Azure/sdk-release-request/issues). |
| 44 | +- To process the request, use the following query: |
| 45 | +`is:issue state:open label:Go -label:HoldOn created:2024-09-27..2024-10-15` |
| 46 | + |
| 47 | +### 2. General Release Guidelines |
| 48 | +- All requests should be completed before the 4th Friday of the month. |
| 49 | +- The issue may be labeled "ReadyForApiTest," or the live test about the service is ok indicating readiness.It appears in specs repo PR,[like](Azure/azure-rest-api-specs#33035) |
| 50 | +- Ensure the "API Availability Check" passes for all services before releasing. |
| 51 | + |
| 52 | +### 3. Update Existing RP |
| 53 | + |
| 54 | +#### Steps: |
| 55 | +1. If the issue lacks the `PRready` label, manually create a PR. |
| 56 | + - If the issue has the `Inconsistent` tag, update the version tag in `autorest.md`. |
| 57 | + - If the issue has the `TypeSpec` label, generate the SDK code using `generator release-v2`: |
| 58 | + ``` |
| 59 | + generator release-v2 <path-to-sdk> <path-to-specs> <RP-name> <package-name> <tspconfig.yaml> |
| 60 | + ``` |
| 61 | + - If no `TypeSpec` label, update the commit ID and tag in `autorest.md` and then: |
| 62 | + ``` |
| 63 | + generator release-v2 <path-to-sdk> <path-to-specs> --update-spec-version=false |
| 64 | + ``` |
| 65 | +2. After generating the code, fix any issues, and if live tests are included: |
| 66 | + - Run `test-proxy restore` to restore assets. |
| 67 | + - Update API version in test records and push changes. |
| 68 | + |
| 69 | +3. Commit changes and create a PR. |
| 70 | + - Handle PR errors (e.g., broken links) by commenting `/check-enforcer override`. |
| 71 | + - Wait for approval and automatic merging in Pipelines. |
| 72 | + |
| 73 | +4. After pipeline completion, approve the merge and close the corresponding issue. |
| 74 | + |
| 75 | +### 4. Releases New Service |
| 76 | +#### Steps for New Service: |
| 77 | +1. Pull the latest changes from: |
| 78 | + - [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs) |
| 79 | + - [azure-sdk-for-go](https://github.com/Azure/azure-sdk-for-go) |
| 80 | + |
| 81 | +2. Create a folder structure under `azure-sdk-for-go/sdks/resourcemanager` that matches the spec repo. |
| 82 | + - Copy the template from [aztemplate](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/template/aztemplate). |
| 83 | + |
| 84 | +3. Run the generator and ensure the service name is correct in `README.md`. |
| 85 | + |
| 86 | +4. Update the pipeline configuration in `ci.yml` and add `UsePipelineProxy: false` if you add live test. |
| 87 | + |
| 88 | +5. Handle PR errors and ensure the pipeline runs as expected. |
| 89 | + - For new projects with minimal CI checks, use `/azp run prepare-pipelines`. |
| 90 | + |
| 91 | +--- |
| 92 | + |
| 93 | + |
| 94 | +## Special Case in PR |
| 95 | + |
| 96 | +### Handling Multiple Versions: |
| 97 | +- Release services in ascending order of versions (e.g., FirstGA before FirstBeta). |
| 98 | +- For services with multiple versions, the generated code will not change; only `changelog.md` should be updated. |
| 99 | + |
| 100 | +### Different Swagger and Go Package Names: |
| 101 | +- If the Swagger name differs from the Go package name, use the following command for code generation: |
| 102 | +`generator release-v2 <sdk-path> <specs-path> resources <package-name>` |
| 103 | + |
| 104 | +--- |
| 105 | + |
| 106 | +## Add Live Test and Record |
| 107 | +It is not a required step in release process, we can ensure whether the api version has been deployed by live test. |
| 108 | +### Install Scripts: |
| 109 | +1. Run the following PowerShell commands to download necessary scripts: |
| 110 | + ```ps |
| 111 | + Invoke-WebRequest -OutFile "generate-assets-json.ps1" https://raw.githubusercontent.com/Azure/azure-sdk-tools/main/eng/common/testproxy/onboarding/generate-assets-json.ps1 |
| 112 | + Invoke-WebRequest -OutFile "common-asset-functions.ps1" https://raw.githubusercontent.com/Azure/azure-sdk-tools/main/eng/common/testproxy/onboarding/common-asset-functions.ps1 |
| 113 | +``` |
| 114 | +2. Run the script in the service path: |
| 115 | +`.\generate-assets-json.ps1 -InitialPush` |
| 116 | +This will create a config file and push recordings to the Azure SDK Assets repo. |
| 117 | +3. Before testing, create a utils_test.go file as the entry point for live tests. Modify "package" and pathToPackage to match your service. |
| 118 | +4. Set the test mode to "live" using: |
| 119 | +`$ENV:AZURE_RECORD_MODE="live"` |
| 120 | +5. Once tests pass, switch to "playback" mode and ensure all tests pass in both modes. |
| 121 | +6. Push the final assets with test-proxy push --assets-json-path assets.json. |
| 122 | + |
| 123 | +--- |
| 124 | + |
| 125 | +## Breaking Change Review |
| 126 | + |
| 127 | +### Steps: |
| 128 | +1. Check for breaking changes by reviewing the Issues under sdk-release-request with both "Breaking Change" and "Stable" labels. |
| 129 | +1. If there’s an associated PR, check for approval in the comments. |
| 130 | +1. If no PR exists, locate the readme.md for the corresponding service and check the commit history for breaking changes. |
| 131 | +1. [example to see details](https://github.com/Azure/azure-sdk-for-go/pull/23343) |
0 commit comments