Skip to content
Snippets Groups Projects
build-jobs-yocto.jinja2 4.7 KiB
Newer Older
# --------------------------------------------------------------------------------------
# Global
# --------------------------------------------------------------------------------------
# As the trigger job is not executed in a environment with checked out repository, we
# need to get the includes directly from gitlab
  - project: '{{ CI_PROJECT_ROOT_NAMESPACE }}/yocto/infrastructure/gitlab-ci'
    ref: {{ GITLAB_CI_REVISION }}
  - project: '{{ CI_PROJECT_ROOT_NAMESPACE }}/yocto/infrastructure/gitlab-ci'
    ref: {{ GITLAB_CI_REVISION }}
  - project: '{{ CI_PROJECT_ROOT_NAMESPACE }}/yocto/infrastructure/gitlab-ci'
    ref: {{ GITLAB_CI_REVISION }}
  MASTER_BRANCH_MANIFEST: {{ MASTER_BRANCH_MANIFEST }}
workflow:
  rules:
    # This rule is needed, as otherwise the workflow:rules from
    # the parent job seem to be used and prevent the pipeline generation
    - if: $CI_PIPELINE_SOURCE == "parent_pipeline"

stages:
  - infrastructure
  - build
  - test
  - deploy
  - uploadftp

# --------------------------------------------------------------------------------------
# Stage: infrastructure
# --------------------------------------------------------------------------------------

changelog:
  extends: .infrastructure
  script: .gitlab-ci/scripts/changelog_generator.py
              --token=${GITBOT_TOKEN}
              --branch=${MASTER_BRANCH_MANIFEST}
              > changelog.md
  artifacts:
    expire_in: 4 weeks
    paths:
      - "changelog.md"

# --------------------------------------------------------------------------------------
# Generated build jobs
# --------------------------------------------------------------------------------------

{% if CI_PARAM_DISTRO is not defined %}
{% set CI_PARAM_DISTRO = "guf-wayland" %}
{% if CI_PARAM_DISTRO_FNG is not defined %}
{% set CI_PARAM_DISTRO_FNG = "guf-fngsystem" %}
{% if CI_PARAM_MACHINES is defined %}
{% for machine in CI_PARAM_MACHINES.split(' ') %}
{% if CI_PARAM_IMAGE %}

# Build jobs for the normal yocto image
build-{{ machine }}:
  extends: .buildimage
  stage: build
  variables:
    CI_PARAM_MACHINE: {{ machine }}
    CI_PARAM_DISTRO: {{ CI_PARAM_DISTRO }}
    CI_PARAM_IMAGE: {{ CI_PARAM_IMAGE }}

# Build jobs for the sdk
buildsdk-{{ machine }}:
  extends: .buildsdk
  stage: build
  variables:
    CI_PARAM_MACHINE: {{ machine }}
    CI_PARAM_DISTRO: {{ CI_PARAM_DISTRO }}
    CI_PARAM_IMAGE: {{ CI_PARAM_IMAGE }}

# Deploy jobs for the yocto image
deployimage-{{ machine }}:
  extends: .deployimage
  stage: deploy
  needs: [build-{{ machine }}, changelog]

# Deploy jobs for the yocto sdk
deploysdk-{{ machine }}:
  extends: .deployimage
  stage: deploy
  needs: [buildsdk-{{ machine }}]

# Upload ftp jobs for the yocto image
uploadftp-{{ machine }}:
  extends:
    - .uploadftp
  stage: uploadftp
  needs: [build-{{ machine }}, changelog]

# Upload ftp jobs for the yocto sdk
uploadftp-sdk-{{ machine }}:
  extends:
    - .uploadftp
  stage: uploadftp
  needs: [ buildsdk-{{ machine }}]


# Run platform tests for this machine which the yocto image
# This is a little hacky as we need to match the machine name to
# the available platforms
{% if machine == 'imx6guf' %}
{% set platforms = "santaro santoka santino santino-lt" %}
{% elif machine == 'imx6ullguf' %}
{% set platforms = "nallino" %}
{% elif machine == 'imx8mguf' %}
{% set platforms = "tanaro" %}
{% else %}
{% set platforms = '' %}
{% endif %}

{% if platforms %}
# Run smoketests for this machine which the yocto image
smoketest:{{ machine }}:
  extends: .test
  stage: test
  needs:
    - job: build-{{ machine }}
  variables:
    CI_PARAM_MACHINE: {{ machine }}
    CI_PARAM_PLATFORMS: {{ machine }}
    CI_PARAM_TEST_SUITE: boot.jinja2
    CI_PARAM_EXTRA: --all-devices

platformtest:{{ machine }}:
  extends: .test
  stage: test
  needs:
    - job: build-{{ machine }}
  variables:
    CI_PARAM_MACHINE: {{ machine }}
    CI_PARAM_PLATFORMS: {{ platforms }}
{% endif %}

{% endif %} # if CI_PARAM_IMAGE is defined
{% if CI_PARAM_IMAGE_FNG %}

# Build jobs for the fng system image
build-{{ machine }}-fngsystem:
  extends: .buildfng
  stage: build
  variables:
    CI_PARAM_MACHINE: {{ machine }}
    CI_PARAM_DISTRO: {{ CI_PARAM_DISTRO_FNG }}
    CI_PARAM_IMAGE: {{ CI_PARAM_IMAGE_FNG }}

# Deploy jobs for the fngsystem image
deployimage-{{ machine }}-fngsystem:
  extends: .deployimage
  stage: deploy
  needs: [build-{{ machine }}-fngsystem, changelog]

# Upload ftp jobs for the fngsystem image
uploadftp-{{ machine }}-fngsystem:
  extends: .uploadftp
  stage: uploadftp
  needs: [build-{{ machine }}-fngsystem, changelog]

{% endif %} # if CI_PARAM_IMAGE_FNG is defined