Skip to content

Commit

Permalink
fix: Added baseTime parameter overwrite to CI (#2740)
Browse files Browse the repository at this point in the history
## Description

Many of our test cases implement the parameter `param baseTime string =
utcNow('u')` to generate unique names.
While a good idea in theory, it has the flaw that also each retry will
lead to a new value which can cause re-runs to fail if for example a key
vault referenced for CMK suddenly changes.
The proposed solution is to set the value once per pipeline run in the
workflow and hence overwrite the default value of each template IF the
template contains the `baseTime` parameter.

## Pipeline Reference

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

| Pipeline |
| -------- |
|
[![avm.res.compute.disk-encryption-set](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.compute.disk-encryption-set.yml/badge.svg?branch=users%2Falsehr%2FbaseTimeOverwrite&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.compute.disk-encryption-set.yml)
(has `baseTime` parameter) |
|
[![avm.res.analysis-services.server](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.analysis-services.server.yml/badge.svg?branch=users%2Falsehr%2FbaseTimeOverwrite&event=workflow_dispatch)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.analysis-services.server.yml)
(does not have the `baseTime` parameter) |

## Type of Change

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

- [x] Update to CI Environment or utilities (Non-module affecting
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]>
Co-authored-by: Maher Aldineh <[email protected]>
  • Loading branch information
3 people authored Jul 23, 2024
1 parent e247d3f commit 6ae1474
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/actions/templates/avm-validateModuleDeployment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ runs:
resourceLocation = '${{ steps.get-resource-location.outputs.resourceLocation }}'
}
}
if($moduleTemplatePossibleParameters -contains 'baseTime') {
$functionInput.AdditionalParameters += @{
baseTime = (Get-Date).ToString('u') # Setting base time explicitly so that any potential retry will reuse the same timestamp
}
}
Write-Verbose 'Invoke task with' -Verbose
Write-Verbose ($functionInput | ConvertTo-Json | Out-String) -Verbose
Expand Down Expand Up @@ -269,6 +274,11 @@ runs:
resourceLocation = '${{ steps.get-resource-location.outputs.resourceLocation }}'
}
}
if($moduleTemplatePossibleParameters -contains 'baseTime') {
$functionInput.AdditionalParameters += @{
baseTime = (Get-Date).ToString('u') # Setting base time explicitly so that any potential retry will reuse the same timestamp
}
}
Write-Verbose 'Invoke task with' -Verbose
Write-Verbose ($functionInput | ConvertTo-Json | Out-String) -Verbose
Expand Down

0 comments on commit 6ae1474

Please sign in to comment.