version: 1

# Rules to match for a machine to qualify
target:
{% if tags %}
  tags:
{% for tag in tags %}
    - '{{ tag | trim }}'
{% endfor %}
{% endif %}

timeouts:
  first_console_activity:  # This limits the time it can take to receive the first console log
    minutes: {{ timeout_first_minutes }}
    retries: {{ timeout_first_retries }}
  console_activity:        # Reset every time we receive a message from the logs
    minutes: {{ timeout_minutes }}
    retries: {{ timeout_retries }}
  boot_cycle:
    minutes: {{ timeout_boot_minutes }}
    retries: {{ timeout_boot_retries }}
  overall:                 # Maximum time the job can take, not overrideable by the "continue" deployment
    minutes: {{ timeout_overall_minutes }}
    retries: 0
    # no retries possible here

console_patterns:
    session_end:
        regex: >-
          {{ session_end_regex }}
    session_reboot:
        regex: >-
          {{ session_reboot_regex }}
    job_success:
        regex: >-
          {{ job_success_regex }}
    job_warn:
        regex: >-
          {{ job_warn_regex }}

# Environment to deploy
deployment:
  # Initial boot
  start:
    kernel:
      url: '{{ kernel_url }}'
      cmdline: >
        SALAD.machine_id={{ '{{' }} machine_id }}
        console={{ '{{' }} local_tty_device }},115200 earlyprintk=vga,keep
        loglevel={{ log_level }} no_hash_pointers
        b2c.service="--privileged --tls-verify=false --pid=host docker://{{ '{{' }} fdo_proxy_registry }}/mupuf/valve-infra/telegraf-container:latest" b2c.hostname=dut-{{ '{{' }} machine.full_name }}
        b2c.container="-ti --tls-verify=false docker://{{ '{{' }} fdo_proxy_registry }}/mupuf/valve-infra/machine_registration:latest check"
        b2c.ntp_peer=10.42.0.1 b2c.pipefail b2c.cache_device=auto b2c.poweroff_delay={{ poweroff_delay }}
        b2c.minio="gateway,{{ '{{' }} minio_url }},{{ '{{' }} job_bucket_access_key }},{{ '{{' }} job_bucket_secret_key }}"
        b2c.volume="{{ '{{' }} job_bucket }}-results,mirror=gateway/{{ '{{' }} job_bucket }},pull_on=pipeline_start,push_on=changes,overwrite{% for excl in job_volume_exclusions %},exclude={{ excl }}{% endfor %},expiration=pipeline_end,preserve"
{% for volume in volumes %}
        b2c.volume={{ volume }}
{% endfor %}
        b2c.container="-v {{ '{{' }} job_bucket }}-results:{{ working_dir }} -w {{ working_dir }} {% for mount_volume in mount_volumes %} -v {{ mount_volume }}{% endfor %} --tls-verify=false docker://{{ local_container }} {{ container_cmd }}"
        {% if cmdline_extras is defined %}
        {{ cmdline_extras }}
        {% endif %}

    initramfs:
      url: '{{ initramfs_url }}'

