From eb6d7f280f45621cefc117a50c91ce2cb4d9af99 Mon Sep 17 00:00:00 2001 From: Alexander Sehr Date: Wed, 3 Apr 2024 23:07:54 +0200 Subject: [PATCH] fix: Updated module tests to account for latest template changes (#1523) ## Description - Fixed module tests to account for latest issue template changes IMPORTANT: It relies now on only having one location that contains a list of modules. More may not be introduced in the future. - Introduced change to pip module to trigger re-publish after the workflow failed before ## Pipeline Reference | Pipeline | | -------- | | [![avm.res.network.public-ip-address](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.public-ip-address.yml/badge.svg?branch=users%2Falsehr%2FpipStatic&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.public-ip-address.yml) (unrelated) | ## Type of Change - [x] Update to CI Environment or utlities (Non-module effecting changes) - [ ] Azure Verified Module updates: - [ ] Bugfix containing backwards compatible bug fixes, and I have NOT bumped the MAJOR or MINOR version in `version.json`: - [ ] Someone has opened a bug report issue, and I have included "Closes #{bug_report_issue_number}" in the PR description. - [ ] The bug was found by the module author, and no one has opened an issue to report it yet. - [ ] Feature update backwards compatible feature updates, and I have bumped the MINOR version in `version.json`. - [ ] Breaking changes and I have bumped the MAJOR version in `version.json`. - [ ] Update to documentation --------- Co-authored-by: Erika Gressi <56914614+eriqua@users.noreply.github.com> --- avm/res/network/public-ip-address/main.bicep | 4 ++-- avm/res/network/public-ip-address/main.json | 6 +++--- .../pipelines/staticValidation/compliance/module.tests.ps1 | 3 +-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/avm/res/network/public-ip-address/main.bicep b/avm/res/network/public-ip-address/main.bicep index fd4d7f1931..8b2bb3d8e7 100644 --- a/avm/res/network/public-ip-address/main.bicep +++ b/avm/res/network/public-ip-address/main.bicep @@ -148,7 +148,7 @@ resource publicIpAddress 'Microsoft.Network/publicIPAddresses@2023-09-01' = { } : null idleTimeoutInMinutes: idleTimeoutInMinutes - ipTags: [] + ipTags: null // Note: Requires feature 'Microsoft.Network/AllowBringYourOwnPublicIpAddress' to be registered on the subscription } } @@ -223,7 +223,7 @@ output name string = publicIpAddress.name output resourceId string = publicIpAddress.id @description('The public IP address of the public IP address resource.') -output ipAddress string = contains(publicIpAddress.properties, 'ipAddress') ? publicIpAddress.properties.ipAddress : '' +output ipAddress string = publicIpAddress.properties.?ipAddress ?? '' @description('The location the resource was deployed into.') output location string = publicIpAddress.location diff --git a/avm/res/network/public-ip-address/main.json b/avm/res/network/public-ip-address/main.json index 050eecc1b7..9bb75070c4 100644 --- a/avm/res/network/public-ip-address/main.json +++ b/avm/res/network/public-ip-address/main.json @@ -6,7 +6,7 @@ "_generator": { "name": "bicep", "version": "0.26.54.24096", - "templateHash": "9302080973979138347" + "templateHash": "1650798617817777444" }, "name": "Public IP Addresses", "description": "This module deploys a Public IP Address.", @@ -482,7 +482,7 @@ "publicIPAllocationMethod": "[parameters('publicIPAllocationMethod')]", "publicIPPrefix": "[if(not(empty(parameters('publicIpPrefixResourceId'))), createObject('id', parameters('publicIpPrefixResourceId')), null())]", "idleTimeoutInMinutes": "[parameters('idleTimeoutInMinutes')]", - "ipTags": [] + "ipTags": null } }, "publicIpAddress_lock": { @@ -590,7 +590,7 @@ "metadata": { "description": "The public IP address of the public IP address resource." }, - "value": "[if(contains(reference('publicIpAddress'), 'ipAddress'), reference('publicIpAddress').ipAddress, '')]" + "value": "[coalesce(tryGet(reference('publicIpAddress'), 'ipAddress'), '')]" }, "location": { "type": "string", diff --git a/avm/utilities/pipelines/staticValidation/compliance/module.tests.ps1 b/avm/utilities/pipelines/staticValidation/compliance/module.tests.ps1 index 0d68e957d6..4d5bf8a428 100644 --- a/avm/utilities/pipelines/staticValidation/compliance/module.tests.ps1 +++ b/avm/utilities/pipelines/staticValidation/compliance/module.tests.ps1 @@ -1151,10 +1151,9 @@ Describe 'Governance tests' { # Identify listed modules $startIndex = 0 - while ($issueTemplateContent[$startIndex] -notmatch '^\s*- "Other, as defined below\.\.\."' -and $startIndex -ne $issueTemplateContent.Length) { + while ($issueTemplateContent[$startIndex] -notmatch '^\s*#?\s*\-\s+\"avm\/.+\"' -and $startIndex -ne $issueTemplateContent.Length) { $startIndex++ } - $startIndex++ # Go one further than dummy value line $endIndex = $startIndex while ($issueTemplateContent[$endIndex] -match '.*- "avm\/.*' -and $endIndex -ne $issueTemplateContent.Length) {