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

Bicep-generated files should include an autogenerated header #800

Closed
snarkywolverine opened this issue Nov 3, 2020 · 2 comments · Fixed by #1533
Closed

Bicep-generated files should include an autogenerated header #800

snarkywolverine opened this issue Nov 3, 2020 · 2 comments · Fixed by #1533
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@snarkywolverine
Copy link

When a resource file is created in visual studio, a programming language-specific file is autogenerated for resource access. At the top is a comment that looks something like this:

//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------

We should have something similar for bicep - a comment that says the file was autogenerated and the bicep version.

This discourages users from modifying the bicep file directly; it also (as @alex-frankel pointed out) allows the service to potentially collect telemetry on the # of deployments using compiled templates.

@majastrz
Copy link
Member

majastrz commented Dec 7, 2020

Discussed it at the team meeting today. The consensus appears to have template code generators use the top-level metadata property to store this information. This is the proposed schema:

"metadata": {
  "_generator": {
    "name": "<name of the code generator>",
    "version": "<version of the code generator>",
    "templateHash": "<template hash>"
  }
}

Considerations:

@TSunny007 TSunny007 removed their assignment Jan 4, 2021
@rjmholt
Copy link

rjmholt commented Feb 4, 2021

One thing that would be nice in the case of other generators is a way to add metadata around that generator's use, like a kind of user-agent string — for example with a PowerShell-based generator, the PowerShell version used. That would help us understand where to make investments/who to optimise our generator for.

Whether that is just the _generator.name or some other field(s)/object under _generator is something I'm certainly very flexible on.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants