Skip to content

Commit 0b86213

Browse files
committed
select value
1 parent e7b8f31 commit 0b86213

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

.azure-pipelines/PipelineSteps/BatchGeneration/notify-failed-job.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ $notificationContent = $notificationTemplate -replace "{{ pipelineName }}", $pip
1515
-replace "{{ pipelineUrl }}", $pipelineUrl `
1616
-replace "{{ runUrl }}", $runUrl
1717

18+
$notificationReceivers = if ($env:NotificationReceiversOverride -and $env:NotificationReceiversOverride -ne 'none') { $env:NotificationReceiversOverride } else { $env:FailedJobNotificationReceivers }
19+
Write-Host "Notification receivers: $notificationReceivers"
20+
1821
Send-Teams `
19-
-to $env:FailedJobNotificationReceivers `
22+
-to $notificationReceivers `
2023
-title "Batch Generation Job Failed" `
2124
-content $notificationContent

.azure-pipelines/PipelineSteps/BatchGeneration/util.psm1

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ function Get-BatchGenerationModuleMap {
33
[string]$srcPath
44
)
55
$skippedModules = $env:SKIPPED_MODULES -split ',' | ForEach-Object { $_.Trim() }
6+
$selectedTargetModules = @{}
7+
if ($env:SELECTED_TARGET_MODULES -ne "none") {
8+
$env:SELECTED_TARGET_MODULES -split ',' | ForEach-Object {
9+
$key = $_.Trim()
10+
if ($key -ne '') {
11+
$selectedTargetModules[$key] = $true
12+
}
13+
}
14+
}
615
$result = @{}
716
$modules = Get-ChildItem -Path $srcPath -Directory
817

@@ -11,6 +20,12 @@ function Get-BatchGenerationModuleMap {
1120
Write-Warning "Skipping module: $($module.Name) as it is in the skipped modules list."
1221
continue
1322
}
23+
24+
if ($selectedTargetModules.Count -gt 0 -and -not $selectedTargetModules.ContainsKey($module.Name)) {
25+
Write-Warning "Skipping module: $($module.Name) as it is not in the selected target modules list."
26+
continue
27+
}
28+
1429
$subModules = Get-ChildItem -Path $module.FullName -Directory | Where-Object {
1530
$_.Name -like '*.autorest'
1631
}

.azure-pipelines/batch-generation.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ stages:
5151
targetType: inline
5252
pwsh: true
5353
script: |
54-
Write-Host "Pipeline variable SKIPPED_MODULES: $($env:SKIPPED_MODULES)"
55-
Write-Host "Pipeline variable GENERATION_BASE_BRANCH: $($env:GENERATION_BASE_BRANCH)"
54+
Write-Host "Pipeline variable SkippedModules: $($env:SkippedModules)"
55+
Write-Host "Pipeline variable GenerationBaseBranch: $($env:GenerationBaseBranch)"
5656
Write-Host "Pipeline variable FailedJobNotificationReceivers: $($env:FailedJobNotificationReceivers)"
5757
5858
Write-Host "Parameter TestChangedModulesOnly: ${{ parameters.TestChangedModulesOnly }}"
@@ -106,6 +106,7 @@ stages:
106106
& $prepareModulesPath -RepoRoot "$(Build.SourcesDirectory)" -MaxParallelJobs "${{ variables.MaxParallelGenerateJobs }}"
107107
env:
108108
SKIPPED_MODULES: $(SkippedModules)
109+
SELECTED_TARGET_MODULES: ${{ parameters.SelectedTargetModules }}
109110

110111
- task: PublishPipelineArtifact@1
111112
displayName: 'Upload generated targets'
@@ -535,3 +536,4 @@ stages:
535536
env:
536537
TEAMS_URL: $(TEAMS_URL)
537538
FailedJobNotificationReceivers: $(FailedJobNotificationReceivers)
539+
NotificationReceiversOverride: ${{ parameters.NotificationReceiversOverride }}

0 commit comments

Comments
 (0)