github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/website/content/docs/commands/job/validate.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: 'Commands: job validate'
     4  sidebar_title: validate
     5  description: >
     6    The job validate command is used to check a job specification for syntax
     7    errors and validation problems.
     8  ---
     9  
    10  # Command: job validate
    11  
    12  **Alias: `nomad validate`**
    13  
    14  The `job validate` command is used to check an HCL [job specification] for any
    15  syntax errors or validation problems.
    16  
    17  ## Usage
    18  
    19  ```plaintext
    20  nomad job validate <file>
    21  ```
    22  
    23  The `job validate` command requires a single argument, specifying the path to a
    24  file containing an HCL [job specification]. This file will be read and the job
    25  checked for any problems. If the supplied path is "-", the job file is read from
    26  STDIN. Otherwise it is read from the file at the supplied path or downloaded and
    27  read from URL specified. Nomad downloads the job file using [`go-getter`] and
    28  supports `go-getter` syntax.
    29  
    30  On successful validation, exit code 0 will be returned, otherwise an exit code
    31  of 1 indicates an error.
    32  
    33  When ACLs are enabled, this command requires a token with the `read-job`
    34  capability for the job's namespace.
    35  
    36  ## Examples
    37  
    38  Validate a job with invalid syntax:
    39  
    40  ```shell-session
    41  $ nomad job validate example.nomad
    42  Job validation errors:
    43  1 error(s) occurred:
    44  
    45  * group "cache" -> task "redis" -> config: 1 error(s) occurred:
    46  
    47  * field "image" is required
    48  ```
    49  
    50  Validate a job that has a configuration that causes warnings:
    51  
    52  ```shell-session
    53  $ nomad job validate example.nomad
    54  Job Warnings:
    55  1 warning(s):
    56  
    57  * Group "cache" has warnings: 1 error(s) occurred:
    58  
    59  * Update max parallel count is greater than task group count (6 > 3). A destructive change would result in the simultaneous replacement of all allocations.
    60  
    61  Job validation successful
    62  ```
    63  
    64  [`go-getter`]: https://github.com/hashicorp/go-getter
    65  [job specification]: /docs/job-specification