Azure / bicep-registry-modules

Bicep registry modules
MIT License
434 stars 286 forks source link

[AVM CI Environment Issue]: `Set-AVMModule` creates `main.bicep` in wrong directory, overflow error #2637

Closed cecheta closed 1 week ago

cecheta commented 3 weeks ago

Check for previous/existing GitHub issues

Issue Type?

Bug

Description

When I use the Set-AVMModule to generate documentation and build the Bicep, it generates a main.bicep file in the wrong directory. If I try to re-run it, I receive an error InvalidOperation: The script failed due to call depth overflow.

Steps to reproduce:

There is now a new main.bicep file at /workspaces/bicep-registry-modules/avm/res/aad/domain-service/aad/domain-service/main.bicep

Logs:

VERBOSE: Added file [/workspaces/bicep-registry-modules/avm/res/aad/domain-service/aad/domain-service/main.bicep]
Building [avm/res/aad/domain-service/main.bicep]                                                                        
Generating readme for [avm/res/aad/domain-service/main.bicep] 

Logs:

InvalidOperation: The script failed due to call depth overflow.

I don't have much experience with PowerShell so I'm not sure if I'm simply running the script incorrectly

microsoft-github-policy-service[bot] commented 3 weeks ago

[!IMPORTANT] The "Needs: Triage :mag:" label must be removed once the triage process is complete!

[!TIP] For additional guidance on how to triage this issue/PR, see the BRM Issue Triage documentation.

microsoft-github-policy-service[bot] commented 2 weeks ago

[!WARNING] Tagging the AVM Core Team (@Azure/avm-core-team-technical-bicep) due to a module owner or contributor having not responded to this issue within 3 business days. The AVM Core Team will attempt to contact the module owners/contributors directly.

[!TIP]

  • To prevent further actions to take effect, the "Status: Response Overdue šŸš©" label must be removed, once this issue has been responded to.
  • To avoid this rule being (re)triggered, the ""Needs: Triage :mag:" label must be removed as part of the triage process (when the issue is first responded to)!
AlexanderSehr commented 2 weeks ago

Hey @cecheta, thanks for raising this. I'll take a look as soon as I can.

AlexanderSehr commented 2 weeks ago

Hey @cecheta, sadly, I cannot reproduce the issue (locally). I wonder if it is something codespaces-specific. I've never used them so I don't know what makes them 'different'. Can you reproduce the issue locally? If not, I guess the next step would then be to try and debug the script in a Codespace instance. For that I'd need to find out how to use them first though šŸ˜„

I suspect it must have something to do with this line https://github.com/Azure/bicep-registry-modules/blob/0a48211fef4e81efe36a15c65e7e6f2efa395ad6/avm/utilities/tools/helper/Set-ModuleFileAndFolderSetup.ps1#L56 which may not perform the split in the way it's intended. Will also pull @ChrisSidebotham in as he may have an idea / has seen this before.

cecheta commented 1 week ago

I couldn't reproduce this when running PowerShell locally, so this seems to only be an issue when using a devcontainer

AlexanderSehr commented 1 week ago

Found the reason. One line in that code is hardcoded to Windows. Will open a PR to fix