open-nomad/website/content/docs/commands/job
Michael Schurter 1256c8ef66
docs: update json jobs docs (#12766)
* docs: update json jobs docs

Did you know that Nomad has not 1 but 2 JSON formats for jobs? 2½ if you
want to acknowledge that sometimes our JSON job representations have a
Job top-level wrapper and sometimes do not.

The 2½ formats are:
```
 1.   HCL JSON
 2.   Input API JSON (top-level Job field)
 2.5. Output API JSON (lacks top-level Job field)
```

`#2` is what our docs consider our API JSON. `#2.5` seems to be an
accident of history we can't fix with breaking API compatibility.

`#1` is an even more interesting accident of history: the `jobspec2`
package automatically detects if the input to Parse is JSON and switches
to a JSON parser. This behavior is undocumented, the format is
unspecified, and there is no official HashiCorp tooling to produce this
JSON from HCL. The plot thickens when you discover popular third party
tools like hcl2json.com and https://github.com/tmccombs/hcl2json seem to
produce JSON that `nomad run` accepts!

Since we have no telemetry around whether or not anyone passes HCL JSON
to `nomad run`, and people don't file bugs around features that Just
Work, I'm choosing to leave that code path in place and *acknowledged
but not suggested* in documentation.

See https://github.com/hashicorp/hcl/issues/498 for a more comprehensive
discussion of what officially supporting HCL JSON in Nomad would look
like.

(I also added some of the missing fields to the (Input API flavor) JSON
Job documentation, but it still needs a lot of work to be
comprehensive.)

Co-authored-by: Tim Gross <tgross@hashicorp.com>
2022-04-22 15:57:27 -07:00
..
allocs.mdx cli: Add nomad job allocs command (#11242) 2021-10-12 16:30:36 -04:00
deployments.mdx feat(website): migrates to new nav data format (#10264) 2021-03-31 08:43:17 -05:00
dispatch.mdx add dispatch idempotency token support in the CLI (#10930) 2021-10-22 12:39:05 -04:00
eval.mdx feat(website): migrates to new nav data format (#10264) 2021-03-31 08:43:17 -05:00
history.mdx feat(website): migrates to new nav data format (#10264) 2021-03-31 08:43:17 -05:00
index.mdx feat(website): migrates to new nav data format (#10264) 2021-03-31 08:43:17 -05:00
init.mdx feat(website): migrates to new nav data format (#10264) 2021-03-31 08:43:17 -05:00
inspect.mdx feat(website): migrates to new nav data format (#10264) 2021-03-31 08:43:17 -05:00
periodic-force.mdx feat(website): migrates to new nav data format (#10264) 2021-03-31 08:43:17 -05:00
plan.mdx cli: add -json flag to support job commands (#12591) 2022-04-21 13:20:36 -07:00
promote.mdx feat(website): migrates to new nav data format (#10264) 2021-03-31 08:43:17 -05:00
revert.mdx feat(website): migrates to new nav data format (#10264) 2021-03-31 08:43:17 -05:00
run.mdx docs: update json jobs docs (#12766) 2022-04-22 15:57:27 -07:00
scale.mdx feat(website): migrates to new nav data format (#10264) 2021-03-31 08:43:17 -05:00
scaling-events.mdx feat(website): migrates to new nav data format (#10264) 2021-03-31 08:43:17 -05:00
status.mdx feat(website): migrates to new nav data format (#10264) 2021-03-31 08:43:17 -05:00
stop.mdx provide -no-shutdown-delay flag for job/alloc stop (#11596) 2021-12-13 14:54:53 -05:00
validate.mdx cli: add -json flag to support job commands (#12591) 2022-04-21 13:20:36 -07:00