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