bicep icon indicating copy to clipboard operation
bicep copied to clipboard

Support manually setting contentVersion

Open alex-frankel opened this issue 5 years ago • 7 comments

  1. could be a CLI argument
  2. could be a keyword in the source code

alex-frankel avatar Aug 14 '20 20:08 alex-frankel

Would definitely be handy as we use this to detect if resources need to be deployed in the pipeline so we aren't wasting cycles on waiting for changes when no changes are needed.

smokedlinq avatar May 16 '21 01:05 smokedlinq

Our team is also very much interested in this feature, as we need to fall back to using another template based on the content version.

guperrot avatar Mar 07 '22 20:03 guperrot

Out of curiosity, have you considered using a bicep registry (which supports versions) instead of using the contentVersion property?

alex-frankel avatar Mar 07 '22 23:03 alex-frankel

@alex-frankel what good would that do? The contentVersion shows up in the deployment, but the tag from the bicep registry shows up only in my source code, and is never even available to be logged by bicep.

Jaykul avatar Dec 28 '22 18:12 Jaykul

@alex-frankel - I've just come across a use case for setting ContentVersion too as part of an effort to progress from an ARM deployment system to include Bicep. ContentVersion is leveraged in post build steps in the existing ARM system.

ContentVersion is described in the ARM docs as;

Version of the template (such as 1.0.0.0). You can provide any value for this element. Use this value to document significant changes in your template. When deploying resources using the template, this value can be used to make sure that the right template is being used.

We really should have a way to set it, either from within the bicep file or as an argument to the bicep build command.

Gordonby avatar Jul 12 '23 14:07 Gordonby

Just revisiting this issue again. Quite a smaller and likely under utilised feature of ARM - but would still be good to support even from a basic perspective in bicep.

Gordonby avatar Feb 08 '24 13:02 Gordonby

I think this is an interesting idea, but I also feel like the contentVersion field as of today isn't flexible enough to support other interesting use cases - for example, I think it would be really useful to embed metadata such as "source commit" or "source repo"

 {
  "parameters": {},
  "languageVersion": "2.0",
  "resources": {},
  "metadata": {
    "_generator": {
      "name": "bicep",
      "version": "0.22.6.54827",
      "templateHash": "4713413752423414014"
    },
    "_source": {
      // this would give enough information for an editor to link to an exact point-in-time copy of the original source file - e.g.
      // https://github.com/Azure/bicep-registry-modules/blob/02050197700fb3abe82deb91e487898a1f92a0f1/modules/azure-gaming/game-dev-vm/main.bicep
      "repositoryUrl": "https://github.com/Azure/bicep-registry-modules",
      "ref": "02050197700fb3abe82deb91e487898a1f92a0f1",
      "filePath": "modules/azure-gaming/game-dev-vm/main.bicep"
    }
  }
}

This could light up some interesting scenarios similar to SourceLink

anthony-c-martin avatar Feb 08 '24 18:02 anthony-c-martin