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

Target

Select target project
  • miguel.prada/gitlab_templates
  • tecnalia_robotics-public/gitlab_templates
2 results
Show changes
Showing
with 413 additions and 120 deletions
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
include:
- project: tecnalia_robotics-public/gitlab_templates
file: ci-templates/core.yml
variables:
GITLAB_TEMPLATES_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 https://github.com/ros-industrial/industrial_ci.git .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
.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
.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
.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
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: 10
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
---
# Format file from: https://github.com/davetcoleman/roscpp_code_format (bfa4ea78b4ac856da07458c8824bf5eb327ea693)
# Format file from: https://github.com/PickNikRobotics/roscpp_code_format (75a84b075d648828b7aa64094699e5ab5cc7adb7)
BasedOnStyle: Google
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 2
......@@ -9,9 +9,8 @@ AllowAllParametersOfDeclarationOnNextLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortLoopsOnASingleLine: false
AlwaysBreakTemplateDeclarations: true
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakBeforeMultilineStrings: true
BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: true
......
FROM industrial_ci_image
RUN rm -rf /root/ici /root/src
RUN apt-get update -qq && apt-get install -y -qq --no-install-recommends \
ros-kinetic-rosbash \
&& rm -rf /var/lib/apt/lists/*
COPY ./ros_entrypoint.bash /
ENTRYPOINT ["/ros_entrypoint.bash"]
CMD ["bash"]
#!/bin/bash
set -e
# setup application environment
# shellcheck disable=SC1091
source "/root/catkin_ws/install/setup.bash"
exec "$@"
ARG APPLICATION_IMAGE
FROM ${APPLICATION_IMAGE}
RUN apt-get update -qq && apt-get install -y -qq --no-install-recommends \
apt-transport-https \
curl \
libasound2 \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
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 --no-install-recommends \
code \
&& rm -rf /var/lib/apt/lists/*
RUN echo "alias code='code --user-data-dir /root'" >> /root/.bashrc
RUN code --user-data-dir /root \
--install-extension ms-iot.vscode-ros \
--install-extension joaompinto.asciidoctor-vscode \
--install-extension ms-python.python \
--install-extension ms-vscode.cpptools \
--install-extension ms-azuretools.vscode-docker \
--install-extension twxs.cmake
apriltag:
ubuntu:
xenial: [apriltag]
cvkit:
ubuntu:
xenial: [cvkit]
dynamixel:
ubuntu: [libdynamixel-dev]
k4a-tools:
ubuntu:
focal: [k4a-tools]
libhalcon-dev:
ubuntu: [libhalcon-dev]
libk4a1.3:
ubuntu:
focal: [libk4a1.3]
libk4a1.3-dev:
ubuntu:
focal: [libk4a1.3-dev]
libopenvdb_fork_dev:
ubuntu:
focal: [libopenvdb-fork-dev]
libpcl-1.8.1:
ubuntu:
xenial: [libpcl1.8.1]
peak:
ubuntu: [libpeak-dev]
libsoundio1:
ubuntu: [libsoundio1]
robotnik_base_hw_lib:
ubuntu: [ros-kinetic-robotnik-base-hw-lib]
libvdbfusion_dev:
ubuntu:
focal: [libvdbfusion-dev]
telicam-sdk:
ubuntu: [telicam-sdk]
open3d-ros-helper-pip:
ubuntu:
pip:
packages: [open3d_ros_helper]
telicam-1.1.0:
ubuntu: [libtelicam-sdk-1.1.0]
peak:
ubuntu: [libpeak-dev]
zivid:
ubuntu: [zivid]
phoxicontrol:
ubuntu:
bionic: [phoxicontrol]
focal: [phoxicontrol]
rccomm_utils:
rc_apps_msgs:
ubuntu:
xenial: [rccomm-utils]
xenial: [ros-kinetic-rc-apps-msgs]
rc_parameter_collection_ros_proxy:
rc_bagthrottler:
ubuntu:
xenial: [ros-kinetic-rc-parameter-collection-ros-proxy]
xenial: [ros-kinetic-rc-bagthrottler]
rcimage_smoothing:
rc_comm_utils:
ubuntu:
xenial: [rcimage-smoothing]
xenial: [ros-kinetic-rc-comm-utils]
rcimagesync:
rc_cv_utils:
ubuntu:
xenial: [rcimagesync]
xenial: [ros-kinetic-rc-cv-utils]
cvkit:
rc_diagnostic:
ubuntu:
xenial: [cvkit]
xenial: [ros-kinetic-rc-diagnostic]
rcconsole:
rc_dynamics_api:
ubuntu:
xenial: [rcconsole]
xenial: [ros-kinetic-rc-dynamics-api]
rc_imagesync:
rc_genicam_api:
ubuntu:
xenial: [ros-kinetic-rc-imagesync]
xenial: [ros-kinetic-rc-genicam-api]
rcobjectdetection_common:
rc_imagesync:
ubuntu:
xenial: [rcobjectdetection-common]
xenial: [ros-kinetic-rc-imagesync]
rcsys_utils:
rc_parameter_collection_ros_proxy:
ubuntu:
xenial: [rcsys-utils]
xenial: [ros-kinetic-rc-parameter-collection-ros-proxy]
rcapps_msgs:
rc_statemachine:
ubuntu:
xenial: [rcapps-msgs]
xenial: [ros-kinetic-rc-statemachine]
rcstatemachine:
rc_visard_driver:
ubuntu:
xenial: [rcstatemachine]
xenial: [ros-kinetic-rc-visard-driver]
rcparameter_collection:
rcapps_msgs:
ubuntu:
xenial: [rcparameter-collection]
xenial: [rcapps-msgs]
rc_tagdetection:
rccomm_utils:
ubuntu:
xenial: [ros-kinetic-rc-tagdetection]
xenial: [rccomm-utils]
rc_comm_utils:
rcconsole:
ubuntu:
xenial: [ros-kinetic-rc-comm-utils]
xenial: [rcconsole]
rcimage:
ubuntu:
xenial: [rcimage]
rc_bagthrottler:
rcimage_smoothing:
ubuntu:
xenial: [ros-kinetic-rc-bagthrottler]
xenial: [rcimage-smoothing]
rc_visard_driver:
rcimagesync:
ubuntu:
xenial: [ros-kinetic-rc-visard-driver]
xenial: [rcimagesync]
rctagdetection:
rcobjectdetection_common:
ubuntu:
xenial: [rctagdetection]
xenial: [rcobjectdetection-common]
rc_objectdetection_shape:
rcobjectdetection_shape_thomas:
ubuntu:
xenial: [ros-kinetic-rc-objectdetection-shape]
xenial: [rcobjectdetection-shape-thomas]
rc_statemachine:
rcobjectrendering:
ubuntu:
xenial: [ros-kinetic-rc-statemachine]
xenial: [rcobjectrendering]
apriltag:
rcparameter_collection:
ubuntu:
xenial: [apriltag]
xenial: [rcparameter-collection]
rc_dynamics_api:
rcstatemachine:
ubuntu:
xenial: [ros-kinetic-rc-dynamics-api]
xenial: [rcstatemachine]
rc_apps_msgs:
rcsys_utils:
ubuntu:
xenial: [ros-kinetic-rc-apps-msgs]
xenial: [rcsys-utils]
rc_genicam_api:
rctagdetection:
ubuntu:
xenial: [ros-kinetic-rc-genicam-api]
xenial: [rctagdetection]
rcobjectrendering:
ubuntu:
xenial: [rcobjectrendering]
robotnik_base_hw_lib:
ubuntu: [ros-kinetic-robotnik-base-hw-lib]
rc_diagnostic:
ubuntu:
xenial: [ros-kinetic-rc-diagnostic]
telicam-1.1.0:
ubuntu: [libtelicam-sdk-1.1.0]
rcobjectdetection_shape_thomas:
ubuntu:
xenial: [rcobjectdetection-shape-thomas]
telicam-sdk:
ubuntu: [telicam-sdk]
rc_cv_utils:
ubuntu:
xenial: [ros-kinetic-rc-cv-utils]
zivid:
ubuntu: [zivid]
zivid1.8:
ubuntu: [zivid1.8]
zivid_telicam_driver:
ubuntu: [zivid-telicam-driver]
#!/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
#!/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
include: ci-templates/auto-rules/no-default.yml
variables:
BUILD_MELODIC: 1
BUILD_NOETIC: 1
include: ci-templates/core.yml
industrial_ci_melodic:
extends: .industrial_ci
variables:
ROS_DISTRO: melodic
industrial_ci_noetic:
extends: .industrial_ci
variables:
ROS_DISTRO: noetic
......@@ -3,7 +3,7 @@
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
FROM tecnalia-robotics-docker.artifact.tecnalia.com/flexbotics-base-devel:kinetic
FROM tecnalia-robotics-docker.artifact.tecnalia.dev/flexbotics-base-devel:kinetic
# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
......
// For format details, see https://aka.ms/vscode-remote/devcontainer.json
{
"name": "flexbotics fat kinetic",
"name": "flexbotics base kinetic",
"context": "..",
"dockerFile": "Dockerfile",
......