Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 31 commits into from
Sep 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
3b46cc1
Simplified specs resource type identification
AlexanderSehr Sep 1, 2023
fba9f9e
Updated tempalte spec name handling
AlexanderSehr Sep 1, 2023
126d4eb
Added a switch to control the name used for publishing via the settin…
AlexanderSehr Sep 1, 2023
97d4c95
Temp switching setting to use classic name for testing
AlexanderSehr Sep 1, 2023
b6936f0
Removed apparently redundant function
AlexanderSehr Sep 1, 2023
8cc1229
Introduced temp change
AlexanderSehr Sep 1, 2023
6a770da
Introduced temp change
AlexanderSehr Sep 1, 2023
bafb9a3
Added conversion
AlexanderSehr Sep 1, 2023
a562ddb
Added Microsoft to MS rename for template specs
AlexanderSehr Sep 1, 2023
f7b5563
Disabled anything but publishing for testing
AlexanderSehr Sep 1, 2023
704ba72
Disabled anything but publishing for testing
AlexanderSehr Sep 1, 2023
dac3f25
Disabled universal packaging as already tested
AlexanderSehr Sep 1, 2023
756bdee
Disabled api aligned
AlexanderSehr Sep 1, 2023
c2727d3
Disabled most of gh pipeline for testing
AlexanderSehr Sep 1, 2023
49d45e9
Refactored bool conversion to be more robust
AlexanderSehr Sep 1, 2023
df0185b
Added missing quote
AlexanderSehr Sep 1, 2023
3f6caf5
Update to latest
AlexanderSehr Sep 1, 2023
0c6ef42
Undid temp change
AlexanderSehr Sep 1, 2023
b4deca8
Small fix
AlexanderSehr Sep 1, 2023
9a2657e
Removed temp changes
AlexanderSehr Sep 1, 2023
b06acf8
Added missing flag
AlexanderSehr Sep 1, 2023
06714b1
Added missing flag
AlexanderSehr Sep 1, 2023
277710f
Re-enabled tests
AlexanderSehr Sep 1, 2023
a380486
Readme fixes
AlexanderSehr Sep 1, 2023
b26fa70
Readme fixes
AlexanderSehr Sep 1, 2023
b307dd3
Readme fixes
AlexanderSehr Sep 1, 2023
7679063
ReadMe Fixes
AlexanderSehr Sep 1, 2023
72610f4
Update utilities/pipelines/resourcePublish/Get-TemplateSpecsName.ps1
AlexanderSehr Sep 1, 2023
5f95afd
Renamed param to align
AlexanderSehr Sep 2, 2023
5f454b2
Added examples
AlexanderSehr Sep 2, 2023
db028b4
Small update to verbosity
AlexanderSehr Sep 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 27 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 @@ -189,11 +192,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 +245,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 +262,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 @@ -287,6 +292,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 +342,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 +358,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 @@ -382,6 +389,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
45 changes: 26 additions & 19 deletions .github/actions/templates/publishModule/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,22 @@
## ACTION PARAMETERS ##
##-------------------------------------------##
##
## |===========================================================================================================================================================================================================|
## | Parameter | Required | Default | Description | Example |
## |--------------------------|----------|---------|--------------------------------------------------------------------------------------------------|--------------------------------------------------------|
## | templateFilePath | true | '' | The path to the template file to publish | 'modules/api-management/service/main.bicep' |
## | subscriptionId | false | '' | The ID of the subscription to publish to | '11111111-1111-1111-1111-111111111111' |
## | templateSpecsRgName | false | '' | Required to publish to template spec. ResourceGroup of the template spec to publish to | 'artifacts-rg' |
## | templateSpecsRgLocation | false | '' | Required to publish to template spec. Location of the template spec resource group | 'WestEurope' |
## | templateSpecsDescription | false | '' | Required to publish to template spec. Description of the template spec to publish to | 'This is an API-Management service template' |
## | templateSpecsDoPublish | false | 'false' | Flag to indicate whether or not to publish to template specs | 'true' |
## | bicepRegistryName | false | '' | Required to publish to private bicep registry. Name of the container registry to publish to | 'myacr' |
## | bicepRegistryRgName | false | '' | Required to publish to private bicep registry. Name of the container registry resource group | 'artifacts-rg' |
## | bicepRegistryRgLocation | false | '' | Required to publish to private bicep registry. Location of the container registry resource group | 'WestEurope' |
## | bicepRegistryDoPublish | false | 'false' | Flag to indicate whether or not to publish to the private bicep registry | 'true' |
## | publishLatest | false | 'true' | Flag to indicate whether or not to publish a "latest" version | 'true' |
## |===========================================================================================================================================================================================================|
## |==============================================================================================================================================================================================================|
## | Parameter | Required | Default | Description | Example |
## |----------------------------|----------|---------|---------------------------------------------------------------------------------------------------|--------------------------------------------------------|
## | templateFilePath | true | '' | The path to the template file to publish | 'modules/api-management/service/main.bicep' |
## | subscriptionId | false | '' | The ID of the subscription to publish to | '11111111-1111-1111-1111-111111111111' |
## | templateSpecsRgName | false | '' | Required to publish to template spec. ResourceGroup of the template spec to publish to | 'artifacts-rg' |
## | templateSpecsRgLocation | false | '' | Required to publish to template spec. Location of the template spec resource group | 'WestEurope' |
## | templateSpecsDescription | false | '' | Required to publish to template spec. Description of the template spec to publish to | 'This is an API-Management service template' |
## | templateSpecsDoPublish | false | 'false' | Flag to indicate whether or not to publish to template specs | 'true' |
## | bicepRegistryName | false | '' | Required to publish to private bicep registry. Name of the container registry to publish to | 'myacr' |
## | bicepRegistryRgName | false | '' | Required to publish to private bicep registry. Name of the container registry resource group | 'artifacts-rg' |
## | bicepRegistryRgLocation | false | '' | Required to publish to private bicep registry. Location of the container registry resource group | 'WestEurope' |
## | bicepRegistryDoPublish | false | 'false' | Flag to indicate whether or not to publish to the private bicep registry | 'true' |
## | publishLatest | false | 'true' | Flag to indicate whether or not to publish a "latest" version | 'true' |
## | useApiSpecsAlignedName | false | 'false' | Flag to indicate whether or not to publish module using their REST API, or their folder path name | 'true' |
## |==============================================================================================================================================================================================================|
##
##---------------------------------------------##
name: 'Publishing'
Expand Down Expand Up @@ -69,6 +70,10 @@ inputs:
description: 'Flag to indicate whether or not to publish a "latest" version'
default: 'true'
required: false
useApiSpecsAlignedName:
description: 'Flag to indicate whether or not to publish module using their REST API, or their folder path name'
default: 'false'
required: false

runs:
using: 'composite'
Expand Down Expand Up @@ -105,7 +110,7 @@ runs:
################################
$functionInput = @{
TemplateFilePath = Join-Path $env:GITHUB_WORKSPACE "${{ inputs.templateFilePath }}"
PublishLatest = [bool] "${{ inputs.publishLatest }}"
PublishLatest = [System.Convert]::ToBoolean("${{ inputs.publishLatest }}")
}

Write-Verbose "Invoke task with" -Verbose
Expand All @@ -122,7 +127,7 @@ runs:
$missingInputObject = @{
TemplateFilePath = Join-Path $env:GITHUB_WORKSPACE "${{ inputs.templateFilePath }}"
TemplateSpecsRGName = '${{ inputs.templateSpecsRgName }}'
PublishLatest = [bool] "${{ inputs.publishLatest }}"
PublishLatest = [System.Convert]::ToBoolean("${{ inputs.publishLatest }}")
}

Write-Verbose "Invoke Get-ModulesMissingFromTemplateSpecsRG with" -Verbose
Expand All @@ -149,6 +154,7 @@ runs:
TemplateSpecsRgLocation = '${{ inputs.templateSpecsRgLocation }}'
TemplateSpecsDescription = '${{ inputs.templateSpecsDescription }}'
ModuleVersion = $moduleToPublish.Version
UseApiSpecsAlignedName = [System.Convert]::ToBoolean('${{ inputs.useApiSpecsAlignedName }}')
}

Write-Verbose "Invoke task with" -Verbose
Expand Down Expand Up @@ -185,7 +191,7 @@ runs:
################################
$functionInput = @{
TemplateFilePath = Join-Path $env:GITHUB_WORKSPACE "${{ inputs.templateFilePath }}"
PublishLatest = [bool] "${{ inputs.publishLatest }}"
PublishLatest = [System.Convert]::ToBoolean("${{ inputs.publishLatest }}")
}

Write-Verbose "Invoke task with" -Verbose
Expand All @@ -202,7 +208,7 @@ runs:
TemplateFilePath = Join-Path $env:GITHUB_WORKSPACE "${{ inputs.templateFilePath }}"
BicepRegistryName = '${{ inputs.bicepRegistryName }}'
BicepRegistryRgName = '${{ inputs.bicepRegistryRgName }}'
PublishLatest = [bool] "${{ inputs.publishLatest }}"
PublishLatest = [System.Convert]::ToBoolean("${{ inputs.publishLatest }}")
}

Write-Verbose "Invoke Get-ModulesMissingFromPrivateBicepRegistry with" -Verbose
Expand All @@ -229,6 +235,7 @@ runs:
BicepRegistryRgName = '${{ inputs.bicepRegistryRgName }}'
BicepRegistryRgLocation = '${{ inputs.bicepRegistryRgLocation }}'
ModuleVersion = $moduleToPublish.Version
UseApiSpecsAlignedName = [System.Convert]::ToBoolean('${{ inputs.useApiSpecsAlignedName }}')
}

Write-Verbose "Invoke task with" -Verbose
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/template.module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,4 @@ jobs:
bicepRegistryRgLocation: '${{ env.bicepRegistryRgLocation }}'
bicepRegistryDoPublish: '${{ env.bicepRegistryDoPublish }}'
publishLatest: '${{ env.publishLatest }}'
useApiSpecsAlignedName: '${{ env.useApiSpecsAlignedName }}'
1 change: 1 addition & 0 deletions settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ variables:
# --------------- #

publishLatest: true # [Only for Template-Specs & Bicep Registry] Publish an absolute latest version. Note: This version may include breaking changes and is not recommended for production environments
useApiSpecsAlignedName: false # Publish a module not using its folder path, but the matching name in the REST API (i.e., the classic naming). For example: `bicep/modules/microsoft.keyvault.vaults.secrets` instead of `bicep/modules/key-vault.vault.secret`

# Template-Spec settings #
# ---------------------- #
Expand Down
Loading
Loading