Skip to content

Commit b8353f8

Browse files
authored
[Eng] Output target modules when build by pipeline (#27132)
* output modified modules * output target modules instead * fix * try lowercases artifacts
1 parent 191798a commit b8353f8

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

tools/BuildScripts/BuildModules.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ if (($null -eq $RepoRoot) -or (0 -eq $RepoRoot.Length)) {
3838

3939
$notModules = @('lib', 'shared', 'helpers')
4040
$coreTestModule = @('Compute', 'Network', 'Resources', 'Sql', 'Websites')
41-
$RepoArtifacts = Join-Path $RepoRoot "Artifacts"
41+
$RepoArtifacts = Join-Path $RepoRoot "artifacts"
4242

4343
$csprojFiles = @()
4444
$testModule = @()
@@ -127,6 +127,9 @@ $prepareScriptPath = Join-Path $toolDirectory 'BuildScripts' 'PrepareAutorestMod
127127
$isInvokedByPipeline = $false
128128
if ($InvokedByPipeline) {
129129
$isInvokedByPipeline = $true
130+
$outputTargetPath = Join-Path $RepoArtifacts "TargetModule.txt"
131+
New-Item -Path $outputTargetPath -Force
132+
$TargetModule | Out-File -Path $outputTargetPath -Force
130133
}
131134
foreach ($moduleRootName in $TargetModule) {
132135
Write-Host "Preparing $moduleRootName ..." -ForegroundColor DarkGreen

tools/ExpandModules.ps1

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,21 @@ if ([string]::IsNullOrEmpty($Artifacts)) {
3333
New-Item -Path (Get-Item $Artifacts).FullName -Name "tmp" -ItemType "directory"
3434
$tmp = Join-Path -Path (Get-Item $Artifacts).FullName -ChildPath "tmp"
3535

36-
$ModifiedModulesPath = Join-Path $Artifacts -ChildPath "ModifiedModule.txt"
37-
$ModifiedModules = @()
38-
if (Test-Path $ModifiedModulesPath) {
39-
$ModifiedModules = Get-Content $ModifiedModulesPath
36+
$TargetModulePath = Join-Path $Artifacts -ChildPath "TargetModule.txt"
37+
$TargetModule = @()
38+
if (Test-Path $TargetModulePath) {
39+
$TargetModule = Get-Content $TargetModulePath
4040
}
41-
Write-Host $ModifiedModules
41+
Write-Host $TargetModule
4242
try {
4343
$AllPackages = Get-ChildItem -Path $Artifacts -Filter "*.nupkg"
4444

45-
if ($ModifiedModules.Length -eq 0) {
46-
Write-Host "ModifiedModule.txt not finded, default expand all modules."
47-
$ModifiedModules = $AllPackages.Name
45+
if ($TargetModule.Length -eq 0) {
46+
Write-Error "No target modules found."
47+
exit 1
4848
}
4949
foreach ($package in $AllPackages) {
50-
foreach ($module in $ModifiedModules) {
50+
foreach ($module in $TargetModule) {
5151
if (($package.Name -like "Az.$module.*.nupkg") -or ($package.Name -match '^Az(Preview)?\.\d+\.\d+\.\d+\.nupkg$')) {
5252
$module_name = $package.Name
5353
$zip_artifact = $package.FullName -replace ".nupkg$",".zip"

0 commit comments

Comments
 (0)