ResourceModules icon indicating copy to clipboard operation
ResourceModules copied to clipboard

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

Open MariusStorhaug opened this issue 3 years ago • 4 comments

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:

  • [ ] Fix the publishing logic to fail the pipeline if the publishing fails.
  • [ ] Look at how to handle naming of resources when published to ACR (atleast). Other resources with the same issue:
    • [ ] digital-twins\digital-twins-instances\ pipeline
      • [ ] endpoints--event-grid
      • [ ] endpoints--event-hub
      • [ ] endpoints--service-bus
    • [ ] web\hosting-environments\ pipeline
      • [ ] configurations--customdnssuffix
      • [ ] configurations--networking
    • [ ] web\sites\ pipeline
      • [ ] config--appsettings
      • [ ] config--authsettingsv2
      • [ ] slots\config--appsettings
      • [ ] slots\config--authsettingsv2

To reproduce

Review the Digital Twins pipeline

Code snippet

No response

Relevant log output

No response

MariusStorhaug avatar Aug 20 '23 12:08 MariusStorhaug

Is there any resolution to this?

ChrisGibson1982 avatar Sep 25 '23 10:09 ChrisGibson1982

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

ChrisGibson1982 avatar Sep 25 '23 10:09 ChrisGibson1982

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.

AlexanderSehr avatar May 19 '24 18:05 AlexanderSehr

@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.

eriqua avatar Jun 02 '24 20:06 eriqua