Skip to content

Commit

Permalink
Resolveed conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderSehr committed Sep 21, 2023
2 parents f98801a + f550b60 commit fe99645
Show file tree
Hide file tree
Showing 7 changed files with 315 additions and 223 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ runs:
$functionInput = @{
PesterTestResults = $testResults
OutputFilePath = Join-Path $env:GITHUB_WORKSPACE 'Pester-output.md'
OutputFilePath = Join-Path $env:GITHUB_WORKSPACE 'avm' 'Pester-output.md'
GitHubRepository = $env:GITHUB_REPOSITORY
BranchName = $env:GITHUB_REF
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function Publish-ModuleFromTagToPBR {
# TODO: Diff in between tag & tag^-1 to find modules to publish?

# 1. Find tag as per function input
$repositoryRoot = (Get-Item $PSScriptRoot).Parent.Parent.Parent.Parent
$repositoryRoot = (Get-Item $PSScriptRoot).Parent.Parent.Parent.Parent.Parent
$targetVersion = Split-Path $ModuleReleaseTagName -Leaf
$moduleRelativeFolderPath = $ModuleReleaseTagName -replace "\/$targetVersion$", ''
$moduleFolderPath = Join-Path $repositoryRoot $moduleRelativeFolderPath
Expand Down Expand Up @@ -53,4 +53,4 @@ function Publish-ModuleFromTagToPBR {
'--force'
)
# bicep publish @publishInput
}
}
40 changes: 40 additions & 0 deletions avm/utilities/pipelines/sharedScripts/Get-NestedResourceList.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<#
.SYNOPSIS
Get a list of all resources (provider + service) in the given template content
.DESCRIPTION
Get a list of all resources (provider + service) in the given template content. Crawls through any children & nested deployment templates.
.PARAMETER TemplateFileContent
Mandatory. The template file content object to crawl data from
.EXAMPLE
Get-NestedResourceList -TemplateFileContent @{ resource = @{}; ... }
Returns a list of all resources in the given template object
#>
function Get-NestedResourceList {

[CmdletBinding()]
param(
[Parameter(Mandatory)]
[Alias('Path')]
[hashtable] $TemplateFileContent
)

$res = @()
$currLevelResources = @()
if ($TemplateFileContent.resources) {
$currLevelResources += $TemplateFileContent.resources
}
foreach ($resource in $currLevelResources) {
$res += $resource

if ($resource.type -eq 'Microsoft.Resources/deployments') {
$res += Get-NestedResourceList -TemplateFileContent $resource.properties.template
} else {
$res += Get-NestedResourceList -TemplateFileContent $resource
}
}
return $res
}
38 changes: 38 additions & 0 deletions avm/utilities/pipelines/sharedScripts/Get-PipelineFileName.ps1
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
}
Loading

0 comments on commit fe99645

Please sign in to comment.