forked from Azure/azure-sdk-for-js
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync eng/common directory with azure-sdk-tools for PR 7855 (Azure#28985)
Sync eng/common directory with azure-sdk-tools for PR Azure/azure-sdk-tools#7855 See [eng/common workflow](https://github.com/Azure/azure-sdk-tools/blob/main/eng/common/README.md#workflow) --------- Co-authored-by: Praveen Kuttappan <[email protected]>
- Loading branch information
1 parent
a85fb80
commit 0f49259
Showing
7 changed files
with
447 additions
and
34 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
eng/common/pipelines/templates/steps/validate-all-packages.yml
This file contains 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,34 @@ | ||
parameters: | ||
ArtifactPath: $(Build.ArtifactStagingDirectory) | ||
Artifacts: [] | ||
ConfigFileDir: $(Build.ArtifactStagingDirectory)/PackageInfo | ||
|
||
steps: | ||
- ${{ if and(ne(variables['Skip.PackageValidation'], 'true'), eq(variables['System.TeamProject'], 'internal')) }}: | ||
- pwsh: | | ||
echo "##vso[task.setvariable variable=SetAsReleaseBuild]false" | ||
displayName: "Set as release build" | ||
condition: and(succeeded(), eq(variables['SetAsReleaseBuild'], '')) | ||
- task: Powershell@2 | ||
inputs: | ||
filePath: $(Build.SourcesDirectory)/eng/common/scripts/Validate-All-Packages.ps1 | ||
arguments: > | ||
-ArtifactList ('${{ convertToJson(parameters.Artifacts) }}' | ConvertFrom-Json | Select-Object Name) | ||
-ArtifactPath ${{ parameters.ArtifactPath }} | ||
-RepoRoot $(Build.SourcesDirectory) | ||
-APIKey $(azuresdk-apiview-apikey) | ||
-ConfigFileDir '${{ parameters.ConfigFileDir }}' | ||
-BuildDefinition $(System.CollectionUri)$(System.TeamProject)/_build?definitionId=$(System.DefinitionId) | ||
-PipelineUrl $(System.CollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId) | ||
-Devops_pat '$(azuresdk-azure-sdk-devops-release-work-item-pat)' | ||
-IsReleaseBuild $$(SetAsReleaseBuild) | ||
pwsh: true | ||
workingDirectory: $(Pipeline.Workspace) | ||
displayName: Validate packages and update work items | ||
continueOnError: true | ||
condition: >- | ||
and( | ||
succeededOrFailed(), | ||
not(endsWith(variables['Build.Repository.Name'], '-pr')) | ||
) |
This file contains 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 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 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 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 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,52 @@ | ||
[CmdletBinding()] | ||
Param ( | ||
[Parameter(Mandatory=$True)] | ||
[array]$ArtifactList, | ||
[Parameter(Mandatory=$True)] | ||
[string]$ArtifactPath, | ||
[Parameter(Mandatory=$True)] | ||
[string]$RepoRoot, | ||
[Parameter(Mandatory=$True)] | ||
[string]$APIKey, | ||
[string]$ConfigFileDir, | ||
[string]$BuildDefinition, | ||
[string]$PipelineUrl, | ||
[string]$APIViewUri = "https://apiview.dev/AutoReview/GetReviewStatus", | ||
[string]$Devops_pat = $env:DEVOPS_PAT, | ||
[bool] $IsReleaseBuild = $false | ||
) | ||
|
||
Set-StrictMode -Version 3 | ||
. (Join-Path $PSScriptRoot common.ps1) | ||
|
||
function ProcessPackage($PackageName, $ConfigFileDir) | ||
{ | ||
Write-Host "Artifact path: $($ArtifactPath)" | ||
Write-Host "Package Name: $($PackageName)" | ||
Write-Host "Config File directory: $($ConfigFileDir)" | ||
|
||
&$EngCommonScriptsDir/Validate-Package.ps1 ` | ||
-PackageName $PackageName ` | ||
-ArtifactPath $ArtifactPath ` | ||
-RepoRoot $RepoRoot ` | ||
-APIViewUri $APIViewUri ` | ||
-APIKey $APIKey ` | ||
-BuildDefinition $BuildDefinition ` | ||
-PipelineUrl $PipelineUrl ` | ||
-ConfigFileDir $ConfigFileDir ` | ||
-Devops_pat $Devops_pat | ||
if ($LASTEXITCODE -ne 0) { | ||
Write-Error "Failed to validate package $PackageName" | ||
exit 1 | ||
} | ||
} | ||
|
||
# Check if package config file is present. This file has package version, SDK type etc info. | ||
if (-not $ConfigFileDir) { | ||
$ConfigFileDir = Join-Path -Path $ArtifactPath "PackageInfo" | ||
} | ||
foreach ($artifact in $ArtifactList) | ||
{ | ||
Write-Host "Processing $($artifact.name)" | ||
ProcessPackage -PackageName $artifact.name -ConfigFileDir $ConfigFileDir | ||
} |
Oops, something went wrong.