github.com/uchennaokeke444/nomad@v0.11.8/website/pages/docs/commands/job/revert.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: 'Commands: job revert'
     4  sidebar_title: revert
     5  description: |
     6    The revert command is used to revert to a prior version of the job.
     7  ---
     8  
     9  # Command: job revert
    10  
    11  The `job revert` command is used to revert a job to a prior version of the
    12  job. The available versions to revert to can be found using [`job history`]
    13  command.
    14  
    15  The revert command will use a Consul token with the following preference:
    16  first the `-consul-token` flag, then the `$CONSUL_HTTP_TOKEN` environment variable.
    17  Because the consul token used to [run] the targeted job version was not
    18  persisted, it must be provided to revert if the targeted job version includes
    19  Consul Connect enabled services and the Nomad servers were configured to require
    20  [consul service identity] authentication.
    21  
    22  The revert command will use a Vault token with the following preference:
    23  first the `-vault-token` flag, then the `$VAULT_TOKEN` environment variable.
    24  Because the vault token used to [run] the targeted job version was not
    25  persisted, it must be provided to revert if the targeted job version includes
    26  Vault policies and the Nomad servers were configured to require [vault policy]
    27  authentication.
    28  
    29  ## Usage
    30  
    31  ```plaintext
    32  nomad job revert [options] <job> <version>
    33  ```
    34  
    35  The `job revert` command requires two inputs, the job ID and the version of that
    36  job to revert to.
    37  
    38  ## General Options
    39  
    40  @include 'general_options.mdx'
    41  
    42  ## Revert Options
    43  
    44  - `-detach`: Return immediately instead of monitoring. A new evaluation ID
    45    will be output, which can be used to examine the evaluation using the
    46    [eval status] command.
    47  
    48  - `-consul-token`: If set, the passed Consul token is sent along with the revert
    49    request to the Nomad servers. This overrides the token found in the
    50    \$CONSUL_HTTP_TOKEN environment variable.
    51  
    52  - `-vault-token`: If set, the passed Vault token is sent along with the revert
    53    request to the Nomad servers. This overrides the token found in the
    54    \$VAULT_TOKEN environment variable.
    55  
    56  - `-verbose`: Show full information.
    57  
    58  ## Examples
    59  
    60  Revert to an older version of a job:
    61  
    62  ```shell-session
    63  $ nomad job history -p example
    64  Version     = 1
    65  Stable      = false
    66  Submit Date = 07/25/17 21:27:30 UTC
    67  Diff        =
    68  +/- Job: "example"
    69  +/- Task Group: "cache"
    70    +/- Task: "redis"
    71      +/- Config {
    72        +/- image:           "redis:3.2" => "redis:4.0"
    73            port_map[0][db]: "6379"
    74          }
    75  
    76  Version     = 0
    77  Stable      = false
    78  Submit Date = 07/25/17 21:27:18 UTC
    79  
    80  $ nomad job revert example 0
    81  ==> Monitoring evaluation "faff5c30"
    82      Evaluation triggered by job "example"
    83      Evaluation within deployment: "e17c8592"
    84      Allocation "4ed0ca3b" modified: node "e8a2243d", group "cache"
    85      Evaluation status changed: "pending" -> "complete"
    86  ==> Evaluation "faff5c30" finished with status "complete"
    87  
    88  $ nomad job history -p example
    89  Version     = 2
    90  Stable      = true
    91  Submit Date = 07/25/17 21:27:43 UTC
    92  Diff        =
    93  +/- Job: "example"
    94  +/- Task Group: "cache"
    95    +/- Task: "redis"
    96      +/- Config {
    97        +/- image:           "redis:4.0" => "redis:3.2"
    98            port_map[0][db]: "6379"
    99          }
   100  
   101  Version     = 1
   102  Stable      = false
   103  Submit Date = 07/25/17 21:27:30 UTC
   104  Diff        =
   105  +/- Job: "example"
   106  +/- Task Group: "cache"
   107    +/- Task: "redis"
   108      +/- Config {
   109        +/- image:           "redis:3.2" => "redis:4.0"
   110            port_map[0][db]: "6379"
   111          }
   112  
   113  Version     = 0
   114  Stable      = false
   115  Submit Date = 07/25/17 21:27:18 UTC
   116  ```
   117  
   118  [`job history`]: /docs/commands/job/history
   119  [eval status]: /docs/commands/eval-status
   120  [consul service identity]: /docs/configuration/consul#allow_unauthenticated
   121  [vault policy]: /docs/configuration/vault#allow_unauthenticated
   122  [run]: /docs/commands/job/run