Skip to content

Commit b18ce7e

Browse files
committed
Sync eng/common and eng/pipelines
1 parent e576640 commit b18ce7e

12 files changed

Lines changed: 84 additions & 61 deletions

eng/common/pipelines/templates/archetype-typespec-emitter.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ extends:
133133
-UseTypeSpecNext:$${{ parameters.UseTypeSpecNext }}
134134
-EmitterPackagePath:${{ parameters.EmitterPackagePath }}
135135
env:
136-
NPM_CONFIG_USERCONFIG: $(emitterNpmrcPath)
136+
npm_config_userconfig: $(emitterNpmrcPath)
137137

138138
- task: PowerShell@2
139139
displayName: 'Run build script'
@@ -146,7 +146,7 @@ extends:
146146
-EmitterPackagePath:${{ parameters.EmitterPackagePath }}
147147
-GeneratorVersion: $(initialize.emitterVersion)
148148
env:
149-
NPM_CONFIG_USERCONFIG: $(emitterNpmrcPath)
149+
npm_config_userconfig: $(emitterNpmrcPath)
150150

151151
- pwsh: |
152152
$sourceBranch = '$(Build.SourceBranch)'
@@ -322,7 +322,7 @@ extends:
322322
displayName: Install tsp-client
323323
workingDirectory: $(Build.SourcesDirectory)/eng/common/tsp-client
324324
env:
325-
NPM_CONFIG_USERCONFIG: $(tspClientNpmrcPath)
325+
npm_config_userconfig: $(tspClientNpmrcPath)
326326
327327
- pwsh: |
328328
# Resolve EmitterPackageJsonOutputPath to absolute path if it's relative
@@ -349,7 +349,7 @@ extends:
349349
displayName: Generate emitter-package.json and emitter-package-lock files
350350
workingDirectory: $(Build.SourcesDirectory)/eng/common/tsp-client
351351
env:
352-
NPM_CONFIG_USERCONFIG: $(tspClientNpmrcPath)
352+
npm_config_userconfig: $(tspClientNpmrcPath)
353353
354354
- ${{ parameters.InitializationSteps }}
355355

@@ -424,7 +424,7 @@ extends:
424424
workingDirectory: $(Build.SourcesDirectory)
425425
continueOnError: true
426426
env:
427-
NPM_CONFIG_USERCONFIG: $(emitterNpmrcPath)
427+
npm_config_userconfig: $(emitterNpmrcPath)
428428

429429
- template: /eng/common/pipelines/templates/steps/git-push-changes.yml
430430
parameters:
@@ -580,7 +580,7 @@ extends:
580580
-BuildArtifactsPath '$(buildArtifactsPath)/lock-files'
581581
-EmitterPackagePath: ${{ parameters.EmitterPackagePath }}
582582
env:
583-
NPM_CONFIG_USERCONFIG: $(emitterNpmrcPath)
583+
npm_config_userconfig: $(emitterNpmrcPath)
584584

585585
- task: PowerShell@2
586586
displayName: 'Run test script'
@@ -592,7 +592,7 @@ extends:
592592
-OutputDirectory "$(Build.ArtifactStagingDirectory)"
593593
-EmitterPackagePath: ${{ parameters.EmitterPackagePath }}
594594
env:
595-
NPM_CONFIG_USERCONFIG: $(emitterNpmrcPath)
595+
npm_config_userconfig: $(emitterNpmrcPath)
596596

597597
- template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml
598598
parameters:

eng/common/pipelines/templates/steps/create-tags-and-git-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ steps:
2727
GH_TOKEN: $(azuresdk-github-pat)
2828
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
2929
${{ if ne(parameters.NpmConfigUserConfig, '') }}:
30-
NPM_CONFIG_USERCONFIG: ${{ parameters.NpmConfigUserConfig }}
30+
npm_config_userconfig: ${{ parameters.NpmConfigUserConfig }}
3131
${{ if ne(parameters.NpmConfigRegistry, '') }}:
32-
NPM_CONFIG_REGISTRY: ${{ parameters.NpmConfigRegistry }}
32+
npm_config_registry: ${{ parameters.NpmConfigRegistry }}

eng/common/pipelines/templates/steps/run-pester-tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ parameters:
1414
steps:
1515

1616
- pwsh: |
17-
Install-Module -Name Pester -Force
17+
. (Join-Path "$(Build.SourcesDirectory)" eng common scripts Helpers PSModule-Helpers.ps1)
18+
Install-ModuleIfNotInstalled "Pester" "5.7.1" | Import-Module
1819
displayName: Install Pester
1920
2021
# default test steps

eng/common/pipelines/templates/steps/update-docsms-metadata.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ steps:
9999
displayName: Apply Documentation Updates
100100
env:
101101
${{ if ne(parameters.NpmConfigUserConfig, '') }}:
102-
NPM_CONFIG_USERCONFIG: ${{ parameters.NpmConfigUserConfig }}
102+
npm_config_userconfig: ${{ parameters.NpmConfigUserConfig }}
103103
${{ if ne(parameters.NpmConfigRegistry, '') }}:
104-
NPM_CONFIG_REGISTRY: ${{ parameters.NpmConfigRegistry }}
104+
npm_config_registry: ${{ parameters.NpmConfigRegistry }}
105105
106106
- template: /eng/common/pipelines/templates/steps/git-push-changes.yml
107107
parameters:

eng/common/pipelines/templates/steps/verify-codeowners.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ parameters:
22
- name: ArtifactPath
33
type: string
44
default: $(Build.ArtifactStagingDirectory)/PackageInfo
5+
- name: Artifacts
6+
type: object
7+
default: []
58
- name: Repo
69
type: string
710
default: $(Build.Repository.Name)
@@ -29,4 +32,5 @@ steps:
2932
-AzsdkPath '$(AZSDK)'
3033
-PackageInfoDirectory '${{ parameters.ArtifactPath }}'
3134
-SdkTypes ${{ join(',', parameters.SdkTypes) }}
35+
-ArtifactsJson '${{ convertToJson(parameters.Artifacts) }}'
3236
-Repo '${{ parameters.Repo }}'

eng/common/scripts/Helpers/PSModule-Helpers.ps1

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,6 @@ function Update-PSModulePathForCI() {
4646
}
4747
}
4848

49-
function Get-ModuleRepositories([string]$moduleName) {
50-
$DefaultPSRepositoryUrl = "https://www.powershellgallery.com/api/v2"
51-
# List of modules+versions we want to replace with internal feed sources for reliability, security, etc.
52-
$packageFeedOverrides = @{
53-
'powershell-yaml' = 'https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-tools/nuget/v2'
54-
}
55-
56-
$repoUrls = if ($packageFeedOverrides.Contains("${moduleName}")) {
57-
@($packageFeedOverrides["${moduleName}"], $DefaultPSRepositoryUrl)
58-
}
59-
else {
60-
@($DefaultPSRepositoryUrl)
61-
}
62-
63-
return $repoUrls
64-
}
65-
6649
function moduleIsInstalled([string]$moduleName, [string]$version) {
6750
if (-not (Test-Path variable:script:InstalledModules)) {
6851
$script:InstalledModules = @{}
@@ -100,13 +83,13 @@ function installModule([string]$moduleName, [string]$version, $repoUrl) {
10083
Set-PSRepository -Name $repo.Name -InstallationPolicy "Trusted" | Out-Null
10184
}
10285

103-
Write-Verbose "Installing module $moduleName with min version $version from $repoUrl"
86+
Write-Verbose "Installing module $moduleName with version $version from $repoUrl"
10487
# Install under CurrentUser scope so that the end up under $CurrentUserModulePath for caching
105-
Install-Module $moduleName -MinimumVersion $version -Repository $repo.Name -Scope CurrentUser -Force -WhatIf:$false
88+
Install-Module $moduleName -RequiredVersion $version -Repository $repo.Name -Scope CurrentUser -Force -WhatIf:$false
10689
# Ensure module installed
10790
$modules = (Get-Module -ListAvailable $moduleName)
10891
if ($version -as [Version]) {
109-
$modules = $modules.Where({ [Version]$_.Version -ge [Version]$version })
92+
$modules = $modules.Where({ [Version]$_.Version -eq [Version]$version })
11093
}
11194
if ($modules.Count -eq 0) {
11295
throw "Failed to install module $moduleName with version $version"
@@ -151,26 +134,11 @@ function Install-ModuleIfNotInstalled() {
151134
$module = moduleIsInstalled -moduleName $moduleName -version $version
152135
if ($module) { return $module }
153136

154-
$repoUrls = Get-ModuleRepositories $moduleName
155-
156-
foreach ($url in $repoUrls) {
157-
try {
158-
$module = installModule -moduleName $moduleName -version $version -repoUrl $url
159-
}
160-
catch {
161-
if ($url -ne $repoUrls[-1]) {
162-
Write-Warning "Failed to install powershell module from '$url'. Retrying with fallback repository"
163-
Write-Warning $_
164-
continue
165-
}
166-
else {
167-
Write-Warning "Failed to install powershell module from $url"
168-
throw
169-
}
170-
}
171-
break
172-
}
137+
# Use internal Azure Artifacts feed only.
138+
$repoUrl = "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-tools/nuget/v2"
139+
Write-Host "Module '$moduleName' with version '$version' is not installed. Attempting to install from $repoUrl."
173140

141+
$module = installModule -moduleName $moduleName -version $version -repoUrl $repoUrl
174142
Write-Verbose "Using module '$($module.Name)' with version '$($module.Version)'."
175143
}
176144
finally {

eng/common/scripts/Mark-ReleasePlanCompletion.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,13 @@ function Process-Package([string]$packageInfoPath)
4848
}
4949

5050
Write-Host "Marking release completion for package, name: $PackageName"
51-
$releaseInfo = & $AzsdkExePath release-plan update-release-status --package-name $PackageName --language $LanguageDisplayName --status "Released"
51+
$PackageVersion = $pkgInfo.Version
52+
$releaseArgs = @("release-plan", "update-release-status", "--package-name", $PackageName, "--language", $LanguageDisplayName, "--status", "Released")
53+
if ($PackageVersion)
54+
{
55+
$releaseArgs += @("--package-version", $PackageVersion)
56+
}
57+
$releaseInfo = & $AzsdkExePath @releaseArgs
5258
if ($LASTEXITCODE -ne 0)
5359
{
5460
## Not all releases have a release plan. So we should not fail the script even if a release plan is missing.

eng/common/scripts/Test-CodeownersForArtifacts.ps1

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ param(
33
[string] $AzsdkPath,
44
[string] $PackageInfoDirectory,
55
[array] $SdkTypes,
6+
[string] $ArtifactsJson,
67
[string] $Repo
78
)
89

@@ -12,9 +13,24 @@ Set-StrictMode -Version 3
1213
$ErrorActionPreference = 'Stop'
1314

1415
$failedPackages = @()
16+
$excludedArtifacts = @()
17+
$artifacts = $ArtifactsJson | ConvertFrom-Json
18+
19+
foreach ($artifact in $artifacts) {
20+
if ($artifact.PSObject.Properties.Name -contains "skipCodeownersVerification" -and $artifact.skipCodeownersVerification) {
21+
$excludedArtifacts += $artifact.Name
22+
}
23+
}
24+
25+
Write-Host "Excluded artifacts: $($excludedArtifacts -join ', ')"
1526

1627
foreach ($pkgPropertiesFile in Get-ChildItem -Path $PackageInfoDirectory -Filter '*.json' -File) {
1728
$pkgProperties = Get-Content -Raw -Path $pkgPropertiesFile | ConvertFrom-Json
29+
30+
if ($excludedArtifacts -contains $pkgProperties.Name) {
31+
Write-Host "Skipping package: $($pkgProperties.Name) $($pkgProperties.DirectoryPath) because it is in the list of artifacts to exclude from validation."
32+
continue
33+
}
1834
if ($SdkTypes -notcontains $pkgProperties.SdkType) {
1935
Write-Host "Skipping package: $($pkgProperties.Name) $($pkgProperties.DirectoryPath) because its SdkType '$($pkgProperties.SdkType)' is not in the list of SdkTypes to validate."
2036
continue

eng/common/scripts/Verify-Resource-Ref.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
. (Join-Path $PSScriptRoot common.ps1)
2-
Install-Module -Name powershell-yaml -RequiredVersion 0.4.7 -Force -Scope CurrentUser
2+
. (Join-Path $PSScriptRoot Helpers PSModule-Helpers.ps1)
3+
Install-ModuleIfNotInstalled "powershell-yaml" "0.4.7" | Import-Module
34
$ymlfiles = Get-ChildItem $RepoRoot -recurse | Where-Object {$_ -like '*.yml'}
45
$affectedRepos = [System.Collections.ArrayList]::new()
56

eng/pipelines/aggregate-reports.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ extends:
5151
displayName: 'Build all libraries that support Java $(JavaBuildVersion)'
5252
inputs:
5353
mavenPomFile: pom.xml
54-
options: '$(DefaultOptions) -T 2C -DskipTests -Dgpg.skip -Dmaven.javadoc.skip=true -Dcodesnippet.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true -Djacoco.skip=true -Drevapi.skip=true -Dshade.skip=true -Dspotless.skip=true -pl !com.azure.cosmos.spark:azure-cosmos-spark_3-3_2-12,!com.azure.cosmos.spark:azure-cosmos-spark_3-4_2-12,!com.azure.cosmos.spark:azure-cosmos-spark_3-5_2-12,!com.azure.cosmos.spark:azure-cosmos-spark_3-5_2-13,!com.azure.cosmos.spark:azure-cosmos-spark_4-0_2-13,!com.azure.cosmos.spark:azure-cosmos-spark-account-data-resolver-sample,!com.azure.cosmos.kafka:azure-cosmos-kafka-connect,!com.microsoft.azure:azure-batch'
54+
options: '$(DefaultOptions) -T 2C -DskipTests -Dgpg.skip -Dmaven.javadoc.skip=true -Dcodesnippet.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true -Djacoco.skip=true -Drevapi.skip=true -Dshade.skip=true -Dspotless.skip=true -pl !com.azure.cosmos.spark:azure-cosmos-spark_3-3_2-12,!com.azure.cosmos.spark:azure-cosmos-spark_3-4_2-12,!com.azure.cosmos.spark:azure-cosmos-spark_3-5_2-12,!com.azure.cosmos.spark:azure-cosmos-spark_3-5_2-13,!com.azure.cosmos.spark:azure-cosmos-spark_4-0_2-13,!com.azure.cosmos.spark:azure-cosmos-spark_4-1_2-13,!com.azure.cosmos.spark:azure-cosmos-spark-account-data-resolver-sample,!com.azure.cosmos.kafka:azure-cosmos-kafka-connect,!com.microsoft.azure:azure-batch'
5555
mavenOptions: '$(MemoryOptions) $(LoggingOptions)'
5656
javaHomeOption: 'JDKVersion'
5757
jdkVersionOption: $(JavaBuildVersion)
@@ -63,7 +63,7 @@ extends:
6363
displayName: 'Build remaining libraries with Java $(FallbackJavaBuildVersion)'
6464
inputs:
6565
mavenPomFile: pom.xml
66-
options: '$(DefaultOptions) -T 2C -DskipTests -Dgpg.skip -Dmaven.javadoc.skip=true -Dcodesnippet.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true -Djacoco.skip=true -Drevapi.skip=true -Dspotless.skip=true -pl com.azure.cosmos.spark:azure-cosmos-spark_3-3_2-12,com.azure.cosmos.spark:azure-cosmos-spark_3-4_2-12,com.azure.cosmos.spark:azure-cosmos-spark_3-5_2-12,com.azure.cosmos.spark:azure-cosmos-spark-account-data-resolver-sample,com.azure.cosmos.kafka:azure-cosmos-kafka-connect,com.microsoft.azure:azure-batch'
66+
options: '$(DefaultOptions) -T 2C -DskipTests -Dgpg.skip -Dmaven.javadoc.skip=true -Dcodesnippet.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true -Djacoco.skip=true -Drevapi.skip=true -Dspotless.skip=true -pl com.azure.cosmos.spark:azure-cosmos-spark_3-3_2-12,com.azure.cosmos.spark:azure-cosmos-spark_3-4_2-12,com.azure.cosmos.spark:azure-cosmos-spark_3-5_2-12,com.azure.cosmos.spark:azure-cosmos-spark_3-5_2-13,com.azure.cosmos.spark:azure-cosmos-spark_4-0_2-13,com.azure.cosmos.spark:azure-cosmos-spark_4-1_2-13,com.azure.cosmos.spark:azure-cosmos-spark-account-data-resolver-sample,com.azure.cosmos.kafka:azure-cosmos-kafka-connect,com.microsoft.azure:azure-batch'
6767
mavenOptions: '$(MemoryOptions) $(LoggingOptions)'
6868
javaHomeOption: 'JDKVersion'
6969
jdkVersionOption: $(FallbackJavaBuildVersion)

0 commit comments

Comments
 (0)