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

feat: Added support for Discrimintor-based variants to readme utility #4146

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

Conversation

AlexanderSehr
Copy link
Contributor

@AlexanderSehr AlexanderSehr commented Jan 12, 2025

Description

  • Variants of a type are listed below the property with the discriminator and are recurisvely resolved just as classic parameter - just with the discriminator in the header
  • Also, because it surfaced in this PR for two modules, I implemented a fix for the ReadMe test that previously (if failed) could under specific cirmustances also fail the GitHub Output. The circmustance was that the Set-ModuleReadMe script would throw an exception during the generation, returning the error that would hit the Pester-Output which in turn would pollute the test results the GitHub-Output function then failed to interpret and publish. The fix essentially catches this exception and fails the test with a proper error message, pointing to the actual cause of the error (e.g., a parameter not having a description category specified). See screenshots at the buttom for a before-after comparison.
  • Finally, I implemented a fix for the parameter-resolving function used by out pester tests that was unable to resolve types using a discriminator

Required module fixes

  • Updated the Virtual-Network-Gateway itself as its incorrect UDT(s) would make running the readme generation and passing the tests impossible. Changes include
    • Added missing property descriptions
    • Fixed an incorrect category for a parameter
    • Added a UDT for the NAT Rules child module
    • Updated tests
  • Updated the Insights-Metric-Alert itself as its incorrect UDT(s) would make running the readme generation and passing the tests impossible. Changes include
    • Added missing property descriptions
    • Updated tests

Closes #4128

  • TODO: Test with more recursive test templates
  • TODO: Regenerate all readmes
  • TODO: Run tests via workflows

image

Pipeline Reference

Pipeline
avm.ptn.ai-platform.baseline
avm.ptn.dev-ops.cicd-agents-and-runners
avm.ptn.lz.sub-vending
avm.res.dev-ops-infrastructure.pool
avm.res.insights.data-collection-rule
avm.res.insights.metric-alert
avm.res.machine-learning-services.workspace
avm.res.network.virtual-network-gateway
avm.res.virtual-machine-images.image-template
Modules without discriminator
avm.res.storage.storage-account

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

Appendix

Error before the fix

image

image

Error after the fix

image

image

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Triage 🔍 Maintainers need to triage still label Jan 12, 2025
@AlexanderSehr AlexanderSehr self-assigned this Jan 12, 2025
@AlexanderSehr AlexanderSehr added Needs: Core Team 🧞 This item needs the AVM Core Team to review it Type: CI 🚀 This issue is related to the AVM CI and removed Needs: Triage 🔍 Maintainers need to triage still labels Jan 12, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added the Type: AVM 🅰️ ✌️ Ⓜ️ This is an AVM related issue label Jan 12, 2025
@AlexanderSehr AlexanderSehr marked this pull request as ready for review January 21, 2025 16:54
@AlexanderSehr AlexanderSehr requested review from a team as code owners January 21, 2025 16:54
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 Type: AVM 🅰️ ✌️ Ⓜ️ This is an AVM related issue Type: CI 🚀 This issue is related to the AVM CI
Projects
None yet
1 participant