-
Notifications
You must be signed in to change notification settings - Fork 2k
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
nomad/api: maps are declared as hcl blocks #25006
Comments
Hi @realpedrokrapp and thanks for raising this issue. This originates from the original job specification design and has maintained been over the years to ensure backwards compatibility. To parse Nomad job specification files (HCLv2+tweaks) you can import the following dependencies and versions into your project: $ go get github.com/hashicorp/hcl/[email protected]
$ go get github.com/hashicorp/[email protected] You can then use these imports and the I hope this helps and please let me know if you have any followup questions. |
Hi @jrasell, first of all thank you very much for your fast reply.
I am having this issue in my current project and as well on my private computer. |
Hi @realpedrokrapp, no problem. Until Nomad 1.10 releases which includes the metrics migration and compatibility update, you should be able to add the following replace statement into your go.mod file to overcome the build problem:
|
Hi @jrasell. Maybe one last suggestion before I am going to drop out of this conversation: In order to decode job files with jobspec2 package I have to import the whole nomad module. I am sure this has it reasons, but maybe there are some more people like me who are only interested in parsing, so maybe you guys can make a jobspec2 module like you did it with the api. As I said this is just a suggestion which does not have anything to do with this issue so feel free to close it. Best regards from Germany |
Nomad version
1.9.5
Operating system and Environment details
ubuntu 20.04 on wsl2
Issue
I am having a issue while decoding hcl files which contains jobs, taskgrup or tasks with the hclsimple package of hcl. I think all map properties defined in the DTO's of the nomad client in the api package are not correct.
Example:
This is the current defnition of the TaskGroup:
The property Meta is a
map[string]string
withhcl:"meta,block"
, but when I am trying to parse a hcl file with a task group definition, I am getting the following error:I don't know if addressing this issue here in this repository is the correct place, but I think you cannot declare your properties which are of type map as hcl block. Is this already a known issue, is there a workaround or is my approach just simply wrong? Couldn't find anything so I thought I just ask nicely here :).
Reproduction steps
This is more a theoretical question, but you can reproduce this behaviour by decoding a hcl file with the hclsimple package of hcl.
Expected Result
I am expecting that I am able to decode valid hcl files which contains objects whic are defined by this repositories api package.
Actual Result
I am getting a panic while decoding.
Job file (if appropriate)
Nomad Server logs (if appropriate)
Nomad Client logs (if appropriate)
The text was updated successfully, but these errors were encountered: