Skip to content

Commit

Permalink
Users/ahmadabdalla/hotfixes x (#33)
Browse files Browse the repository at this point in the history
* test

* branch test

* Updated SQL Server module to support dynamic location for Maintenance Configuration Property (Azure#3899)

* push version change

* added updates

* updated

* [CI Environment] Enabled the usage of both the old published module name, as well as the new PBR-aligned (Azure#3892)

* Simplified specs resource type identification

* Updated tempalte spec name handling

* Added a switch to control the name used for publishing via the settings.yml

* Temp switching setting to use classic name for testing

* Removed apparently redundant function

* Introduced temp change

* Introduced temp change

* Added conversion

* Added Microsoft to MS rename for template specs

* Disabled anything but publishing for testing

* Disabled anything but publishing for testing

* Disabled universal packaging as already tested

* Disabled api aligned

* Disabled most of gh pipeline for testing

* Refactored bool conversion to be more robust

* Added missing quote

* Update to latest

* Undid temp change

* Small fix

* Removed temp changes

* Added missing flag

* Added missing flag

* Re-enabled tests

* Readme fixes

* Readme fixes

* Readme fixes

* ReadMe Fixes

* Fixed logic by introducing api name fetching

* Push updated Readme file(s)

* try in moduleToPublish script

* test

* test

* test

* test

---------

Co-authored-by: Alexander Sehr <ASehr@hotmail.de>
Co-authored-by: CARMLPipelinePrincipal <CARML@noreply.github.com>
  • Loading branch information
3 people authored Sep 2, 2023
1 parent 3509f80 commit 073875b
Show file tree
Hide file tree
Showing 24 changed files with 518 additions and 414 deletions.
64 changes: 45 additions & 19 deletions .azuredevops/pipelineTemplates/jobs.publishModule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
## | vmImage | '$(vmImage)' | You can provide either a [poolname] or [vmImage] to run the job on | 'ubuntu20.04' |
## | defaultJobTimeoutInMinutes | 120 | The timeout for the job in this pipeline | 120 |
## | modulePath | '$(modulePath)' | The path to the module to deploy. E.g. [c:/KeyVault] | 'c:/KeyVault' |
## | publishLatest | '$(publishLatest)' | Flag to indicate whether or not to publish a "latest" version to Bicep Registry and Template Specs | true |
## | publishLatest | '$(publishLatest)' | Flag to indicate whether or not to publish a "latest" version to Bicep Registry and Template Specs | true |
## | useApiSpecsAlignedName | '$(useApiSpecsAlignedName)' | Flag to indicate whether or not to publish module using their REST API, or their folder path name | true |
## | templateSpecsRGName | '$(templateSpecsRGName)' | Required to publish to template spec. ResourceGroup of the template spec to publish to | 'mgmt-rg' |
## | templateSpecsRGLocation | '$(templateSpecsRGLocation)' | Required to publish to template spec. Location of the template spec resource group | 'West Europe' |
## | templateSpecsDescription | '$(templateSpecsDescription)' | Required to publish to template spec. Description of the template spec to publish to | 'IaCs module' |
Expand Down Expand Up @@ -60,6 +61,7 @@ parameters:

# Shared
publishLatest: '$(publishLatest)'
useApiSpecsAlignedName: '$(useApiSpecsAlignedName)'

## TemplateSpec-related
templateSpecsDoPublish: '$(templateSpecsDoPublish)'
Expand Down Expand Up @@ -164,10 +166,11 @@ jobs:
#############################
# Add all modules that don't exist in the target location
$missingInputObject = @{
TemplateFilePath = $TemplateFilePath
VstsOrganizationUri = '${{ parameters.vstsOrganizationUri }}'
VstsFeedProject = '${{ parameters.vstsFeedProject }}'
VstsFeedName = '${{ parameters.vstsFeedName }}'
TemplateFilePath = $TemplateFilePath
VstsOrganizationUri = '${{ parameters.vstsOrganizationUri }}'
VstsFeedProject = '${{ parameters.vstsFeedProject }}'
VstsFeedName = '${{ parameters.vstsFeedName }}'
UseApiSpecsAlignedName = [System.Convert]::ToBoolean('${{ parameters.useApiSpecsAlignedName }}')
}
Write-Verbose "Invoke Get-ModulesMissingFromUniversalArtifactsFeed with" -Verbose
Expand All @@ -181,6 +184,12 @@ jobs:
}
}
# Filter modules to publish 'prerelease' only if branch is not main/master
if ('$(Build.SourceBranch)' -ne 'refs/heads/main' -or '$(Build.SourceBranch)' -ne 'refs/heads/master') {
Write-Verbose "Filtering modules to only publish [prerelease] as current branch [$(Build.SourceBranch)] is not [main/master]." -Verbose
$modulesToPublish = $modulesToPublish | Where-Object -Property version -like '*-prerelease'
}
#################
## Publish ##
#################
Expand All @@ -189,11 +198,12 @@ jobs:
Write-Host "##[group]$(' - [{0}] [{1}]' -f $RelPath, $moduleToPublish.Version)"
$functionInput = @{
TemplateFilePath = $moduleToPublish.TemplateFilePath
VstsOrganizationUri = '${{ parameters.vstsOrganizationUri }}'
VstsFeedProject = '${{ parameters.vstsFeedProject }}'
VstsFeedName = '${{ parameters.vstsFeedName }}'
ModuleVersion = $moduleToPublish.Version
TemplateFilePath = $moduleToPublish.TemplateFilePath
VstsOrganizationUri = '${{ parameters.vstsOrganizationUri }}'
VstsFeedProject = '${{ parameters.vstsFeedProject }}'
VstsFeedName = '${{ parameters.vstsFeedName }}'
ModuleVersion = $moduleToPublish.Version
UseApiSpecsAlignedName = [System.Convert]::ToBoolean('${{ parameters.useApiSpecsAlignedName }}')
}
Write-Verbose "Invoke Publish-ModuleToUniversalArtifactsFeed with" -Verbose
Expand Down Expand Up @@ -241,7 +251,7 @@ jobs:
################################
$functionInput = @{
TemplateFilePath = $TemplateFilePath
PublishLatest = [bool] '${{ parameters.publishLatest }}'
PublishLatest = [System.Convert]::ToBoolean('${{ parameters.publishLatest }}')
}
Write-Verbose "Invoke Get-ModulesToPublish with" -Verbose
Expand All @@ -258,9 +268,10 @@ jobs:
# Add all modules that don't exist in the target location
$missingInputObject = @{
TemplateFilePath = $TemplateFilePath
TemplateSpecsRGName = '${{ parameters.templateSpecsRgName }}'
PublishLatest = [bool] '${{ parameters.bicepRegistryRgName }}'
TemplateFilePath = $TemplateFilePath
TemplateSpecsRGName = '${{ parameters.templateSpecsRgName }}'
PublishLatest = [System.Convert]::ToBoolean('${{ parameters.publishLatest }}')
UseApiSpecsAlignedName = [System.Convert]::ToBoolean('${{ parameters.useApiSpecsAlignedName }}')
}
Write-Verbose "Invoke Get-ModulesMissingFromTemplateSpecsRG with" -Verbose
Expand All @@ -274,6 +285,12 @@ jobs:
}
}
# Filter modules to publish 'prerelease' only if branch is not main/master
if ('$(Build.SourceBranch)' -ne 'refs/heads/main' -or '$(Build.SourceBranch)' -ne 'refs/heads/master') {
Write-Verbose "Filtering modules to only publish [prerelease] as current branch [$(Build.SourceBranch)] is not [main/master]." -Verbose
$modulesToPublish = $modulesToPublish | Where-Object -Property version -like '*-prerelease'
}
#################
## Publish ##
#################
Expand All @@ -287,6 +304,7 @@ jobs:
TemplateSpecsRgLocation = '${{ parameters.templateSpecsRgLocation }}'
TemplateSpecsDescription = '${{ parameters.templateSpecsDescription }}'
ModuleVersion = $moduleToPublish.Version
UseApiSpecsAlignedName = [System.Convert]::ToBoolean('${{ parameters.useApiSpecsAlignedName }}')
}
Write-Verbose "Invoke Publish-ModuleToTemplateSpecsRG with" -Verbose
Expand Down Expand Up @@ -336,7 +354,7 @@ jobs:
################################
$functionInput = @{
TemplateFilePath = $TemplateFilePath
PublishLatest = [bool] '${{ parameters.publishLatest }}'
PublishLatest = [System.Convert]::ToBoolean('${{ parameters.publishLatest }}')
}
Write-Verbose "Invoke Get-ModulesToPublish with" -Verbose
Expand All @@ -352,10 +370,11 @@ jobs:
#############################
# Add all modules that don't exist in the target location
$missingInputObject = @{
TemplateFilePath = $TemplateFilePath
BicepRegistryName = '${{ parameters.bicepRegistryName }}'
BicepRegistryRgName = '${{ parameters.bicepRegistryRgName }}'
PublishLatest = [bool] '${{ parameters.bicepRegistryRgName }}'
TemplateFilePath = $TemplateFilePath
BicepRegistryName = '${{ parameters.bicepRegistryName }}'
BicepRegistryRgName = '${{ parameters.bicepRegistryRgName }}'
PublishLatest = [System.Convert]::ToBoolean('${{ parameters.publishLatest }}')
UseApiSpecsAlignedName = [System.Convert]::ToBoolean('${{ parameters.useApiSpecsAlignedName }}')
}
Write-Verbose "Invoke Get-ModulesMissingFromPrivateBicepRegistry with" -Verbose
Expand All @@ -369,6 +388,12 @@ jobs:
}
}
# Filter modules to publish 'prerelease' only if branch is not main/master
if ('$(Build.SourceBranch)' -ne 'refs/heads/main' -or '$(Build.SourceBranch)' -ne 'refs/heads/master') {
Write-Verbose "Filtering modules to only publish [prerelease] as current branch [$(Build.SourceBranch)] is not [main/master]." -Verbose
$modulesToPublish = $modulesToPublish | Where-Object -Property version -like '*-prerelease'
}
#################
## Publish ##
#################
Expand All @@ -382,6 +407,7 @@ jobs:
BicepRegistryRgName = '${{ parameters.bicepRegistryRgName }}'
BicepRegistryRgLocation = '${{ parameters.bicepRegistryRgLocation }}'
ModuleVersion = $moduleToPublish.Version
UseApiSpecsAlignedName = [System.Convert]::ToBoolean('${{ parameters.useApiSpecsAlignedName }}')
}
Write-Verbose "Invoke Publish-ModuleToPrivateBicepRegistry with" -Verbose
Expand Down
Loading

0 comments on commit 073875b

Please sign in to comment.