Skip to content

fix: fixes CI tests ptn/deployment-script/import-image-to-acr #4973

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

Open
wants to merge 67 commits into
base: main
Choose a base branch
from

Conversation

ReneHezser
Copy link
Contributor

@ReneHezser ReneHezser commented Apr 2, 2025

Description

The names for Azure resources in the test cases are now calculated and should not generate "name in use" exceptions.
For the max test to pass, we are waiting for Resources in nested template not shown if reference is used in the parameter values

Closes #4943
Closes #4918

Pipeline Reference

Pipeline
avm.ptn.deployment-script.import-image-to-acr

Type of Change

  • 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

Checklist

  • I'm sure there are no other open Pull Requests for the same update/change
  • I have run Set-AVMModule locally to generate the supporting module files.
  • My corresponding pipelines / checks run clean and green without any errors or warnings

@ReneHezser ReneHezser added the Needs: External Changes ⚒️ When an issue/PR requires changes that are outside of the control of the module. e.g. to an RP. label Apr 2, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Triage 🔍 Maintainers need to triage still Type: AVM 🅰️ ✌️ Ⓜ️ This is an AVM related issue labels Apr 2, 2025
@ReneHezser ReneHezser marked this pull request as ready for review April 10, 2025 08:02
@ReneHezser ReneHezser requested review from a team as code owners April 10, 2025 08:02
@ReneHezser ReneHezser enabled auto-merge (squash) April 10, 2025 08:02
@avm-team-linter avm-team-linter bot added the Needs: Core Team 🧞 This item needs the AVM Core Team to review it label Apr 10, 2025
@ReneHezser ReneHezser removed the Needs: External Changes ⚒️ When an issue/PR requires changes that are outside of the control of the module. e.g. to an RP. label Apr 10, 2025
@@ -28,14 +28,14 @@ module dependencies 'dependencies.bicep' = {
name: 'dependencies'
scope: resourceGroup
params: {
acrName: 'dep${namePrefix}acr${serviceShort}'
acrName: uniqueString('dep${namePrefix}acr${serviceShort}', subscription().subscriptionId, resourceGroupName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we not agree this is a bad call?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some for all other uniqueString usages

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We didn't want to use tags. The likeliness of our "manually" generated names to be not unique is higher than this approach.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I think that was a conversation in a call I wasn't able to join. Pardon

We absolutely should not use tags. We did in the very beginning of AVM's predecessor's CARML's predecessor IaCS and has many issues one may not think off when approaching it. E.g., that they're not supported by all resources, nor propagated immediately.

The 'manually' generated names are fine as the namePrefix is unique to your fork and the serviceShort unique to each test case. Plus it can be consistently applied to all scopes. Using e.g. the subscription() function does not work for any scope above. Same for resource group etc. The other problem is that it becomes impossible to trace the name back to its origin.

If you have a conflict, there are several other subjectively better options (which may be objectively wrong 😄)

  • Change the namePrefix
  • Add a number suffix to the resource name
  • Use the uniqueString(), but only for a suffix including a take() function to ensure the name is not getting too long

I'd probably argue the 3rd option is probably the best and could be rolled out to each test. Using e.g. uniqueString(subscription().subscriptionId) would ensure the name is always unique to each user and the entire namePrefix would not be needed. For mgmtGroup we could I guess use it's ID. Something like that. Thoughts?

cc: @eriqua (as you may be interested too)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a big fan of updating all test cases for an issue which seems to be very limited. We have multiple name chunks decreasing the likelihood of name conflicts, plus not all resources have a globally unique name.
As mentioned in our call I'd suggest the number suffix as the easiest approach. Option 3 Alex suggested is also fine, but I'd suggest to keep it to the owner to change if needed and only for globally unique resource names

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is anything still happening here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Core Team 🧞 This item needs the AVM Core Team to review it Needs: Triage 🔍 Maintainers need to triage still Type: AVM 🅰️ ✌️ Ⓜ️ This is an AVM related issue
Projects
None yet
3 participants