Skip to content
Snippets Groups Projects

GitLab Templates

This repository contains miscellaneous resources that need to be accessible without authentication.

GitLab CI templates

Templates for GitLab Continuous Integration are provided in the folder ci-templates. These can be included from any repo by using include:project:

include:
  - project: tecnalia_robotics-public/gitlab_templates
    file: ci-templates/core.yml

Core Pipeline

The Core pipeline, defined in ci-templates/core.yml, has the following structure:

  • Stage: build

    • Check python syntax

    • .industrial_ci template (see the industrial_ci repo), which can be used to define jobs that build ROS packages

      • Needs the ROS_DISTRO variable to be defined

      • If the package has .rosinstall dependencies, they can be installed using the variable UPSTREAM_WORKSPACE

      • Uses flexbotics-base-devel:${ROS_DISTRO} as a starting image

      • Runs scripts/ci_run_entry_points.sh in the AFTER_SETUP_TARGET_WORKSPACE stage, which in turn finds and runs every ci_entry_script.bash script found in the target repo.

    • .industrial_ci_deploy template, which:

      • Runs industrial_ci by extending .industrial_ci

      • Runs some cleanup in the industrial_ci context (e.g. delete sources)

      • Commits image used by industrial_ci

      • Builds deployment image on top of it and push it to our registry

  • Stage: .post

    • Check bash/sh script syntax

    • Check Markdown and AsciiDoc syntax

    • Check files have no trailing whitespace and are UTF-8 encoded

    • Check that C++ files follow this clang-format

It is important to note that both templates set the variable GIT_LFS_SKIP_SMUDGE, which means that when the repositories are cloned/fetched, the files hosted using Git LFS will not be downloaded. An example on how to explicitely fetch the files from LFS can be found in the common_config repository.

Manual Jobs

Using the templates defined by the core pipeline, one can easily define jobs to build the packages in the repo.

include:
  - project: tecnalia_robotics-public/gitlab_templates
    file: ci-templates/core.yml

industrial_ci_kinetic:
  extends: .industrial-ci
  variables:
    ROS_DISTRO: kinetic
    UPSTREAM_WORKSPACE: .rosinstall

More examples can be found in ci-templates/examples.

Auto Rules

In the ci-templates/auto-rules folder, automatic pipelines are defined that will try to detect the ROS distro from the branch name and create jobs. For example, if the branch starts with noetic- it will build for noetic. If the branch doesn’t start with any ROS distro, it will build the default distro, which can be specified with the variable DEFAULT_DISTRO. For convenience, some templates are provided that already set this variable. If your repo needs to uses .rosinstall, you can use the templates in the ci-templates/auto-rules/with-rosinstall folder.

The auto rules also allow for using variables to explicitely activate each job:

include:
  - project: tecnalia_robotics-public/gitlab_templates
    file: ci-templates/auto-rules/no-default.yml

variables:
  BUILD_KINETIC: 1
  BUILD_MELODIC: 1
  BUILD_NOETIC: 1

Custom rosdep definitions

Custom rosdep definitions for the packages hosted in our internal debian repository are declared in rosdistro/rosdep_tecnalia.yaml.

Deployment image build resources

Resources required for building the deployment docker images are also hosted in this repository. This basically boils down to: