-
Notifications
You must be signed in to change notification settings - Fork 459
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CI environment] Get yml pipeline name based on specs resourcetype (#…
…3507) * update pester pipeline scripts * cleanup
- Loading branch information
Showing
3 changed files
with
44 additions
and
4 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
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,38 @@ | ||
<# | ||
.SYNOPSIS | ||
Find the correct yml pipeline naming for a given resource identifier. | ||
.DESCRIPTION | ||
Find the correct yml pipeline naming for a given resource identifier. | ||
If a child resource type is provided, the corresponding yml pipeline name is the one of its parent resource type | ||
.PARAMETER ResourceIdentifier | ||
Mandatory. The resource identifier to search for, i.e. the relative module file path starting from the resource provider folder. | ||
.EXAMPLE | ||
Get-PipelineFileName -ResourceIdentifier 'storage/storage-account/blob-service/container/immutability-policy'. | ||
Returns 'ms.storage.storageaccounts.yml'. | ||
.EXAMPLE | ||
Get-PipelineFileName -ResourceIdentifier 'storage/storage-account'. | ||
Returns 'ms.storage.storageaccounts.yml'. | ||
#> | ||
function Get-PipelineFileName { | ||
|
||
[CmdletBinding()] | ||
param ( | ||
[Parameter(Mandatory = $true)] | ||
[string] $ResourceIdentifier | ||
) | ||
|
||
. (Join-Path $PSScriptRoot 'Get-SpecsAlignedResourceName.ps1') | ||
|
||
$provider, $parentType, $childTypeString = $ResourceIdentifier -split '[\/|\\]', 3 | ||
$parentResourceIdentifier = $provider, $parentType -join '/' | ||
$formattedParentResourceType = Get-SpecsAlignedResourceName -ResourceIdentifier $parentResourceIdentifier | ||
$pipelineFileName = '{0}.yml' -f $formattedParentResourceType.Replace('Microsoft.', 'ms.').Replace('/', '.').ToLower() | ||
|
||
return $pipelineFileName | ||
} |