Azure / ResourceModules

This repository includes a CI platform for and collection of mature and curated Bicep modules. The platform supports both ARM and Bicep and can be leveraged using GitHub actions as well as Azure DevOps pipelines.
https://aka.ms/carml
MIT License
726 stars 457 forks source link

[Bug Report]: Publishing of resources with '--' in name fails (gracefully) #3592

Open MariusStorhaug opened 1 year ago

MariusStorhaug commented 1 year ago

Describe the bug

Modules with a name containing '--' seems to be failing the publishing step as the ACR repos do not allow for consecutive '.', '_' or '-' characters.

From: https://github.com/Azure/ResourceModules/actions/runs/5811199687/job/15754407806#step:4:610

 - [digital-twins/digital-twins-instances/endpoints--service-bus] [latest]
  VERBOSE: Invoke task with
  VERBOSE: {
    "TemplateFilePath": "/home/runner/work/ResourceModules/ResourceModules/modules/digital-twins/digital-twins-instances/endpoints--service-bus/main.bicep",
    "BicepRegistryRgName": "artifacts-rg",
    "BicepRegistryRgLocation": "West Europe",
    "ModuleVersion": "latest",
    "BicepRegistryName": "adpsxxazacrx001"
  }

  VERBOSE: Performing the operation "Publish" on target "Private bicep registry entry [bicep/modules/digital-twins.digital-twins-instances.endpoints--service-bus] version [latest] to registry [adpsxxazacrx001]".
  The specified OCI artifact reference "br:adpsxxazacrx001.azurecr.io/bicep/modules/digital-twins.digital-twins-instances.endpoints--service-bus:latest" is not valid. The module path segment "digital-twins.digital-twins-instances.endpoints--service-bus" is not valid. Each module name path segment must be a lowercase alphanumeric string optionally separated by a ".", "_" , or "-".
  VERBOSE: Publish complete

2 tasks:

To reproduce

Review the Digital Twins pipeline

Code snippet

No response

Relevant log output

No response

ChrisGibson1982 commented 1 year ago

Is there any resolution to this?

ChrisGibson1982 commented 1 year ago

This is present in web\sites\hosting-environment as well

AlexanderSehr commented 5 months ago

Hey @eriqua, however we solve this - this should then also be consider for BRM if we ever get to publish child-modules.

There may be a fast workaround by updating the publishing in CARML to replace the -- with something that is allowed. However, I believe the 'correct' yet more intense solution would be to stop having different child-modules for the same sub-resource-type and instead have one with a corresponding User-Defined-Type interface for each collection of properties based on a discriminator. By now, this feature was added to the Bicep language, so we could implement it.

eriqua commented 5 months ago

@AlexanderSehr sounds fair. Not sure what should be the best place for this issue though. l'd like to avoid implementing a convention in CARML and changing that later to align to BRM once we get to publishing children. I'm almost inclined to put this on hold until defining the convention in AVM. Meanwhile nothing prevents to test a possible implementation of course, but I wouldn't merge to main yet.