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 601 additions and 111 deletions
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'
}
...
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 \
&& 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 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
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]
libsoundio1:
ubuntu: [libsoundio1]
libvdbfusion_dev:
ubuntu:
focal: [libvdbfusion-dev]
open3d-ros-helper-pip:
ubuntu:
pip:
packages: [open3d_ros_helper]
peak:
ubuntu: [libpeak-dev]
robotnik_base_hw_lib:
ubuntu: [ros-kinetic-robotnik-base-hw-lib]
telicam-sdk:
ubuntu: [telicam-sdk]
phoxicontrol:
ubuntu:
bionic: [phoxicontrol]
focal: [phoxicontrol]
zivid:
ubuntu: [zivid]
rc_apps_msgs:
ubuntu:
xenial: [ros-kinetic-rc-apps-msgs]
rccomm_utils:
rc_bagthrottler:
ubuntu:
xenial: [rccomm-utils]
xenial: [ros-kinetic-rc-bagthrottler]
rc_parameter_collection_ros_proxy:
rc_comm_utils:
ubuntu:
xenial: [ros-kinetic-rc-parameter-collection-ros-proxy]
xenial: [ros-kinetic-rc-comm-utils]
rcimage_smoothing:
rc_cv_utils:
ubuntu:
xenial: [rcimage-smoothing]
xenial: [ros-kinetic-rc-cv-utils]
rcimagesync:
rc_diagnostic:
ubuntu:
xenial: [rcimagesync]
xenial: [ros-kinetic-rc-diagnostic]
cvkit:
rc_dynamics_api:
ubuntu:
xenial: [cvkit]
xenial: [ros-kinetic-rc-dynamics-api]
rcconsole:
rc_genicam_api:
ubuntu:
xenial: [rcconsole]
xenial: [ros-kinetic-rc-genicam-api]
rc_imagesync:
ubuntu:
xenial: [ros-kinetic-rc-imagesync]
rcobjectdetection_common:
ubuntu:
xenial: [rcobjectdetection-common]
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
#-------------------------------------------------------------------------------------------------------------
# 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
// 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"
]
}
# vscode_devcontainer
.devcontainer configuration for ROS projects
\ No newline at end of file