-
Notifications
You must be signed in to change notification settings - Fork 2.2k
inner loop, add update-meta-data script #48014
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b8ad314
inner loop, add update-meta-data script
haolingdong-msft f643baa
remove ci.yaml updates
haolingdong-msft 847679a
Add CI.yml provisioning and update support
haolingdong-msft e673872
resolve comments
haolingdong-msft 6d0ee3c
Fail metadata update for unsupported SDK types
haolingdong-msft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. | ||
|
|
||
| <# | ||
| .SYNOPSIS | ||
| Updates parent-level and root-level pom.xml files, and ci.yml for a Java SDK package. | ||
|
|
||
| .DESCRIPTION | ||
| This script handles two cases: | ||
| Case 1 - Service exists, new resourcemanager package: | ||
| - Skips root pom (service already listed) | ||
| - Updates service-level pom.xml with new module | ||
| - Updates ci.yml with new artifact entry | ||
| Case 2 - Brand new service: | ||
| - Updates root pom.xml with new service module | ||
| - Creates service-level pom.xml from template | ||
| - Creates ci.yml from template with new artifact entry | ||
|
|
||
| .PARAMETER PackagePath | ||
| Absolute path to the root folder of the local SDK project (containing pom.xml). | ||
|
|
||
| .PARAMETER SdkRepoPath | ||
| Absolute path to the root folder of the local SDK repository. | ||
|
|
||
| .EXAMPLE | ||
| .\Automation-Sdk-UpdateMetadata.ps1 -PackagePath "C:\repos\azure-sdk-for-java\sdk\network\azure-resourcemanager-network" -SdkRepoPath "C:\repos\azure-sdk-for-java" | ||
| #> | ||
|
|
||
| param( | ||
| [Parameter(Mandatory = $true)] | ||
| [ValidateScript({Test-Path $_})] | ||
| [string]$PackagePath, | ||
|
|
||
| [Parameter(Mandatory = $true)] | ||
| [ValidateScript({Test-Path $_})] | ||
| [string]$SdkRepoPath | ||
| ) | ||
|
|
||
| $ErrorActionPreference = "Stop" | ||
|
|
||
| # Import common scripts for logging functions | ||
| $commonScriptPath = Join-Path $PSScriptRoot ".." "common" "scripts" "common.ps1" | ||
| . $commonScriptPath | ||
|
|
||
| # Import metadata helper functions | ||
| $helperPath = Join-Path $PSScriptRoot "helpers" "Metadata-Helpers.ps1" | ||
| . $helperPath | ||
|
|
||
| try { | ||
| LogInfo "========================================" | ||
| LogInfo "Azure SDK Metadata Update Tool" | ||
| LogInfo "========================================" | ||
| LogInfo "" | ||
|
|
||
| LogInfo "Step 1: Deriving service and module from package path..." | ||
| $pathInfo = Get-ServiceAndModuleFromPath -PackagePath $PackagePath -SdkRepoPath $SdkRepoPath | ||
| $service = $pathInfo.Service | ||
| $module = $pathInfo.Module | ||
| LogInfo " Service: $service" | ||
| LogInfo " Module: $module" | ||
| LogInfo "" | ||
|
|
||
| LogInfo "Step 2: Updating root pom.xml..." | ||
| Update-RootPom -SdkRepoPath $SdkRepoPath -Service $service | ||
| LogInfo "" | ||
|
|
||
| LogInfo "Step 3: Updating service-level pom.xml..." | ||
| Update-ServicePom -SdkRepoPath $SdkRepoPath -Service $service -Module $module | ||
| LogInfo "" | ||
|
|
||
| LogInfo "Step 4: Updating ci.yml..." | ||
| $packagePomPath = Join-Path $PackagePath "pom.xml" | ||
| if (Test-Path $packagePomPath) { | ||
| $groupId = Get-GroupIdFromPom -PomPath $packagePomPath | ||
| LogInfo " GroupId: $groupId" | ||
|
|
||
| $supportedGroupIds = @("com.azure", "com.azure.resourcemanager") | ||
| if ($groupId -notin $supportedGroupIds) { | ||
| LogError "Unsupported SDK type with groupId '$groupId' at '$PackagePath'. This script only supports: $($supportedGroupIds -join ', ')." | ||
| exit 1 | ||
| } | ||
|
|
||
| Update-CiYml -SdkRepoPath $SdkRepoPath -Service $service -Module $module -GroupId $groupId | ||
|
haolingdong-msft marked this conversation as resolved.
|
||
| } | ||
| else { | ||
| LogError "No pom.xml found at '$packagePomPath'. Cannot determine groupId for ci.yml update." | ||
| } | ||
| LogInfo "" | ||
|
|
||
| LogInfo "✅ Metadata updated successfully!" | ||
| exit 0 | ||
| } | ||
| catch { | ||
| LogError "An error occurred: $_" | ||
| LogError "Stack trace: $($_.ScriptStackTrace)" | ||
| exit 1 | ||
| } | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.