Description: We are encountering a 400 error when attempting to create tasks in Nomad using the nomad-pack plan command. The error is related to duplicate job blocks in the rendered job file.
Steps to Reproduce:
use any template to generate the job file:
[[ range $key, $ObjAll := var "jobs" . ]]
job "[[ var "job_prefix" $ ]]_cron_[[ $ObjAll.name ]]" {
~~~~~
[ [- end ]]
./nomad-pack plan ./cron --var-file="./cron/cron.hcl"
Error message is as follows:
! Failed To Parse Job Specification
Error: Unexpected response code: 400 (Failed to parse job: input.hcl:164,1-48: Duplicate job block; Only one block of type "job" is allowed. Previous definition was at input.hcl:2,1-32.
input.hcl:326,1-59: Duplicate job block; Only one block of type "job" is allowed. Previous definition was at input.hcl:2,1-32.
input.hcl:488,1-34: Duplicate job block; Only one block of type "job" is allowed. Previous definition was at input.hcl:2,1-32.
~~~~~
input.hcl:3890,1-45: Duplicate job block; Only one block of type "job" is allowed. Previous definition was at input.hcl:2,1-32.
input.hcl:4052,1-45: Duplicate job block; Only one block of type "job" is allowed. Previous definition was at input.hcl:2,1-32.)
Context:
- Template Name: fita_cron/templates/cron.nomad.tpl
- Registry Name: <<local folder>>
- Pack Name: cron
- Pack Ref: <<none>>
- Pack Path: /worckflow/fita/deploy/nomad/packs/cron
- Deployment Name: cron
Expected Behavior: The job specification should be parsed and tasks should be created successfully in Nomad.
Actual Behavior: The command fails with a 400 error due to multiple "job" blocks in the generated file.
Description: We are encountering a 400 error when attempting to create tasks in Nomad using the nomad-pack plan command. The error is related to duplicate job blocks in the rendered job file.
Steps to Reproduce:
Error message is as follows:
Expected Behavior: The job specification should be parsed and tasks should be created successfully in Nomad.
Actual Behavior: The command fails with a 400 error due to multiple "job" blocks in the generated file.