-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Script for adding Include paths to mgmt yml (#9567)
* Add Script for adding include paths to mgmt yml * Set trigger to none, and adjust update-mgmt-yml script * Update Contributing Docs
- Loading branch information
1 parent
8902f9f
commit 6616b68
Showing
3 changed files
with
206 additions
and
22 deletions.
There are no files selected for viewing
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,60 @@ | ||
<# | ||
.SYNOPSIS | ||
Updates the Management pipeline definition | ||
.DESCRIPTION | ||
Adds exclusion paths for all client packages in the management pipeline to prevent it from runing during client builds. | ||
Script assumes that the yml is currently valid and has trigger and pr sections | ||
.PARAMETER PackagesPath | ||
Path to the directory containing all the services | ||
.PARAMETER MgmtYmlPath | ||
Path to the management yml definition | ||
.EXAMPLE | ||
Run script with default parameters. | ||
Update-Mgmt-Yml.ps1 | ||
#> | ||
Param ( | ||
[string] $PackagesPath = "${PSScriptRoot}/../sdk", | ||
[string] $MgmtYmlPath = "${PSScriptRoot}/pipelines/mgmt.yml" | ||
) | ||
|
||
Install-Module -Name powershell-yaml -RequiredVersion 0.4.1 -Force -Scope CurrentUser | ||
|
||
$MgmtYml = Get-Content $MgmtYmlPath -Raw | ||
$MgmtYmlObj = ConvertFrom-Yaml $MgmtYml -Ordered | ||
|
||
$Pr = [ordered]@{ } | ||
$CiBranches = [ordered]@{ } | ||
$CiPaths = [ordered]@{ } | ||
$PrBranches = [ordered]@{ } | ||
$PrPaths = [ordered]@{ } | ||
$Includes = New-Object "System.Collections.Generic.List[String]" | ||
$PrIncludes = New-Object "System.Collections.Generic.List[String]" | ||
|
||
$MgmtDirs = Get-ChildItem -Path "$PackagesPath" -Directory -Recurse -Depth 1 | Where-Object { $_.FullName -match ".Management.|\\mgmt" } | ||
|
||
# Add Each client path to the exclude list | ||
foreach ($Item in $MgmtDirs) { | ||
$IncludePath = $Item.FullName.Substring($Item.FullName.IndexOf("sdk\")) | ||
if ($IncludePath.Split('\').Length -eq 3) { | ||
$IncludePath = $IncludePath -replace "\\", "/" | ||
$Includes.Add($IncludePath) | ||
} | ||
} | ||
|
||
# Ci and Pr section | ||
$PrIncludes.Add('master') | ||
$PrIncludes.Add('*-preview') | ||
$PrBranches.Add("include", $PrIncludes) | ||
$PrPaths.Add("include", $Includes) | ||
$Pr.Add("branches", $PrBranches) | ||
$Pr.Add("paths", $PrPaths) | ||
|
||
$MgmtYmlObj.pr = $Pr | ||
|
||
$NewMgmtYml = ConvertTo-Yaml $MgmtYmlObj -OutFile $MgmtYmlPath -Force |
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