{#
# SPDX-License-Identifier: CC0-1.0
# SPDX-FileCopyrightText: 2018-2023 Collabora, Ltd. and the Monado contributors
#
# This file is not used directly to generate its own output: it is included by .gitlab-ci.yml.jinja
#}

{% from 'include.functions.jinja' import image_name, image_name_for_comment with context %}

###
# Container prep jobs

{%- for distro in distributions -%} {%- for image in distro.images %}

# Make {{ image_name_for_comment(distro, image) }} image
{{ image_name(distro, image) }}:container_prep:
  stage: container_prep
  extends:
    - .container-rules
    - .monado.variables.{{ image_name(distro, image) }}
    - .fdo.container-build@{{distro.name}} # from ci-templates

  variables:
    {# The packages list is actually a mapping, not an array, but the same syntax works. #}
    {# Needed to be a mapping so it could be "merged" #}
    FDO_DISTRIBUTION_PACKAGES: '{{image.packages | sort | join(" ")}}'
{% if "script" in image %}
    FDO_DISTRIBUTION_EXEC: 'env FDO_CI_CONCURRENT=${FDO_CI_CONCURRENT} bash .gitlab-ci/{{image["script"]}}'
{% endif %}
{% endfor -%} {%- endfor %}

{% from 'include.functions.jinja' import base_job_to_use_image with context %}

###
# Container usage base jobs
{% for distro in distributions -%} {%- for image in distro.images %}

# Base for using {{ image_name_for_comment(distro, image) }} image
{{ base_job_to_use_image(distro, image) }}:
  extends:
    - .monado.variables.{{ image_name(distro, image) }}
    - .fdo.{{ "suffixed" if "repo_suffix" in image else "distribution" }}-image@{{distro.name}} # from ci-templates
    - .build-rules

{% endfor -%} {%- endfor %}