Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 17-add-asciidoctor-syntax-check-to-ci-tests
  • 3-upload-docker-compose-file-with-services-in-roboticsbuilder
  • 40-repo-is-ros-testing
  • 45-double-pipeline-triggered-if-merge-request-has-melodic-branch-name
  • 46-default-docker-image-name-too-long
  • 48-python3_syntax
  • 52-ddeploy-job-failing-when-enforcing-labels-alt-quick-dind-test
  • 55-collision-between-test-jobs-due-to-dds-autodiscovery-ros2
  • 58-add-yolo-pip-package-support
  • 62-deploy-jobs-do-not-pull-files-from-lfs-custom-docker-image
  • 62-deploy-jobs-do-not-pull-files-from-lfs-manual-lfs-pull
  • 66-jazzy-support
  • 68-git-lfs-error-in-ddeploy-job
  • 71-clang-format-configuration-compatibility-with-colcon-test
  • add-packages
  • dev-image-test
  • master
  • py3-without-industrial-ci-test
  • rtde
  • split-build-and-test
  • test-badges
  • test-lfs-concept
  • test-use-fat-docker-image
  • test/13-add-clang-format-to-the-ci-tests
  • test/configurable-ci-setup-lookup-path
  • tmp-gpg-key-workaround
  • tmp-gpg-key-workaround-2
  • use-minimal-docker
28 results

Target

Select target project
No results found
Select Git revision
  • 17-add-asciidoctor-syntax-check-to-ci-tests
  • 3-upload-docker-compose-file-with-services-in-roboticsbuilder
  • 40-repo-is-ros-testing
  • 45-double-pipeline-triggered-if-merge-request-has-melodic-branch-name
  • 46-default-docker-image-name-too-long
  • 48-python3_syntax
  • 52-ddeploy-job-failing-when-enforcing-labels-alt-quick-dind-test
  • 55-collision-between-test-jobs-due-to-dds-autodiscovery-ros2
  • 58-add-yolo-pip-package-support
  • 62-deploy-jobs-do-not-pull-files-from-lfs-custom-docker-image
  • 62-deploy-jobs-do-not-pull-files-from-lfs-manual-lfs-pull
  • 66-jazzy-support
  • 68-git-lfs-error-in-ddeploy-job
  • 71-clang-format-configuration-compatibility-with-colcon-test
  • add-packages
  • dev-image-test
  • master
  • py3-without-industrial-ci-test
  • rtde
  • split-build-and-test
  • test-badges
  • test-lfs-concept
  • test-use-fat-docker-image
  • test/13-add-clang-format-to-the-ci-tests
  • test/configurable-ci-setup-lookup-path
  • tmp-gpg-key-workaround
  • tmp-gpg-key-workaround-2
  • use-minimal-docker
28 results
Show changes

Commits on Source 254

154 additional commits have been omitted to prevent performance issues.
44 files
+ 936
398
Compare changes
  • Side-by-side
  • Inline

Files

.gitlab-ci.yml

0 → 100644
+39 −0
Original line number Diff line number Diff line
shellcheck:
  image: tecnalia-docker-dev.artifact.tecnalia.dev/koalaman/shellcheck-alpine
  script: shellcheck scripts/*sh
  tags:
    - docker


yamllint:
  image: tecnalia-docker-dev.artifact.tecnalia.dev/sdesbure/yamllint
  script: yamllint $(find . -name '*.yml' -o -name '*.yaml')
  tags:
    - docker

deploy_devcontainer:
  script:
    - tar cvfz dot_devcontainer.tar.gz -C vscode_devcontainer .devcontainer/
  artifacts:
    paths:
      - dot_devcontainer.tar.gz
    expire_in: 1 year
  tags:
    - docker

.simple_ros_test:
  variables:
    TEMPLATES_PIPELINE_REF: $CI_COMMIT_REF_NAME
  trigger:
    project: tecnalia_robotics/ci_test_repos/simple_ros_test
    strategy: depend

simple_ros_noetic_test:
  extends: .simple_ros_test
  variables:
    TEMPLATE_TO_USE: ci-templates/auto-rules/noetic-default.yml

simple_ros_core_with_noetic_test:
  extends: .simple_ros_test
  variables:
    TEMPLATE_TO_USE: test/core_with_noetic.yml
Original line number Diff line number Diff line
image: docker:git

variables:
  TMPDIR: "/builds/${CI_PROJECT_NAMESPACE}"
  GIT_LFS_SKIP_SMUDGE: "1" # Avoid fetching the files from LFS when doing git fetch

services:
  - docker:dind

stages:
  - precheck
  - build
  - postcheck

before_script:
  - apk add --update bash coreutils tar wget python

.industrial_ci_kinetic:
  stage: build
  before_script:
    - apk add --update bash coreutils tar
    - git clone https://github.com/ros-industrial/industrial_ci.git .ci_config
    - docker login ${ARTIFACT_DOCKER_URL} -u ${ARTIFACT_CI_USER} -p ${ARTIFACT_CI_TOKEN}
  script: .ci_config/gitlab.sh
  variables:
    ADDITIONAL_DEBS: curl
    ROS_DISTRO: kinetic
    ROS_PARALLEL_JOBS: "-j2" # keep this for now, since there seems to be memory limit issues in the ci VM
    DOCKER_IMAGE: "${ARTIFACT_DOCKER_URL}/flexbotics-base-devel"
    BEFORE_SCRIPT: "bash <(curl -Ls https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/master/scripts/ci_run_entry_points.sh) $$CATKIN_WORKSPACE"
    CATKIN_CONFIG: '--cmake-args -DCMAKE_CXX_FLAGS=-Wno-ignored-attributes -Wno-int-in-bool-context --'
  when: always

industrial_ci_kinetic:
  extends: .industrial_ci_kinetic
  except:
    - tags

industrial_ci_kinetic_deploy:
  extends: .industrial_ci_kinetic
  variables:
    AFTER_SCRIPT: "wget -q -O - https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/master/scripts/pre-deploy-cleanup.bash | bash"
    DOCKER_COMMIT: industrial_ci_image
  script:
    - .ci_config/gitlab.sh
    - cd $(mktemp -d)
    - wget https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/-/archive/master/gitlab_templates-master.zip
    - unzip gitlab_templates-master.zip && cd gitlab_templates-master/deploy
    - cd base
    - chmod a+x ros_entrypoint.bash
    - docker build -t ${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_NAME} .
    - docker push ${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_NAME}
    - cd ..
    - cd dev
    - docker build --build-arg APPLICATION_IMAGE=${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_NAME} -t ${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_NAME}-dev .
    - docker push ${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_NAME}-dev
    - cd ..
  only:
    - tags

##########################################################
## Simple check for basic Python syntax errors; this is much less thorough than
## other options like pylint, but much faster and less strict
##########################################################
python_syntax:
  stage: precheck
  script: python -m compileall -q .
  when: always

##########################################################
## Check for errors in bash/sh scripts
## Uses https://github.com/cytopia/awesome-ci
##########################################################
bash_syntax:
  stage: postcheck
  script:
    - RET=0
    - docker run -v ${PWD}:/ac cytopia/awesome-ci syntax-sh --path=/ac --extension=sh --ignore=.ci_config || RET=1
    - docker run -v ${PWD}:/ac cytopia/awesome-ci syntax-bash --path=/ac --extension=bash --ignore=.ci_config || RET=1
    - exit $RET
  allow_failure: yes
  when: always

##########################################################
## Check for errors in markdown files
## Uses https://github.com/cytopia/awesome-ci
## Disables the line length rule with --custom="-r ..."
## See other rules that can be configured in
## https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md
##########################################################
markdown_syntax:
  stage: postcheck
  script: docker run -v ${PWD}:/ac cytopia/awesome-ci syntax-markdown --path=/ac --extension=md --ignore=.ci_config --custom="-r ~MD013"
  allow_failure: yes
  when: always

##########################################################
## Check for various syntax issues in files; currently
##  trailing white spaces
##  utf8 formatting
## Uses https://github.com/cytopia/awesome-ci
##########################################################
file_syntax:
  stage: postcheck
  script:
    - RET=0
    - docker run -v ${PWD}:/ac cytopia/awesome-ci file-trailing-space --path=/ac --extension=py,txt,cpp,h,md,sh,bash,xml,launch --ignore=.ci_config || RET=1
    - docker run -v ${PWD}:/ac cytopia/awesome-ci file-utf8 --path=/ac --extension=py,txt,cpp,h,md,sh,bash,xml,launch --ignore=.ci_config || RET=1
    - exit $RET
  allow_failure: yes
  when: always
include:
  - project: tecnalia_robotics-public/gitlab_templates
    file: ci-templates/auto-rules/kinetic-default.yml
Original line number Diff line number Diff line
image: docker:git

variables:
  TMPDIR: "/builds/${CI_PROJECT_NAMESPACE}"
  GIT_LFS_SKIP_SMUDGE: "1" # Avoid fetching the files from LFS when doing git fetch

services:
  - docker:dind

stages:
  - precheck
  - build
  - postcheck

before_script:
  - apk add --update bash coreutils tar wget python

.industrial_ci_kinetic:
  stage: build
  before_script:
    - apk add --update bash coreutils tar
    - git clone https://github.com/ros-industrial/industrial_ci.git .ci_config
    - docker login ${ARTIFACT_DOCKER_URL} -u ${ARTIFACT_CI_USER} -p ${ARTIFACT_CI_TOKEN}
  script: .ci_config/gitlab.sh
  variables:
    ADDITIONAL_DEBS: curl
    ROS_DISTRO: kinetic
    ROS_PARALLEL_JOBS: "-j2" # keep this for now, since there seems to be memory limit issues in the ci VM
    UPSTREAM_WORKSPACE: file
    ROSINSTALL_FILENAME: ".rosinstall"
    DOCKER_IMAGE: "${ARTIFACT_DOCKER_URL}/flexbotics-base-devel"
    BEFORE_SCRIPT: "bash <(curl -Ls https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/master/scripts/ci_run_entry_points.sh) $$CATKIN_WORKSPACE"
    CATKIN_CONFIG: '--cmake-args -DCMAKE_CXX_FLAGS=-Wno-ignored-attributes -Wno-int-in-bool-context --'
  when: always

industrial_ci_kinetic:
  extends: .industrial_ci_kinetic
  except:
    - tags

industrial_ci_kinetic_deploy:
  extends: .industrial_ci_kinetic
  variables:
    AFTER_SCRIPT: "wget -q -O - https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/master/scripts/pre-deploy-cleanup.bash | bash"
    DOCKER_COMMIT: industrial_ci_image
  script:
    - .ci_config/gitlab.sh
    - cd $(mktemp -d)
    - wget https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/-/archive/master/gitlab_templates-master.zip
    - unzip gitlab_templates-master.zip && cd gitlab_templates-master/deploy
    - cd base
    - chmod a+x ros_entrypoint.bash
    - docker build -t ${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_NAME} .
    - docker push ${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_NAME}
    - cd ..
    - cd dev
    - docker build --build-arg APPLICATION_IMAGE=${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_NAME} -t ${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_NAME}-dev .
    - docker push ${ARTIFACT_DOCKER_URL}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_NAME}-dev
    - cd ..
  only:
    - tags

##########################################################
## Simple check for basic Python syntax errors; this is much less thorough than
## other options like pylint, but much faster and less strict
##########################################################
python_syntax:
  stage: precheck
  script: python -m compileall -q .
  when: always

##########################################################
## Check for errors in bash/sh scripts
## Uses https://github.com/cytopia/awesome-ci
##########################################################
bash_syntax:
  stage: postcheck
  script:
    - RET=0
    - docker run -v ${PWD}:/ac cytopia/awesome-ci syntax-sh --path=/ac --extension=sh --ignore=.ci_config || RET=1
    - docker run -v ${PWD}:/ac cytopia/awesome-ci syntax-bash --path=/ac --extension=bash --ignore=.ci_config || RET=1
    - exit $RET
  allow_failure: yes
  when: always

##########################################################
## Check for errors in markdown files
## Uses https://github.com/cytopia/awesome-ci
## Disables the line length rule with --custom="-r ..."
## See other rules that can be configured in
## https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md
##########################################################
markdown_syntax:
  stage: postcheck
  script: docker run -v ${PWD}:/ac cytopia/awesome-ci syntax-markdown --path=/ac --extension=md --ignore=.ci_config --custom="-r ~MD013"
  allow_failure: yes
  when: always

##########################################################
## Check for various syntax issues in files; currently
##  trailing white spaces
##  utf8 formatting
## Uses https://github.com/cytopia/awesome-ci
##########################################################
file_syntax:
  stage: postcheck
  script:
    - RET=0
    - docker run -v ${PWD}:/ac cytopia/awesome-ci file-trailing-space --path=/ac --extension=py,txt,cpp,h,md,sh,bash,xml,launch --ignore=.ci_config || RET=1
    - docker run -v ${PWD}:/ac cytopia/awesome-ci file-utf8 --path=/ac --extension=py,txt,cpp,h,md,sh,bash,xml,launch --ignore=.ci_config || RET=1
    - exit $RET
  allow_failure: yes
  when: always
include:
  - project: tecnalia_robotics-public/gitlab_templates
    file: ci-templates/auto-rules/with-rosinstall/kinetic-default.yml

.gitlab-industrial-ci.yml

deleted100644 → 0
+0 −21
Original line number Diff line number Diff line
image: docker:git

variables:
  TMPDIR: "${CI_PROJECT_DIR}.tmp"

services:
  - docker:dind

stages:
  - build

before_script:
  - apk add --update bash coreutils tar wget
  - git clone https://github.com/ros-industrial/industrial_ci.git .ci_config

industrial_ci_kinetic:
  stage: build
  script: .ci_config/gitlab.sh
  variables:
    ROS_DISTRO: kinetic
    ROS_PARALLEL_JOBS: "-j1" # keep this for now, since there seems to be memory limit issues in the ci VM

.yamllint

0 → 100644
+4 −0
Original line number Diff line number Diff line
extends: relaxed

rules:
  line-length: disable
+2 −32
Original line number Diff line number Diff line
= GitLab Templates
:toc:

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

== GitLab CI templates

Two templates with default CI pipeline configurations are provided, for any repo to make use of:

- `.gitlab-industrial-ci-kinetic-no-rosinstall.yml`
- `.gitlab-industrial-ci-kinetic-with-rosinstall.yml`

Both define basically the same pipeline, consisting of the following stages and jobs:

- Stage: `precheck`
  * Check python syntax
- Stage: `build`
  * Run `industrial_ci`
    ** Uses `flexbotics-base-devel` as a starting image
    ** Runs link:scripts/ci_run_entry_points.sh[] in the `BEFORE_SCRIPT` stage, which in turn finds and runs every `ci_entry_script.bash` script found in the source tree (target repo + repos from `.rosinstall`)
  * Only when tags are pushed:
    ** Run some cleanup in the `industrial_ci` context (e.g. delete sources)
    ** Commit image used by `industrial_ci`
    ** Build deployment image on top of it and push it to our registry
- Stage: `postcheck` (jobs in this stage are allowed to fail)
  * Check `bash`/`sh` script syntax
  * Check Markdown syntax
  * Check files have no trailing whitespace and are UTF-8 encoded

It is important to note that both images 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 https://git.code.tecnalia.com/tecnalia_robotics/common_config/blob/e93dbe6379d94e6a895a33c59bf17ccab26eacf9/.gitlab-ci.yml#L132[common_config repository].
include::ci-templates/README.adoc[leveloffset=+1]

== Custom `rosdep` definitions

Custom `rosdep` definitions for the packages hosted in our internal debian repository are declared in link: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:

- link:scripts/pre-deploy-cleanup.bash[] is run in the `industrial_ci` container before commiting to an image
- link:deploy/Dockerfile[] is used to perform some additional cleanup and install link:deploy/ros_entrypoint.bash[] as entrypoint script on top of the `industrial_ci` image
+64 −0
Original line number Diff line number Diff line

= GitLab CI templates

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

```yml
include::examples/simple_include.yml[]
```

== Core Pipeline
The Core pipeline, defined in link:ci-templates/core.yml[], has the following structure:

- Stage: `build`
  * Check python syntax
  * `.industrial_ci` template (see https://github.com/ros-industrial/industrial_ci[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 link: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.
- Stage: `deploy`
  * `.ddeploy` template (see https://git.code.tecnalia.dev/tecnalia_robotics/flexbotics/flexbotics_utils/ddeploy[the ddeploy repo]), which:
    ** Is run automatically for tags, but can also be run manually on normal commits
    ** Calls `ddeploy` to generate the docker image
    ** Renames the image created by ddeploy with different tags and pushes them to the registry.
    *** Tag `${COMMIT_SHA}` (hash of commit)
    *** Tag `${CI_COMMIT_REF_NAME}` (branch or tag name)
    *** Tag `latest` only on the default branch
- 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 link:clang-format[]


== Manual Jobs

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

```yml
include::examples/manual_job.yml[]
```

More examples can be found in link:ci-templates/examples[].

== Auto Rules
In the link: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 link:ci-templates/auto-rules/with-rosinstall[] folder.

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

```yml
include::examples/build_vars.yml[]
```

If a `ddeploy.yaml` file exists, the auto-rules will add a job extending the `.ddeploy` template defined

== LFS
By default, lfs files are not downloaded. If you need to add LFS, include the link:ci-templates/lfs-pull.yml[] along with anything else:
```yml
include::examples/include_lfs.yml[]
```
 No newline at end of file
+134 −0
Original line number Diff line number Diff line
include: ci-templates/core.yml

workflow:
  rules:
    - if: $CI_COMMIT_REF_NAME =~ /^kinetic-.*/
      variables:
        DEFAULT_DISTRO: "kinetic"
    - if: $CI_COMMIT_REF_NAME =~ /^melodic-.*/
      variables:
        DEFAULT_DISTRO: "melodic"
    - if: $CI_COMMIT_REF_NAME =~ /^noetic-.*/
      variables:
        DEFAULT_DISTRO: "noetic"
    - if: $CI_COMMIT_REF_NAME =~ /^humble-.*/
      variables:
        DEFAULT_DISTRO: "humble"
    - if: $CI_COMMIT_REF_NAME =~ /^jazzy-.*/
      variables:
        DEFAULT_DISTRO: "jazzy"
    - if: $CI_COMMIT_REF_NAME =~ /^rolling-.*/
      variables:
        DEFAULT_DISTRO: "rolling"
    - if: $CI_COMMIT_TAG
    - if: $CI_COMMIT_BRANCH

industrial_ci_kinetic:
  extends: .industrial_ci
  variables:
    ROS_DISTRO: kinetic
  rules:
    - if: $DEFAULT_DISTRO == "kinetic"
    - if: $BUILD_KINETIC

industrial_ci_melodic:
  extends: .industrial_ci
  variables:
    ROS_DISTRO: melodic
  rules:
    - if: $DEFAULT_DISTRO == "melodic"
    - if: $BUILD_MELODIC

industrial_ci_noetic:
  extends: .industrial_ci
  variables:
    ROS_DISTRO: noetic
  rules:
    - if: $DEFAULT_DISTRO == "noetic"
    - if: $BUILD_NOETIC

industrial_ci_humble:
  extends: .industrial_ci
  variables:
    ROS_DISTRO: humble
  rules:
    - if: $DEFAULT_DISTRO == "humble"
    - if: $BUILD_HUMBLE

industrial_ci_jazzy:
  extends: .industrial_ci
  variables:
    ROS_DISTRO: jazzy
  rules:
    - if: $DEFAULT_DISTRO == "jazzy"
    - if: $BUILD_JAZZY

industrial_ci_rolling:
  extends: .industrial_ci
  variables:
    ROS_DISTRO: rolling
  rules:
    - if: $DEFAULT_DISTRO == "rolling"
    - if: $BUILD_ROLLING

.py3_rules:
  rules:
    - if: $DEFAULT_DISTRO == "noetic"
      when: always
    - if: $BUILD_NOETIC
      when: always
    - if: $DEFAULT_DISTRO == "humble"
      when: always
    - if: $BUILD_HUMBLE
      when: always
    - if: $DEFAULT_DISTRO == "jazzy"
      when: always
    - if: $BUILD_JAZZY
      when: always
    - if: $DEFAULT_DISTRO == "rolling"
      when: always
    - if: $BUILD_ROLLING
      when: always

py3-flake8:
  extends:
    - .py3_rules
    - .py3-flake8

py3-flake8_extended:
  extends:
    - .py3_rules
    - .py3-flake8_extended

py3-security:
  extends:
    - .py3_rules
    - .py3-security

.py2_rules:
  rules:
    - if: $DEFAULT_DISTRO == "kinetic"
      when: always
    - if: $BUILD_KINETIC
      when: always
    - if: $DEFAULT_DISTRO == "melodic"
      when: always
    - if: $BUILD_MELODIC
      when: always

py2-flake8:
  extends:
    - .py2_rules
    - .py2-flake8

ddeploy:
  extends: .ddeploy
  rules:
    - if: $CI_COMMIT_TAG
      exists:
        - ddeploy.yaml
      when: always
    - exists:
        - ddeploy.yaml
      when: manual
      allow_failure: true

ci-templates/core.yml

0 → 100644
+25 −0
Original line number Diff line number Diff line
image: tecnalia-docker-dev.artifact.tecnalia.dev/docker:git


workflow:
  rules:
    - if: $CI_COMMIT_TAG
    - if: $CI_COMMIT_BRANCH

variables:
  TMPDIR: /builds/${CI_PROJECT_NAMESPACE}
  GIT_LFS_SKIP_SMUDGE: 1 # Avoid fetching the files from LFS when doing git fetch


stages:
  - build
  - deploy

include:
  - ci-templates/syntax-check.yml
  - ci-templates/python.yml
  - ci-templates/industrial-ci-templates.yml

default:
  tags:
    - docker
+8 −0
Original line number Diff line number Diff line
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
+5 −0
Original line number Diff line number Diff line
include:
  - project: tecnalia_robotics-public/gitlab_templates
    file:
      - ci-templates/auto-rules/kinetic-default.yml
      - ci-templates/lfs-pull.yml
+9 −0
Original line number Diff line number Diff line
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
Original line number Diff line number Diff line
include:
  - project: tecnalia_robotics-public/gitlab_templates
    file: ci-templates/core.yml
Original line number Diff line number Diff line
variables:
  GITLAB_TEMPLATES_BRANCH: master
  INDUSTRIAL_CI_URL: https://github.com/ros-industrial/industrial_ci.git
  INDUSTRIAL_CI_BRANCH: master

.industrial_ci:
  stage: build
  services:
    - name: tecnalia-docker-dev.artifact.tecnalia.dev/docker:dind
      alias: docker
  before_script:
    - apk add --update bash coreutils tar
    - git clone --quiet --depth 1 ${INDUSTRIAL_CI_URL} -b ${INDUSTRIAL_CI_BRANCH} .ci_config
    - docker login ${ARTIFACT_DOCKER_URL} -u ${ARTIFACT_CI_USER} -p ${ARTIFACT_CI_TOKEN}
    - docker login tecnalia-docker-dev.artifact.tecnalia.dev -u ${ARTIFACT_CI_USER} -p ${ARTIFACT_CI_TOKEN}
  script: .ci_config/gitlab.sh
  variables:
    DOCKER_IMAGE: "${ARTIFACT_DOCKER_URL}/flexbotics-base-devel:${ROS_DISTRO}"
    ADDITIONAL_DEBS: curl
    PARALLEL_BUILDS: 2 # keep this for now, since there seems to be memory limit issues in the ci VM
    AFTER_SETUP_TARGET_WORKSPACE: "rosenv && bash <(curl -Ls https://git.code.tecnalia.dev/tecnalia_robotics-public/gitlab_templates/raw/${GITLAB_TEMPLATES_BRANCH}/scripts/ci_run_entry_points.sh) $$current_ws"
    CMAKE_ARGS: -DCMAKE_CXX_FLAGS=-Wno-ignored-attributes -Wno-int-in-bool-context -Wno-dev
    PIP_BREAK_SYSTEM_PACKAGES: "1" # needed for jazzy, https://github.com/ros-industrial/industrial_ci/pull/885/files


.ddeploy:
  stage: deploy
  services:
  - name: tecnalia-docker-dev.artifact.tecnalia.dev/docker:dind
    alias: docker
  variables:
    DOCKER_PUSH_REGISTRY: ${ARTIFACT_DOCKER_URL}
    DOCKER_PUSH_NAME: ${CI_PROJECT_PATH}
    DOCKER_PUSH_TAG: ${CI_COMMIT_REF_NAME}
    DOCKER_PUSH_USER: ${ARTIFACT_CI_USER}
    DOCKER_PUSH_TOKEN: ${ARTIFACT_CI_TOKEN}
    DDEPLOY_YAML: ddeploy.yaml
  before_script:
    - apk add --update python3 git py3-pip git-lfs bash curl jq
    # forward the SSH authentication into the Docker executor
    - "which ssh-agent || ( apk update && apk add openssh-client )"
    - eval $(ssh-agent -s)
    - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
    - mkdir -p ~/.ssh
    - echo "$SSH_SERVER_HOSTKEYS" > ~/.ssh/known_hosts
    - chmod 700 ~/.ssh
    # setup LFS authentication
    - git lfs install
    - git config --global credential.helper store
    - echo https://$ARTIFACT_CI_USER:$ARTIFACT_CI_TOKEN@artifact.tecnalia.dev > ~/.git-credentials
    - find . -type f -name .lfsconfig -exec sh -c 'cd "$(dirname "{}")" && git lfs pull' \;
    - find . -type f -name .lfsconfig -exec sh -c 'cd "$(dirname "{}")" && git lfs ls-files' \;
    # install ddeploy
    - pip install --break-system-packages git+ssh://git@git.code.tecnalia.dev/tecnalia_robotics/flexbotics/flexbotics_utils/ddeploy.git@v0.2.0
    - echo "Logging into docker registry ${ARTIFACT_DOCKER_URL} for user ${ARTIFACT_CI_USER}"
    - docker login ${ARTIFACT_DOCKER_URL} -u ${ARTIFACT_CI_USER} -p ${ARTIFACT_CI_TOKEN}
    - echo "Logging into docker registry ${DOCKER_PUSH_REGISTRY} for user ${DOCKER_PUSH_USER}"
    - docker login ${DOCKER_PUSH_REGISTRY} -u ${DOCKER_PUSH_USER} -p ${DOCKER_PUSH_TOKEN}
  script:
    # Run ddeploy
    - GIT_LFS_SKIP_SMUDGE=0 ddeploy --yaml ${DDEPLOY_YAML}
    # Get the full name of the most recently built image
    - 'DDEPLOY_IMAGE_NAME=$(docker images --format="{{.Repository}}:{{.Tag}}" | head -1)'
    - curl -Ls https://git.code.tecnalia.dev/tecnalia_robotics-public/gitlab_templates/raw/${GITLAB_TEMPLATES_BRANCH}/scripts/enforce_labels.bash | bash -s -- ${DDEPLOY_IMAGE_NAME}
    # Tag and push with the branch or tag name.
    - echo "Pushing to ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${DOCKER_PUSH_TAG}"
    - docker tag ${DDEPLOY_IMAGE_NAME} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${DOCKER_PUSH_TAG}
    - docker push ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${DOCKER_PUSH_TAG}
    # Tag and push with commit sha
    - echo "Pushing to ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${CI_COMMIT_SHA}"
    - docker tag ${DDEPLOY_IMAGE_NAME} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${CI_COMMIT_SHA}
    - docker push ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:${CI_COMMIT_SHA}
    # Tag and push with latest only if it's on the default branch
    - >
      if [ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]; then
        echo "Pushing to ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest"
        docker tag ${DDEPLOY_IMAGE_NAME} ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest &&
        docker push ${DOCKER_PUSH_REGISTRY}/${DOCKER_PUSH_NAME}:latest;
      fi
  rules:
    - if: $CI_COMMIT_TAG
      when: always
    - when: manual
      allow_failure: true
+13 −0
Original line number Diff line number Diff line
.lfs-pull-script: &lfs-pull-script
  "find $$current_ws -type f -name .lfsconfig -execdir git lfs pull \\; ;\
   find $$current_ws -type f -name .lfsconfig -execdir git lfs ls-files \\; ;"

.industrial_ci:
  variables:
    AFTER_INIT: "bash <(curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh);\
                apt install -qq -y git-lfs; \
                git config --global credential.helper store; \
                echo https://$ARTIFACT_CI_USER:$ARTIFACT_CI_TOKEN@artifact.tecnalia.dev > ~/.git-credentials ;"
    BEFORE_INSTALL_UPSTREAM_DEPENDENCIES: *lfs-pull-script
    BEFORE_INSTALL_TARGET_DEPENDENCIES: *lfs-pull-script
    BEFORE_INSTALL_DOWNSTREAM_DEPENDENCIES: *lfs-pull-script
+52 −0
Original line number Diff line number Diff line
.flake8_template:
  stage: build
  before_script: ${PYTHON_VERSION} -m pip -q install flake8
  script:
    - find . -type f -executable ! -name "*.*" -exec awk ' /^#!.*python/{print FILENAME}  {nextfile}' {} + > /tmp/python_files # python files with no extension but with shebang
    - find . -type f -name "*.py" >> /tmp/python_files
    - sort /tmp/python_files | uniq | xargs ${PYTHON_VERSION} -m flake8 --max-line-length 120 --statistics --show-source

.flake8_extended_template:
  extends: .flake8_template
  stage: .post
  before_script:
    - ${PYTHON_VERSION} -m pip install flake8 flake8-isort flake8-builtins flake8-eradicate flake8-functions-names flake8-return flake8-functions
  allow_failure: true

.security_template:
  stage: .post
  before_script:
    - ${PYTHON_VERSION} -m pip install bandit
  script:
    - bandit -r .
  allow_failure: true

.py3_template:
  image: python:3-alpine
  variables:
    PYTHON_VERSION: python3

.py2_template:
  image: python:2-alpine
  variables:
    PYTHON_VERSION: python2

.py3-flake8:
  extends:
    - .flake8_template
    - .py3_template

.py2-flake8:
  extends:
    - .flake8_template
    - .py2_template

.py3-flake8_extended:
  extends:
    - .flake8_extended_template
    - .py3_template

.py3-security:
  extends:
    - .security_template
    - .py3_template
+80 −0
Original line number Diff line number Diff line
variables:
  GITLAB_TEMPLATES_BRANCH: master

##########################################################
## Check formating of C and C++ files using clang-format
##########################################################
clang_format:
  stage: .post
  services:
    - name: tecnalia-docker-dev.artifact.tecnalia.dev/docker:dind
      alias: docker
  before_script:
    - apk add --update bash coreutils tar wget
    - git clone --quiet --depth 1 https://github.com/ros-industrial/industrial_ci.git .ci_config
    - wget https://git.code.tecnalia.dev/tecnalia_robotics-public/gitlab_templates/raw/${GITLAB_TEMPLATES_BRANCH}/clang-format -O .clang-format
  script: .ci_config/gitlab.sh
  variables:
    ROS_DISTRO: noetic
    CLANG_FORMAT_CHECK: file
    CLANG_FORMAT_VERSION: 18
  when: always

##########################################################
## Check for errors in bash/sh scripts
## Uses https://github.com/koalaman/shellcheck
##########################################################
bash_syntax:
  before_script:
    - apk add --update shellcheck
  stage: .post
  script:
    - RET=0
    - find . -type f -name '*.sh' -exec shellcheck -s sh {} + || RET=1
    - find . -type f -name '*.bash' -exec shellcheck -s bash {} + || RET=1
    - exit $RET
  when: always

##########################################################
## Check for errors in markdown files
## Uses https://github.com/cytopia/awesome-ci
## Disables the line length rule with --custom="-r ..."
## See other rules that can be configured in
## https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md
##########################################################
markdown_syntax:
  stage: .post
  image: tecnalia-docker-dev.artifact.tecnalia.dev/cytopia/awesome-ci
  script:
    - syntax-markdown --path=${PWD} --extension=md --ignore=.ci_config --custom="-r ~MD013,~MD014"
  when: always

##########################################################
## Check for various syntax issues in files; currently
##  trailing white spaces
##  utf8 formatting
## Uses https://github.com/cytopia/awesome-ci
##########################################################
file_syntax:
  stage: .post
  image: tecnalia-docker-dev.artifact.tecnalia.dev/cytopia/awesome-ci
  script:
    - RET=0
    - file-trailing-space --path=${PWD} --extension=py,txt,cpp,h,md,sh,bash,xml,launch --ignore=.ci_config || RET=1
    - file-utf8 --path=${PWD} --extension=py,txt,cpp,h,md,sh,bash,xml,launch --ignore=.ci_config || RET=1
    - exit $RET
  when: always

##########################################################
## Check for errors in Asciidoctor files
## Could not find a proper linter for Asciidoctor format,
## so this is a custom-made "dirty" script
##########################################################
adoc_syntax:
  stage: .post
  image: tecnalia-docker-dev.artifact.tecnalia.dev/alpine
  before_script:
    - apk add --update curl asciidoctor bash
  script:
    - curl -Ls https://git.code.tecnalia.dev/tecnalia_robotics-public/gitlab_templates/raw/${GITLAB_TEMPLATES_BRANCH}/scripts/asciidoctor_syntax_check.bash | bash -s -- .
  when: always

clang-format

0 → 100644
+65 −0
Original line number Diff line number Diff line
---
# Format file from: https://github.com/PickNikRobotics/roscpp_code_format (75a84b075d648828b7aa64094699e5ab5cc7adb7)
BasedOnStyle: Google
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 2
AlignEscapedNewlinesLeft: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AlwaysBreakTemplateDeclarations: true
AlwaysBreakBeforeMultilineStrings: true
BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: true
BinPackParameters: true
ColumnLimit: 120
ConstructorInitializerAllOnOneLineOrOnePerLine: true
DerivePointerBinding: false
PointerBindsToType: true
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 60
PenaltyBreakString: 1
PenaltyBreakFirstLessLess: 1000
PenaltyExcessCharacter: 1000
PenaltyReturnTypeOnItsOwnLine: 90
SpacesBeforeTrailingComments: 2
Cpp11BracedListStyle: false
Standard: Auto
IndentWidth: 2
TabWidth: 2
UseTab: Never
IndentFunctionDeclarationAfterType: false
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterControlStatementKeyword: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
SortIncludes: false
SpaceAfterCStyleCast: false

# Configure each individual brace in BraceWrapping
BreakBeforeBraces: Custom

# Control of individual brace wrapping cases
BraceWrapping:
    AfterClass: true
    AfterControlStatement: true
    AfterEnum : true
    AfterFunction : true
    AfterNamespace : true
    AfterStruct : true
    AfterUnion : true
    BeforeCatch : true
    BeforeElse : true
    IndentBraces : false
...

deploy/base/Dockerfile

deleted100644 → 0
+0 −12
Original line number Diff line number Diff line
FROM industrial_ci_image

RUN rm -rf /root/ici /root/src

RUN apt-get update -qq && apt-get install -y -qq \
  ros-kinetic-rosbash \
  && rm -rf /var/lib/apt/lists/*

COPY ./ros_entrypoint.bash /

ENTRYPOINT ["/ros_entrypoint.bash"]
CMD ["bash"]

deploy/base/ros_entrypoint.bash

deleted100755 → 0
+0 −6
Original line number Diff line number Diff line
#!/bin/bash
set -e

# setup application environment
source "/root/catkin_ws/install/setup.bash"
exec "$@"

deploy/dev/Dockerfile

deleted100644 → 0
+0 −24
Original line number Diff line number Diff line
ARG APPLICATION_IMAGE
FROM ${APPLICATION_IMAGE}

RUN apt-get update -qq && apt-get install -y -qq \
  apt-transport-https \
  curl \
  libasound2

RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg \
  && mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg \
  && sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'

RUN apt-get update -qq && apt-get install -y -qq \
  code

RUN echo "alias code='code --user-data-dir /root'" >> /root/.bashrc

RUN code --user-data-dir /root \
  --install-extension ajshort.ros \
  --install-extension joaompinto.asciidoctor-vscode \
  --install-extension ms-python.python \
  --install-extension ms-vscode.cpptools \
  --install-extension peterjausovec.vscode-docker \
  --install-extension twxs.cmake
Original line number Diff line number Diff line
apriltag:
  ubuntu:
    xenial: [apriltag]

cvkit:
  ubuntu:
    xenial: [cvkit]

dynamixel:
  ubuntu: [libdynamixel-dev]

k4a-tools:
  ubuntu:
    focal: [k4a-tools]

libhalcon-dev:
  ubuntu: [libhalcon-dev]

libpcl-1.8.1:
libk4a1.3:
  ubuntu:
    xenial: [libpcl1.8.1]

peak:
  ubuntu: [libpeak-dev]

robotnik_base_hw_lib:
  ubuntu: [ros-kinetic-robotnik-base-hw-lib]
    focal: [libk4a1.3]

telicam-sdk:
  ubuntu: [telicam-sdk]

zivid:
  ubuntu: [zivid]

rccomm_utils:
libk4a1.3-dev:
  ubuntu:
    xenial: [rccomm-utils]
    focal: [libk4a1.3-dev]

rc_parameter_collection_ros_proxy:
libopenvdb_fork_dev:
  ubuntu:
    xenial: [ros-kinetic-rc-parameter-collection-ros-proxy]
    focal: [libopenvdb-fork-dev]

rcimage_smoothing:
libpcl-1.8.1:
  ubuntu:
    xenial: [rcimage-smoothing]
    xenial: [libpcl1.8.1]

rcimagesync:
  ubuntu:
    xenial: [rcimagesync]
libsoundio1:
  ubuntu: [libsoundio1]

cvkit:
libvdbfusion_dev:
  ubuntu:
    xenial: [cvkit]
    focal: [libvdbfusion-dev]

rcconsole:
open3d-ros-helper-pip:
  ubuntu:
    xenial: [rcconsole]
    pip:
      packages: [open3d_ros_helper]

rc_imagesync:
  ubuntu:
    xenial: [ros-kinetic-rc-imagesync]
peak:
  ubuntu: [libpeak-dev]

rcobjectdetection_common:
phoxicontrol:
  ubuntu:
    xenial: [rcobjectdetection-common]
    bionic: [phoxicontrol]
    focal: [phoxicontrol]

rcsys_utils:
rc_apps_msgs:
  ubuntu:
    xenial: [rcsys-utils]
    xenial: [ros-kinetic-rc-apps-msgs]

rcapps_msgs:
rc_bagthrottler:
  ubuntu:
    xenial: [rcapps-msgs]
    xenial: [ros-kinetic-rc-bagthrottler]

rcstatemachine:
rc_comm_utils:
  ubuntu:
    xenial: [rcstatemachine]
    xenial: [ros-kinetic-rc-comm-utils]

rcparameter_collection:
rc_cv_utils:
  ubuntu:
    xenial: [rcparameter-collection]
    xenial: [ros-kinetic-rc-cv-utils]

rc_tagdetection:
rc_diagnostic:
  ubuntu:
    xenial: [ros-kinetic-rc-tagdetection]
    xenial: [ros-kinetic-rc-diagnostic]

rc_comm_utils:
rc_dynamics_api:
  ubuntu:
    xenial: [ros-kinetic-rc-comm-utils]
    xenial: [ros-kinetic-rc-dynamics-api]

rc_genicam_api:
  ubuntu:
    xenial: [ros-kinetic-rc-genicam-api]

rcimage:
rc_imagesync:
  ubuntu:
    xenial: [rcimage]
    xenial: [ros-kinetic-rc-imagesync]

rc_bagthrottler:
rc_parameter_collection_ros_proxy:
  ubuntu:
    xenial: [ros-kinetic-rc-bagthrottler]
    xenial: [ros-kinetic-rc-parameter-collection-ros-proxy]

rc_statemachine:
  ubuntu:
    xenial: [ros-kinetic-rc-statemachine]

rc_visard_driver:
  ubuntu:
    xenial: [ros-kinetic-rc-visard-driver]

rctagdetection:
rcapps_msgs:
  ubuntu:
    xenial: [rctagdetection]
    xenial: [rcapps-msgs]

rc_objectdetection_shape:
rccomm_utils:
  ubuntu:
    xenial: [ros-kinetic-rc-objectdetection-shape]
    xenial: [rccomm-utils]

rc_statemachine:
rcconsole:
  ubuntu:
    xenial: [ros-kinetic-rc-statemachine]
    xenial: [rcconsole]

apriltag:
rcimage:
  ubuntu:
    xenial: [apriltag]
    xenial: [rcimage]

rc_dynamics_api:
rcimage_smoothing:
  ubuntu:
    xenial: [ros-kinetic-rc-dynamics-api]
    xenial: [rcimage-smoothing]

rc_dynamics_api:
rcimagesync:
  ubuntu:
    xenial: [rc-dynamics-api]
    xenial: [rcimagesync]

rc_apps_msgs:
rcobjectdetection_common:
  ubuntu:
    xenial: [ros-kinetic-rc-apps-msgs]
    xenial: [rcobjectdetection-common]

rc_genicam_api:
rcobjectdetection_shape_thomas:
  ubuntu:
    xenial: [rc-genicam-api]
    xenial: [rcobjectdetection-shape-thomas]

rcobjectrendering:
  ubuntu:
    xenial: [rcobjectrendering]

rc_diagnostic:
rcparameter_collection:
  ubuntu:
    xenial: [ros-kinetic-rc-diagnostic]
    xenial: [rcparameter-collection]

rcobjectdetection_shape_thomas:
rcstatemachine:
  ubuntu:
    xenial: [rcobjectdetection-shape-thomas]
    xenial: [rcstatemachine]

rc_cv_utils:
rcsys_utils:
  ubuntu:
    xenial: [ros-kinetic-rc-cv-utils]
    xenial: [rcsys-utils]

rctagdetection:
  ubuntu:
    xenial: [rctagdetection]

robotnik_base_hw_lib:
  ubuntu: [ros-kinetic-robotnik-base-hw-lib]

telicam-1.1.0:
  ubuntu: [libtelicam-sdk-1.1.0]

telicam-sdk:
  ubuntu: [telicam-sdk]

zivid:
  ubuntu: [zivid]

zivid1.8:
  ubuntu: [zivid1.8]

zivid_telicam_driver:
  ubuntu: [zivid-telicam-driver]
+21 −0
Original line number Diff line number Diff line
#!/bin/bash

if ! [ -x "$(command -v asciidoctor)" ]; then
    echo "Error: asciidoctor is not installed"
    exit 1
fi

if [ -z "$1" ] ; then
    echo "Error: No argument supplied - path needed"
    exit 1
fi

touch output.log # avoid failing if no adoc files exist
while IFS= read -r -d '' filename; do
  asciidoctor "$filename" 2>&1 | tee -a output.log
done < <(find "$1" -name '*.adoc' -type f -print0)
adoc_errors=0 ; adoc_warnings=0
adoc_errors=$(grep -c "ERROR" output.log)
adoc_warnings=$(grep -c "WARNING" output.log)
echo "AsciiDoc format Found ${adoc_errors} errors and ${adoc_warnings} warnings"
if [ "${adoc_errors}" -eq 0 ]; then exit 0; else exit 1; fi
Original line number Diff line number Diff line
#!/bin/bash

echo Looking up and executing user entry scripts in: $1
echo Looking up and executing user entry scripts in: "$1"

find -L $1 -name ci_entry_script.bash -exec bash -c 'echo Running entry script from $(basename $(dirname {})) ; {} ' \;
find -L "$1" -name ci_entry_script.bash -exec bash -c 'echo Running entry script from $(basename $(dirname $1)) ; $1 ' _ {} \;

echo Finalized running the user entry scripts
+35 −0
Original line number Diff line number Diff line
#!/bin/bash
# From a given list of labels, check which of them are already defined in the provided docker image; if any of the labels
# is not defined, a new image with the same name is generated with the label(s) added.
# Labels already defined are not modified.

if [ "$#" -ne 1 ]; then
    echo "Usage: $0 IMAGE_NAME"
    exit 1
fi

image_name="$1"

# list of labels to be enforced
declare -A enforced_labels=( ["com.jfrog.artifactory.retention.maxCount"]="10" ["com.jfrog.artifactory.retention.maxDays"]="7")

if ! docker inspect --type=image "$1" > /dev/null ; then
    echo "Error: image does not exist"
    exit 0
fi

# check if every label is defined
for label in "${!enforced_labels[@]}" ; do
    if ! docker inspect -f "{{json .Config.Labels }}" "$image_name" | jq -e '.['\""$label"\"']' > /dev/null ; then
        echo "Key not found"
        echo "$label = ${enforced_labels[$label]}"
        # add missing label to the arguments to be provided to `docker build`
        label_args+=" --label $label=\"${enforced_labels[$label]}\""
    fi
done

# generate new image
if [ -n "${label_args+x}" ]; then
    run_command="echo \"FROM $image_name\" | docker build $label_args -t $image_name -"
    eval "$run_command"
fi
Original line number Diff line number Diff line
#!/usr/bin/env bash

for foo in $(find $(pwd) -name "package.xml") ; do
  package_name=$(basename $(realpath $(dirname $foo)))
  echo Entering package: $package_name
  cd $(realpath $(dirname $foo))
  if [[ -n $(grep -i "roslaunch_add_file_check" CMakeLists.txt) ]] ; then
    echo Package $package_name already has roslaunch_add_file_check - skipping
# shellcheck disable=SC2044
for foo in $(find "$(pwd)" -name "package.xml") ; do
  package_name=$(basename "$(realpath "$(dirname "$foo")")")
  echo Entering package: "$package_name"
  cd "$(realpath "$(dirname "$foo")")" || exit
  if grep -q -i "roslaunch_add_file_check" CMakeLists.txt; then
    echo Package "$package_name" already has roslaunch_add_file_check - skipping
  else
    if [[ -n $(find . -type f -name "*.launch") ]] ; then
      echo Adding roslaunch_add_file_check to $package_name
      echo Adding roslaunch_add_file_check to "$package_name"
cat <<EOT >> CMakeLists.txt

## WARNING: automatically generated code; can be (and probably is) very buggy
+6 −0
Original line number Diff line number Diff line
include: ci-templates/core.yml

industrial_ci_noetic:
  extends: .industrial_ci
  variables:
    ROS_DISTRO: noetic
Original line number Diff line number Diff line
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------

FROM tecnalia-robotics-docker.artifact.tecnalia.dev/flexbotics-base-devel:kinetic

# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive

# This Dockerfile adds a non-root 'vscode' user with sudo access. However, for Linux,
# this user's GID/UID must match your local user UID/GID to avoid permission issues
# with bind mounts. Update USER_UID / USER_GID if yours is not 1000. See
# https://aka.ms/vscode-remote/containers/non-root-user for details.
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Configure apt and install packages
RUN apt-get update \
    && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
    #
    # Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
    && apt-get -y install git iproute2 procps lsb-release curl \
    && apt install -y git openssh-client python-catkin-tools \
    #
    # Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
    && groupadd --gid $USER_GID $USERNAME \
    && useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
    # [Optional] Add sudo support for the non-root user
    && apt-get install -y sudo \
    && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
    && chmod 0440 /etc/sudoers.d/$USERNAME \
    #
    && rosdep init || true

USER $USERNAME
RUN rosdep update \
    && mkdir -p /home/${USERNAME}/robot_ws/src/

COPY .devcontainer/catkin_ws_init.sh /tmp/

    # Clean up
    # && apt-get autoremove -y \
    # && apt-get clean -y \
    # && rm -rf /var/lib/apt/lists/*

# Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND=
Original line number Diff line number Diff line
#!/bin/bash

if [[ -z "${ROS_PACKAGE_PATH}" ]]; then
   . $(find /opt/ros/ -name "setup.bash")
fi

if [[ -z "${ROS_DISTRO}" ]]; then
   export ROS_DISTRO=$(basename $(find /opt/ros/* -maxdepth 0 -type d | head -1))
fi

pkg_name=$(basename $(find /workspaces/ -maxdepth 1 -mindepth 1 -type d))
mkdir -p ~/robot_ws/src
cd ~/robot_ws/src
ln -s /workspaces/${pkg_name}
cd ..
wstool init src
if [ -f "src/${pkg_name}/.rosinstall" ]; then
    wstool merge "src/${pkg_name}/.rosinstall" -t src
fi

mkdir -p ~/.ssh/
cat << EOF >> ~/.ssh/config
Host *
     StrictHostKeyChecking no
EOF
wstool update -t src
find -L src -name ci_entry_script.bash -exec bash -c 'echo Running entry script from $(basename $(dirname $1)) ; $1 ' _ {} \;
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro $ROS_DISTRO -r -y
catkin init
catkin config --cmake-args -DCMAKE_CXX_FLAGS=-w --

echo "source $(find /opt/ros/ -name 'setup.bash')"  >>  ~/.bashrc
Original line number Diff line number Diff line
// For format details, see https://aka.ms/vscode-remote/devcontainer.json
{
	"name": "flexbotics base kinetic",
	"context": "..",
	"dockerFile": "Dockerfile",

	// Use 'settings' to set *default* container specific settings.json values on container create.
	// You can edit these settings after create using File > Preferences > Settings > Remote.
	"settings": {
		"terminal.integrated.shell.linux": "/bin/bash"
	},

	// Uncomment the next line if you want to publish any ports.
	// "appPort": [],

	// Uncomment the next line to run commands after the container is created.
	"postCreateCommand": "bash /tmp/catkin_ws_init.sh",

	"workspaceFolder": "/home/vscode/robot_ws/src/",

	// Uncomment the next line to use a non-root user. On Linux, this will prevent
	// new files getting created as root, but you may need to update the USER_UID
	// and USER_GID in .devcontainer/Dockerfile to match your user if not 1000.
	"runArgs": [ "-u", "vscode",
		"-v", "${env:SSH_AUTH_SOCK}:/ssh-agent",
		"-e", "SSH_AUTH_SOCK=/ssh-agent",
		"-e", "DISPLAY=${env:DISPLAY}",
		"-v", "/tmp/.X11-unix:/tmp/.X11-unix"
	],

	// Add the IDs of extensions you want installed when the container is created in the array below.
	"extensions": [
		"ms-python.python",
		"ms-iot.vscode-ros"
	]
}
+3 −0
Original line number Diff line number Diff line
# vscode_devcontainer

.devcontainer configuration for ROS projects
 No newline at end of file