github.com/adityamillind98/nomad@v0.11.8/website/pages/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  ## Examples
    34  
    35  Validate a job with invalid syntax:
    36  
    37  ```shell-session
    38  $ nomad job validate example.nomad
    39  Job validation errors:
    40  1 error(s) occurred:
    41  
    42  * group "cache" -> task "redis" -> config: 1 error(s) occurred:
    43  
    44  * field "image" is required
    45  ```
    46  
    47  Validate a job that has a configuration that causes warnings:
    48  
    49  ```shell-session
    50  $ nomad job validate example.nomad
    51  Job Warnings:
    52  1 warning(s):
    53  
    54  * Group "cache" has warnings: 1 error(s) occurred:
    55  
    56  * Update max parallel count is greater than task group count (6 > 3). A destructive change would result in the simultaneous replacement of all allocations.
    57  
    58  Job validation successful
    59  ```
    60  
    61  [`go-getter`]: https://github.com/hashicorp/go-getter
    62  [job specification]: /docs/job-specification