Skip to content

Commit

Permalink
fix: Updated module tests to account for latest template changes (Azu…
Browse files Browse the repository at this point in the history
…re#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

<!-- Insert your Pipeline Status Badge below -->

| 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

<!-- Use the check-boxes [x] on the options that are relevant. -->

- [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 <[email protected]>
  • Loading branch information
2 people authored and segraef committed Apr 4, 2024
1 parent b67cb87 commit a20ae69
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions avm/res/network/public-ip-address/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions avm/res/network/public-ip-address/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a20ae69

Please sign in to comment.