github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/e2e/consul/input/checks_task_update.nomad (about)

     1  job "task_check" {
     2    datacenters = ["dc1"]
     3    type        = "service"
     4  
     5    constraint {
     6      attribute = "${attr.kernel.name}"
     7      value     = "linux"
     8    }
     9  
    10    group "task_check" {
    11      count = 1
    12  
    13      task "test" {
    14        service {
    15          name = "task-service-1"
    16  
    17          # after update, check name has changed
    18          check {
    19            name     = "alive-1a"
    20            type     = "script"
    21            task     = "test"
    22            interval = "2s"
    23            timeout  = "2s"
    24            command  = "echo"
    25            args     = ["alive-1a"]
    26          }
    27        }
    28  
    29        service {
    30          name = "task-service-2"
    31  
    32          check {
    33            name     = "alive-2a"
    34            type     = "script"
    35            task     = "test"
    36            interval = "2s"
    37            timeout  = "2s"
    38            command  = "echo"
    39            args     = ["alive-2a"]
    40          }
    41  
    42          # after updating, this check will always pass
    43          check {
    44            name     = "alive-2b"
    45            type     = "script"
    46            task     = "test"
    47            interval = "2s"
    48            timeout  = "2s"
    49            command  = "echo"
    50            args     = ["alive-2b"]
    51          }
    52        }
    53  
    54        service {
    55          name = "task-service-3"
    56  
    57          # this check should always time out and so the service
    58          # should not be marked healthy
    59          check {
    60            name     = "always-dead"
    61            type     = "script"
    62            task     = "test"
    63            interval = "2s"
    64            timeout  = "1s"
    65            command  = "sleep"
    66            args     = ["10"]
    67          }
    68        }
    69  
    70        driver = "raw_exec"
    71  
    72        config {
    73          command = "bash"
    74          args    = ["-c", "sleep 15000"]
    75        }
    76      }
    77    }
    78  }