Skip to content

Provide output formatting options for Nomad job plan CLI #27369

@Anirudhra10

Description

@Anirudhra10

Proposal

nomad job plan command outputs the plan in human readable format only and does not provide options such as

  • -json to print output in JSON format (ex: supported in nomad job run command), or
  • -t to format using Go template (ex: supported in nomad job inspect)

Use-cases

Having this option is useful where the jobspec is intentionally expressed in HCL for better readability, but the code to parse the human readable output format can get complicated. If instead the format can be controlled, it makes for cleaner parsing and presentation.
In addition, since nomad job plan supports -json input, so it only makes sense to have JSON output as a choice.

Attempted Solutions

HCL2JSON tool can help to an extent in converting ahead of time, but is not an officially supported tool by Hashicorp?
Also, if I am not wrong, when the job is converted and submitted in JSON format, UI does not show the jobspec in HCL format?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Needs Roadmapping

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions