{% extends "web/_base.html" %}
{% block title %}Autopkgtest run for {{ request_data.task_description }}{% endblock %}

{% block content %}
    <h1>Autopkgtest run for {{ request_data.task_description }}</h1>
    <p>
        <a href="{% url "work_requests:detail" pk=work_request.pk %}?view=generic">Generic view</a>
    </p>
    <ul>
        <li>Result: {% include "web/_work_request-result.html" %}</li>
    </ul>

    <h2>Request</h2>
    <ul>
        {% include "web/_summary_artifact.html" with description="Source artifact" artifact=request_data.source_artifact only %}
        {% for binary_artifact in request_data.binary_artifacts %}
            {% include "web/_summary_artifact.html" with description="Binary artifact" artifact=binary_artifact only %}
        {% endfor %}
        {% for context_artifact in request_data.context_artifacts %}
            {% include "web/_summary_artifact.html" with description="Context artifact" artifact=context_artifact only %}
        {% endfor %}
        <li>Host architecture: {{ request_data.host_architecture }}</li>
        {% if request_data.vendor and request_data.codename %}
            <li>Distribution: {{ request_data.distribution }}</li>
        {% endif %}
        <li>Backend: {{ request_data.backend }}</li>
        {% if request_data.include_tests %}
            <li>Include tests: {{ request_data.include_tests|join:", " }}</li>
        {% endif %}
        {% if request_data.exclude_tests %}
            <li>Exclude tests: {{ request_data.exclude_tests|join:", " }}</li>
        {% endif %}
        {% if request_data.debug_level is not None %}
            <li>Debug level: {{ request_data.debug_level }}</li>
        {% endif %}
        {% if request_data.extra_apt_sources %}
            <li>Extra APT sources:
                <ul>
                    {% for source in request_data.extra_apt_sources %}
                        <li><code>{{ source }}</code></li>
                    {% endfor %}
                </ul>
            </li>
        {% endif %}
        {% if request_data.use_packages_from_base_repository is not None %}
            <li>Use packages from base repository: {{ request_data.use_packages_from_base_repository }}</li>
        {% endif %}
        {% if request_data.environment %}
            <li>Environment variables:
                <ul>
                    {% for key, value in request_data.environment.items %}
                        <li><code>{{ key }}</code>: <code>{{ value }}</code></li>
                    {% endfor %}
                </ul>
            </li>
        {% endif %}
        {% if request_data.needs_internet is not None %}
            <li>Needs internet: {{ request_data.needs_internet }}
        {% endif %}
        {% if request_data.fail_on_scenarios %}
            <li>Fail on: {{ request_data.fail_on_scenarios|join:", " }}</li>
        {% endif %}
        {% if request_data.timeout %}
            <li>Timeouts:
                <ul>
                    {% for key, value in request_data.timeouts.items %}
                        <li>{{ key|title }}: {{ value }}</li>
                    {% endfor %}
                </ul>
            </li>
        {% endif %}
    </ul>

    {% if result_artifact %}
        <h2>Results</h2>
        <ul>
            {% for name, status, details in result_data %}
                <li><code>{{ name }}</code>:
                    {% include "web/_autopkgtest-status.html" with status=status only %}
                    {% if details %}({{ details }}){% endif %}
                </li>
            {% endfor %}
            <li>Output: <a href="{% url "artifacts:detail" artifact_id=result_artifact.id %}">{{ result_artifact.id }}</a>
                (<a href="{% url "artifacts:detail" artifact_id=result_artifact.id %}?archive=tar.gz">download</a>)
        </ul>
    {% endif %}
{% endblock %}
