nomad
nomad copied to clipboard
Change job spec name convention to `*.nomad.hcl`
Background
Nomad job spec files currently follow a documented convention of *.nomad. This is currently "just" a convention as users can name these files any way they wish since Nomad expects full file path when submitting (nomad job run <FILE_PATH>).
This may become a more strictly-enforced convention in the context of https://github.com/hashicorp/nomad/issues/7954
The motivation here is to:
- Align naming convention with Packer, which also uses HCL2 (
*.pkr.hcl&*.pkrvars.hcl) - Provide better "out of the box" editor experience by allowing editors to register files as
*.hcland highlight them accordingly as HCL (i.e. editors/grammars don't need an extra matching rule for Nomad). See https://github.com/hashicorp/vscode-hcl/issues/116 - Pave the path towards some future dedicated editor plugins/extensions which can still claim
*.nomad.hcl- that's especially important for VS Code, which exhibits some unfortunate behaviours when multiple extensions claim the same files, see https://github.com/hashicorp/vscode-terraform/issues/692
Proposal
Change all occurrences of *.nomad to *.nomad.hcl
- [ ] https://www.nomadproject.io
- [ ] https://learn.hashicorp.com/nomad
- [ ] Update the file generated by
nomad job init
Notes
It not proposed to set any convention for Nomad Pack files here yet, but if there was a convention, it should be different from Nomad job spec files. This is to allow editors which need to provide anything more than just highlighting to distinguish these files and provide relevant IntelliSense for each file type.
For the same reason, it is not proposed to set any conventions for Levant but if there was a convention I imagine it would be more like *.nomad.yaml, i.e. the templating engine being more important/dominant component of the name, which editors should use for highlighting. The truth is though that most editors today struggle with highlighting files with embedded languages, such as templates like these and there are no proven ways in that area.
We'll need to update the file generated by nomad job init output as well, which probably suggests we should ship this (or at least that specific change) in either Nomad 1.4.0 or Nomad 1.5.0 rather than a patch version. cc @mikenomitch for your thoughts on scheduling that.
Thanks for the ping @tgross. Yeah, this seems like something that should be a part of a major release. Since it is "just a convention" I guess this doesn't really break anything, but it feels like something we should at least mention in a blog post and high-traffic changelog.
@radeksimko were you planning to PR this, or just opening the issue to share the idea?
@mikenomitch I could PR this potentially, as a longer (but IMO the best) way of closing https://github.com/hashicorp/vscode-hcl/issues/116
That said if you were planning to make this part of a major release, then I guess it would need some more planning - esp. to avoid a PR sitting there and gathering dust and conflicts. 😄 Not sure if you have separate branches for upcoming major releases to avoid this kind of problem?
This missed 1.4.0 as it got slotted into community triage instead of the backlog 😊 . Sticking it on the backlog project for visibility in the next pass. Sorry about that @radeksimko