Open hashworks opened 2 months ago
Note: I've checked the 1.8.{1,2,3}
changelogs, they don't seem to include a fix for the bug I'm seeing.
Hi @hashworks and thanks for raising this issue with the reproduction steps. I have used these to reproduce this locally using main at 4d6856a30619572ef43d0e6ffb803ddb459c4856
. I'll move this issue to our backlog for roadmapping.
@jrasell I think the reason for this is purely in the UI, as far as I can see:
_newDefinitionVariables
is the string that gets used in the job editor component:
https://github.com/hashicorp/nomad/blob/main/ui/app/templates/components/job-editor/edit.hbs#L73-L94
But the Variables
returns the content of the varfile. If I understand it correctly then the fix would be to do the following:
_newDefinitionVariables += jsonToHcl(JSON.parse(specification.Variables));
But that would require that the Variables
field only returns JSON. If it returns the contents of the var file then there would have to be support for other formats.
An alternative would be to not concat the variables but instead use different input fields that get sent separately to the backend.
Nomad version
1.8.0
Issue
If you deploy a job with variables provided by both
-var-file=foo.json
andNOMAD_VAR_name
environment variables theHCL Variable Values
section in the WebUI will show both the correct key-value format (env variables) and JSON (-var-file
). If one tries to edit the job definition and plan it, it results in the following error:The user then has to replace the JSON with the key-value format to fix this.
Reproduction steps
Deploy a job with both env and
-var-file
:Afterward open the job in the WebUI, edit the definition and try to plan your change.
Expected Result
The
HCL Variable Values
section should only show variables in the key-value format:Actual Result
It adds the JSON from
-var-file=foo.json
: