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 637 additions and 47 deletions
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
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
include:
- project: tecnalia_robotics-public/gitlab_templates
file:
- ci-templates/auto-rules/kinetic-default.yml
- ci-templates/lfs-pull.yml
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/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'
}
...
apriltag:
ubuntu: [apriltag]
ubuntu:
xenial: [apriltag]
cvkit:
ubuntu: [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]
libsoundio1:
ubuntu: [libsoundio1]
libvdbfusion_dev:
ubuntu:
focal: [libvdbfusion-dev]
open3d-ros-helper-pip:
ubuntu:
pip:
packages: [open3d_ros_helper]
peak:
ubuntu: [libpeak-dev]
phoxicontrol:
ubuntu:
bionic: [phoxicontrol]
focal: [phoxicontrol]
rc_apps_msgs:
ubuntu:
xenial: [ros-kinetic-rc-apps-msgs]
rc_bagthrottler:
ubuntu:
xenial: [ros-kinetic-rc-bagthrottler]
rc_comm_utils:
ubuntu:
xenial: [ros-kinetic-rc-comm-utils]
rc_cv_utils:
ubuntu:
xenial: [ros-kinetic-rc-cv-utils]
rc_diagnostic:
ubuntu:
xenial: [ros-kinetic-rc-diagnostic]
rc_dynamics_api:
ubuntu:
xenial: [ros-kinetic-rc-dynamics-api]
rc_genicam_api:
ubuntu:
xenial: [ros-kinetic-rc-genicam-api]
rc_imagesync:
ubuntu:
xenial: [ros-kinetic-rc-imagesync]
rc_parameter_collection_ros_proxy:
ubuntu:
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]
rcapps_msgs:
ubuntu: [rcapps_msgs]
ubuntu:
xenial: [rcapps-msgs]
rccomm_utils:
ubuntu: [rccomm_utils]
ubuntu:
xenial: [rccomm-utils]
rcconsole:
ubuntu: [rcconsole]
ubuntu:
xenial: [rcconsole]
rcimage:
ubuntu:
xenial: [rcimage]
rcimage_smoothing:
ubuntu:
xenial: [rcimage-smoothing]
rcimagesync:
ubuntu: [rcimagesync]
ubuntu:
xenial: [rcimagesync]
rcobjectdetection_common:
ubuntu: [rcobjectdetection-common]
ubuntu:
xenial: [rcobjectdetection-common]
rcobjectdetection_shape_thomas:
ubuntu: [rcobjectdetection-shape-thomas]
ubuntu:
xenial: [rcobjectdetection-shape-thomas]
rcobjectrendering:
ubuntu: [rcobjectrendering]
ubuntu:
xenial: [rcobjectrendering]
rcparameter_collection:
ubuntu: [rcparameter-collection]
ubuntu:
xenial: [rcparameter-collection]
rcstatemachine:
ubuntu: [rcstatemachine]
ubuntu:
xenial: [rcstatemachine]
rcsys_utils:
ubuntu: [rcsys-utils]
ubuntu:
xenial: [rcsys-utils]
rctagdetection:
ubuntu: [rctagdetection]
ubuntu:
xenial: [rctagdetection]
robotnik_base_hw_lib:
ubuntu: [ros-kinetic-robotnik-base-hw-lib]
ros_kinetic_rc_apps_msgs:
ubuntu: [ros-kinetic-rc-apps_msgs]
ros_kinetic_rc_bagthrottler:
ubuntu: [ros-kinetic-rc-bagthrottler]
ros_kinetic_rc_comm_utils:
ubuntu: [ros-kinetic-rc-comm-utils]
ros_kinetic_rc_cv_utils:
ubuntu: [ros-kinetic-rc-cv-utils]
ros_kinetic_rc_diagnostic:
ubuntu: [ros-kinetic-rc-diagnostic]
ros_kinetic_rc_imagesync:
ubuntu: [ros-kinetic-rc-imagesync]
ros_kinetic_rc_parameter_collection_ros_proxy:
ubuntu: [ros-kinetic-rc-parameter-collection-ros-proxy]
ros_kinetic_rc_statemachine:
ubuntu: [ros-kinetic-rc-statemachine]
ros_kinetic_rc_tagdetection:
ubuntu: [ros-kinetic-rc-tagdetection]
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]
#!/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
find -L $CATKIN_WORKSPACE -name ci_entry_script.bash -exec bash -c 'echo Running entry script from $(basename $(dirname {})) ; {} ' \;
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 $1)) ; $1 ' _ {} \;
echo Finalized running the user entry scripts
#!/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
#!/bin/bash
set -e
rm -rf /root/catkin_ws/build /root/catkin_ws/devel /root/catkin_ws/logs /root/catkin_ws/src
# Unset env vars?
#!/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
......
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
#-------------------------------------------------------------------------------------------------------------
# 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=
#!/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