Skip to content

Commit

Permalink
Refactor the Push-PipelinesToList function in `PrePostDeploymentScr…
Browse files Browse the repository at this point in the history
…ipt.Ver2.ps1` to improve pipeline dependency handling. If a dependency is null, display a warning message. Otherwise, recursively call `Push-PipelinesToList` with the dependent pipeline.
  • Loading branch information
Liszet committed Jul 31, 2024
1 parent 507f4d4 commit caa2884
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,15 @@ function Push-PipelinesToList {
return;
}
$visited[$pipeline.Name] = $true;
$pipeline.Activities | ForEach-Object { Get-PipelineDependency -activity $_ -pipelineNameResourceDict $pipelineNameResourceDict } | ForEach-Object {
Push-PipelinesToList -pipeline $pipelineNameResourceDict[$_] -pipelineNameResourceDict $pipelineNameResourceDict -visited $visited -sortedList $sortedList
foreach ($activity in $pipeline.Activities) {
$activityName = $activity.Name
Get-PipelineDependency -activity $activity -pipelineNameResourceDict $pipelineNameResourceDict
} foreach ($dependency in $dependecies) {
if ($null -eq $dependency) {
Write-Warning "Warning: Pipeline dependency is null for pipeline $($pipeline.Name) and activity $activityName. The activity $activityName is missing an invoked pipeline reference."
} else {
Push-PipelinesToList -pipeline $pipelineNameResourceDict[$dependency] -pipelineNameResourceDict $pipelineNameResourceDict -visited $visited -sortedList $sortedList
}
}
$sortedList.Push($pipeline)
}
Expand Down

0 comments on commit caa2884

Please sign in to comment.