github.com/hernad/nomad@v1.6.112/e2e/servicediscovery/input/checks_task_restart_helper.nomad (about)

     1  # Copyright (c) HashiCorp, Inc.
     2  # SPDX-License-Identifier: MPL-2.0
     3  
     4  variable "nodeID" {
     5    type = string
     6  }
     7  
     8  variable "cmd" {
     9    type = string
    10  }
    11  
    12  variable "delay" {
    13    type = string
    14  }
    15  
    16  job "checks_task_restart_helper" {
    17    datacenters = ["dc1"]
    18    type        = "batch"
    19  
    20    group "group" {
    21  
    22      constraint {
    23        attribute = "${attr.kernel.name}"
    24        value     = "linux"
    25      }
    26  
    27      constraint {
    28        attribute = "${node.unique_id}"
    29        value     = "${var.nodeID}"
    30      }
    31  
    32      reschedule {
    33        attempts  = 0
    34        unlimited = false
    35      }
    36  
    37      task "touch" {
    38        driver = "raw_exec"
    39        config {
    40          command = "bash"
    41          args    = ["-c", "sleep ${var.delay} && ${var.cmd} /tmp/nsd-checks-task-restart-test.txt"]
    42        }
    43        resources {
    44          cpu    = 50
    45          memory = 32
    46        }
    47      }
    48    }
    49  }