Skip to content
Snippets Groups Projects
build-pipeline-yocto.yml.jinja2 7.87 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 }}
  - Infrastructure
  - Build
  - Test
  - Package
  - Deploy SoftwareStore
  - Deploy SoftwareStore Internal
  - Deploy FTP
Tim Jaacks's avatar
Tim Jaacks committed
  - Deploy Azure
Tim Jaacks's avatar
Tim Jaacks committed
  - Confluence
  - Alphaplan
  MASTER_BRANCH: {{ MASTER_BRANCH }}
# --------------------------------------------------------------------------------------
# Stage: Infrastructure
# --------------------------------------------------------------------------------------
changelog:
  extends: .changelog
Tim Jaacks's avatar
Tim Jaacks committed
build-version:
  extends: .build_version
  variables:
    # We have to set a machine, even if it is not actually needed for what the job does,
    # so we just choose the first.
    MACHINE: {{ MACHINES.split(' ')[0] }}
# --------------------------------------------------------------------------------------
# Generated jobs
# --------------------------------------------------------------------------------------
{% if MACHINES %}
{% for machine in MACHINES.split(' ') %}
# --------------------------------------------------------------------------------------
# Stage: Build
# --------------------------------------------------------------------------------------
{% if SIMULATE_BUILD is not defined or SIMULATE_BUILD != "true" %}

  extends: .build_yocto
    BITBAKE_TASK: build
    MACHINE: {{ machine }}
{% else %}

build-{{ machine }}:
  extends:
    - .buildbase
    - .simulate_build
  variables:
    MACHINE: {{ machine }}
    # We have to specify a tag here instead of getting the artifacts from a master
    # branch, because we don't always execute the full pipeline on the master branches.
    # In those cases the actual build job does not exist, which results in a 404 error.
    BUILD_ARTIFACTS: ${BUILD_ARTIFACTS_PREFIX}-{{ machine }}

{% endif %}
# --------------------------------------------------------------------------------------
# Stage: Test
# --------------------------------------------------------------------------------------
# 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 == 'seco-mx6' or machine == 'imx6guf' %}
  {% set platforms = "santaro santoka santino santino-lt" %}
  {% set lava_machine = "imx6guf" %}
{% elif machine == 'seco-mx6ull' or machine == 'imx6ullguf' %}
  {% set platforms = "nallino" %}
  {% set lava_machine = "imx6ullguf" %}
{% elif machine == 'seco-mx8mm' or machine == 'imx8mguf'  %}
  {% set platforms = "tanaro" %}
  {% set lava_machine = "imx8mguf" %}
  {% set platforms = '' %}
  {% set lava_machine = '' %}
{% endif %}

{% if platforms %}
# Run smoketests for this machine which the yocto image
smoketest:{{ machine }}:
  stage: Test
  needs:
    - job: build-{{ machine }}
  variables:
    BUILD_JOB: build-{{ machine }}
    LAVA_MACHINE: {{ lava_machine }}
    PLATFORMS: {{ lava_machine }}
    TEST_SUITE: boot.jinja2
    TEST_EXTRA_ARGUMENTS: --all-devices
  stage: Test
  needs:
    - job: build-{{ machine }}
  variables:
    BUILD_JOB: build-{{ machine }}
    LAVA_MACHINE: {{ lava_machine }}
    PLATFORMS: {{ platforms }}
# --------------------------------------------------------------------------------------
# Stage: Package
# --------------------------------------------------------------------------------------
package-{{ machine }}:
  extends: .package
  variables:
    MACHINE: {{ machine }}
    PACKAGE_TYPE: image
    ASSOCIATED_BUILD_JOB: build-{{ machine }}
  needs:
    - job: build-{{ machine }}
      artifacts: false


# --------------------------------------------------------------------------------------
# Stage: Deploy SoftwareStore
# --------------------------------------------------------------------------------------
deploy-{{ machine }}:
Tim Jaacks's avatar
Tim Jaacks committed
  extends: .deploy-rsync
{% if CI_COMMIT_TAG is defined %}
  stage: Deploy SoftwareStore
  variables:
    MACHINE: {{ machine }}
    DEPLOY_SOURCE: ${RELEASE_NAME}
    DEPLOY_TARGET: ${DEPLOY_RELEASE_TARGET}/${RELEASE_NAME}
    DEPLOY_TARGET_LINK: ${DEPLOY_RELEASE_TARGET_LINK}/${RELEASE_NAME}
{% else %}
  stage: Deploy SoftwareStore Internal
    MACHINE: {{ machine }}
    DEPLOY_SOURCE: ${RELEASE_NAME}
    DEPLOY_TARGET: ${DEPLOY_INTERNAL_RELEASE_TARGET}/${RELEASE_NAME}
    DEPLOY_TARGET_LINK: ${DEPLOY_INTERNAL_RELEASE_TARGET_LINK}/${RELEASE_NAME}
    ASSOCIATED_PACKAGE_JOB: package-{{ machine }}
  needs:
    - job: package-{{ machine }}
      artifacts: false
    - job: changelog
# --------------------------------------------------------------------------------------
# Stage: Alphaplan
# --------------------------------------------------------------------------------------
generate-alphaplan-data-{{ machine }}:
  extends: .generate_alphaplan_data
  variables:
    MACHINE: {{ machine }}
  needs:
    - deploy-{{ machine }}
import-alphaplan-data-{{ machine }}:
  extends: .import_alphaplan_data
  needs:
    - generate-alphaplan-data-{{ machine }}


# --------------------------------------------------------------------------------------
# Stage: Deploy FTP
# --------------------------------------------------------------------------------------
{% if SIMULATE_BUILD is defined and SIMULATE_BUILD == "true"
   or CI_COMMIT_TAG is defined %}

ftp-{{ machine }}:
Tim Jaacks's avatar
Tim Jaacks committed
  extends: .deploy-rsync
  stage: Deploy FTP
  tags:
    - ftp
  rules:
    - if: $DEPLOY_FTP_TARGET
      when: manual
      allow_failure: true
  variables:
    MACHINE: {{ machine }}
    DEPLOY_SOURCE: ${RELEASE_NAME}
    DEPLOY_TARGET: ${DEPLOY_FTP_TARGET}/${RELEASE_NAME}
    DEPLOY_TARGET_LINK: ${DEPLOY_FTP_TARGET_LINK}/${RELEASE_NAME}
    ASSOCIATED_PACKAGE_JOB: package-{{ machine }}
  needs:
    - job: package-{{ machine }}
      artifacts: false
    - job: changelog
Tim Jaacks's avatar
Tim Jaacks committed
# --------------------------------------------------------------------------------------
# Stage: Deploy Azure
# --------------------------------------------------------------------------------------
{% if SIMULATE_BUILD is defined and SIMULATE_BUILD == "true"
   or CI_COMMIT_TAG is defined %}

azure-{{ machine }}:
  extends: .deploy-azure
  stage: Deploy Azure
  rules:
    - if: $AZURE_CONTAINER_NAME && $AZURE_TARGET_FOLDER
      when: manual
      allow_failure: true
  variables:
    MACHINE: {{ machine }}
    DEPLOY_SOURCE: ${RELEASE_NAME}
    DEPLOY_TARGET: ${AZURE_TARGET_FOLDER}/${RELEASE_NAME}
Tim Jaacks's avatar
Tim Jaacks committed
    CONTAINER_NAME: ${AZURE_CONTAINER_NAME}
    ASSOCIATED_PACKAGE_JOB: package-{{ machine }}
  needs:
    - job: package-{{ machine }}
      artifacts: false
    - job: changelog
    - job: build-version
# --------------------------------------------------------------------------------------
# End of generated jobs
# --------------------------------------------------------------------------------------
{% endfor %}
Tim Jaacks's avatar
Tim Jaacks committed


# --------------------------------------------------------------------------------------
# Stage: Confluence
# --------------------------------------------------------------------------------------
{% if SIMULATE_BUILD is defined and SIMULATE_BUILD == "true"
   or CI_COMMIT_TAG is defined %}

generate-confluence-page:
  extends:
    - .generate-confluence-page
  variables:
    PAGE_TEMPLATE: .gitlab-ci/confluence-page.xml.jinja2

publish-confluence-page:
  extends:
    - .publish-confluence-page

{% endif %}

{% endif %} # if MACHINES