-
Notifications
You must be signed in to change notification settings - Fork 235
Detect package root path from language repo when creating work item #7859
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
praveenkuttappan
merged 8 commits into
Azure:main
from
praveenkuttappan:find_package_repo_path
Mar 13, 2024
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e679987
Detect package root path from language repo when creating work item
praveenkuttappan 5e64e04
Update eng/scripts/Create-Package-WorkItem.ps1
praveenkuttappan ae2d823
Changes to sparse checkout language repo
praveenkuttappan 2eafaed
Merge branch 'find_package_repo_path' of https://github.com/praveenku…
praveenkuttappan 14acd71
Update script execution syntax
praveenkuttappan 6a1cb05
change clone to shallow clone
praveenkuttappan e0a0580
remove sparese checkout
praveenkuttappan b831bb0
Fix type in variable
praveenkuttappan 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
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,98 @@ | ||
| [CmdletBinding()] | ||
| param ( | ||
| [Parameter(Mandatory = $true)] | ||
| [string]$Language, | ||
| [Parameter(Mandatory = $true)] | ||
| [string]$ServiceName, | ||
| [Parameter(Mandatory = $true)] | ||
| [string]$PackageName, | ||
| [Parameter(Mandatory = $true)] | ||
| [string]$PackageDisplayName, | ||
| [Parameter(Mandatory = $true)] | ||
| [string]$PackageType, | ||
| [Parameter(Mandatory = $true)] | ||
| [string]$PackageVersion, | ||
| [Parameter(Mandatory = $true)] | ||
| [string]$ReleaseDate, | ||
| [string]$RelatedWorkItemId, | ||
| [string]$Tag = "", | ||
| [string]$WorkingDir = ".", | ||
| [string]$PackageRootPath = "", | ||
| [string]$Devops_pat = $env:DEVOPS_PAT | ||
| ) | ||
|
|
||
| Set-StrictMode -Version 3 | ||
|
|
||
| function Get-Repo-Name($language) | ||
| { | ||
| switch ($language) | ||
| { | ||
| ".NET" { return "azure-sdk-for-net" } | ||
| "Python" { return "azure-sdk-for-python" } | ||
| "Java" { return "azure-sdk-for-java" } | ||
| "JavaScript" { return "azure-sdk-for-js" } | ||
| "Go" { return "azure-sdk-for-go" } | ||
| "C" { return "azure-sdk-for-c" } | ||
| "C++" { return "azure-sdk-for-cpp" } | ||
| } | ||
| Write-Host "Unknown language to map it to repo name. Language: [$language]" | ||
| return "" | ||
| } | ||
|
|
||
| function Clone-Repo($repoName, $targetDir) | ||
| { | ||
| git clone "https://github.com/azure/$repoName.git" $targetDir | ||
| Write-Host "Cloned repo [$repoName] to [$($targetDir)]" | ||
| if (-not(Test-Path $targetDir)) | ||
| { | ||
| Write-Error "Failed to find cloned repo [$($targetDir)] to find pacakge root path from package name. Package root path is required to create or update package work item." | ||
| exit 1 | ||
| } | ||
| } | ||
|
|
||
| function Get-Package-Root-Path($packageName, $language) | ||
| { | ||
| # clone language repo | ||
| $repoName = Get-Repo-Name $language | ||
| if (!$repoName) | ||
| { | ||
| Write-Error "GitHub repo name is not found for language [$language]. Failed to find package root path." | ||
| exit 1 | ||
| } | ||
| $clonedRepoPath = Join-Path $WorkingDir $repoName | ||
| Clone-Repo $repoName $clonedRepoPath | ||
|
|
||
| # load common script helpers from cloned language repo | ||
| . (Join-Path $clonedRepoPath "eng/common/scripts/common.ps1") | ||
| Write-Host "Language repo root path: [$RepoRoot]" | ||
| # Parse package properties from cloned repo and find the package repo path | ||
| $packageProperties = Get-PkgProperties -PackageName $PackageName -ServiceDirectory "" | ||
|
praveenkuttappan marked this conversation as resolved.
Outdated
|
||
| if (!$packageProperties) | ||
| { | ||
| Write-Error "Could not find a package with name [ $packageName ] in repo." | ||
| exit 1 | ||
| } | ||
|
|
||
| Write-Host "Package Name [ $($packageProperties.Name) ]" | ||
| return $packageProperties.ServiceDirectory | ||
| } | ||
|
|
||
| if ($PackageRootPath -eq "") | ||
| { | ||
| $PackageRootPath = Get-Package-Root-Path $PackageName $Language | ||
| } | ||
|
|
||
| Write-Host "Package Root Path: [$PackageRootPath]" | ||
| # Create or update package work item | ||
| &$EngCommonScriptsDir/Update-DevOps-Release-WorkItem.ps1 ` | ||
| -language $Language ` | ||
| -packageName $PackageName ` | ||
| -version $PackageVersion ` | ||
| -plannedDate $ReleaseDate ` | ||
| -packageRepoPath $PackageRootPath ` | ||
| -packageType $PackageType ` | ||
|
praveenkuttappan marked this conversation as resolved.
Outdated
|
||
| -serviceName $ServiceName ` | ||
| -packageDisplayName $PackageDisplayName ` | ||
| -relatedWorkItemId $RelatedWorkItemId ` | ||
| -tag $Tag ` | ||
| -devops_pat $Devops_pat | ||
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.