From d6a32fcc8f53449d5b7eea01abfeae5b0fd1b056 Mon Sep 17 00:00:00 2001 From: Andres Montano <andres.montano@tecnalia.com> Date: Mon, 21 Nov 2022 13:04:06 +0100 Subject: [PATCH] Update dockerfiles and dotfiles --- dockerfiles/DevenvNoetic.Dockerfile | 146 ----------- .../kawada_lab_application.ddeploy.yaml | 0 .../{ => ddeploy}/robouton_core.ddeploy.yaml | 0 ...{DevenvFoxy.Dockerfile => foxy.Dockerfile} | 0 ...vMelodic.Dockerfile => melodic.Dockerfile} | 241 ++++++++---------- dockerfiles/noetic.Dockerfile | 142 +++++++++++ .../DevenvMelodicFlexbotics.Dockerfile | 0 dockerfiles/{ => other}/DevenvPCL.Dockerfile | 0 dockerfiles/{ => other}/Robouton.Dockerfile | 0 dockerfiles/{ => other}/ScanNPlan.Dockerfile | 0 .../{ => other}/SherlockAPP.Dockerfile | 0 .../{ => other}/Sherlock_demo.Dockerfile | 0 .../kinetic.Dockerfile} | 0 .../{ => other}/snp_workshop.Dockerfile | 0 dockerfiles/{ => other}/ssh.Dockerfile | 0 dockerfiles/{ => other}/urko.Dockerfile | 0 dotfiles/docker.bash | 95 +++---- dotfiles/ros.bash | 47 ++-- notes/ci_local_test.md | 76 +++++- 19 files changed, 388 insertions(+), 359 deletions(-) delete mode 100644 dockerfiles/DevenvNoetic.Dockerfile rename dockerfiles/{ => ddeploy}/kawada_lab_application.ddeploy.yaml (100%) rename dockerfiles/{ => ddeploy}/robouton_core.ddeploy.yaml (100%) rename dockerfiles/{DevenvFoxy.Dockerfile => foxy.Dockerfile} (100%) rename dockerfiles/{DevenvMelodic.Dockerfile => melodic.Dockerfile} (54%) create mode 100644 dockerfiles/noetic.Dockerfile rename dockerfiles/{ => other}/DevenvMelodicFlexbotics.Dockerfile (100%) rename dockerfiles/{ => other}/DevenvPCL.Dockerfile (100%) rename dockerfiles/{ => other}/Robouton.Dockerfile (100%) rename dockerfiles/{ => other}/ScanNPlan.Dockerfile (100%) rename dockerfiles/{ => other}/SherlockAPP.Dockerfile (100%) rename dockerfiles/{ => other}/Sherlock_demo.Dockerfile (100%) rename dockerfiles/{DevenvKinetic.Dockerfile => other/kinetic.Dockerfile} (100%) rename dockerfiles/{ => other}/snp_workshop.Dockerfile (100%) rename dockerfiles/{ => other}/ssh.Dockerfile (100%) rename dockerfiles/{ => other}/urko.Dockerfile (100%) diff --git a/dockerfiles/DevenvNoetic.Dockerfile b/dockerfiles/DevenvNoetic.Dockerfile deleted file mode 100644 index 506951f..0000000 --- a/dockerfiles/DevenvNoetic.Dockerfile +++ /dev/null @@ -1,146 +0,0 @@ -FROM osrf/ros:noetic-desktop-full -ENV ROS_DISTRO noetic - -# Avoid warnings by switching to noninteractive -ENV DEBIAN_FRONTEND=noninteractive - -# Setup environment -RUN apt-get update && apt-get install -y \ - locales \ - && sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen en_US.UTF-8 -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US:en -ENV LC_ALL en_US.UTF-8 - -# Configure apt and install packages -RUN apt-get -y install --no-install-recommends \ - apt-transport-https \ - ca-certificates \ - curl \ - gnupg-agent \ - software-properties-common \ - apt-utils dialog 2>&1 \ - # - # Verify if git, process tools, lsb-release (common in install instructions for CLIs) are installed - # Install the https transport support package for The Artifactory debian repository - git \ - git-lfs \ - nano \ - iproute2 \ - procps \ - lsb-release \ - curl \ - cmake \ - openssh-client \ - ros-noetic-catkin \ - python3-catkin-tools \ - python3-osrf-pycommon \ - xterm \ - terminator \ - zsh \ - # && rosdep init || true \ - && rm -rf /var/lib/apt/lists/* - -# Install docker-ce -RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - -RUN add-apt-repository \ - "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" -RUN apt-get update && apt-get -y install --no-install-recommends \ - docker-ce-cli \ - && rm -rf /var/lib/apt/lists/* - -# Configure system to look for debian packages in the Artifactory repository -ARG USER_API_KEY_ARTIFACTS_TECNALIA -RUN sh -c "echo \ - 'deb https://${USER_API_KEY_ARTIFACTS_TECNALIA}@artifact.tecnalia.com/artifactory/tecnalia-robotics-debian xenial main' \ - >> /etc/apt/sources.list.d/tecnalia.list" - -# Import the key in order to be able to use the packages from the repository -RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7E72C5B4111A50084C63C9489E7A9B1D990CF897 -RUN curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add - - -# Configure rosdep -RUN sh -c "echo 'yaml https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/master/rosdistro/rosdep_tecnalia.yaml' \ - >> /etc/ros/rosdep/sources.list.d/20-default.list" - -RUN apt-get update && apt-get install -y \ - wget \ - udev - -RUN wget https://www.zivid.com/hubfs/softwarefiles/releases/1.8.3+96f35dc6-1/u18/zivid-telicam-driver_3.0.1.1-1_amd64.deb \ - https://www.zivid.com/hubfs/softwarefiles/releases/1.8.3+96f35dc6-1/u18/zivid_1.8.3+96f35dc6-1_amd64.deb \ - https://www.zivid.com/hubfs/softwarefiles/releases/1.8.3+96f35dc6-1/u18/zivid-studio_1.8.3+96f35dc6-1_amd64.deb \ - https://www.zivid.com/hubfs/softwarefiles/releases/1.8.3+96f35dc6-1/u18/zivid-tools_1.8.3+96f35dc6-1_amd64.deb - -RUN dpkg -i zivid*.deb - -# Update final image -RUN apt-get update \ - && apt-get -y upgrade \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - -RUN apt-get update && apt-get install -y \ - direnv - -# Scan and Plan dependencies -RUN apt-get update && apt-get install -y \ - ros-noetic-industrial-robot-simulator \ - ros-noetic-moveit-fake-controller-manager \ - ros-noetic-moveit-planners-ompl \ - ros-noetic-moveit-ros-move-group \ - ros-noetic-moveit-ros-visualization \ - ros-noetic-moveit-ros-warehouse \ - ros-noetic-moveit-simple-controller-manager \ - ros-noetic-warehouse-ros \ - ros-noetic-industrial-robot-client \ - python-numpy \ - ros-noetic-simple-message \ - liblapack-dev \ - ros-noetic-moveit-core \ - ros-noetic-trac-ik-kinematics-plugin \ - ros-noetic-urdfdom-py \ - ros-noetic-srdfdom \ - ros-noetic-pcl-ros \ - ros-noetic-moveit-kinematics \ - ros-noetic-pcl-msgs \ - ros-noetic-moveit-ros-planning-interface \ - ros-noetic-swri-profiler \ - libqd-dev \ - libpcl-dev \ - libpcl-apps1.10 \ - libpcl-common1.10 \ - libpcl-features1.10 \ - libpcl-filters1.10 \ - libpcl-io1.10 \ - libpcl-kdtree1.10 \ - libpcl-keypoints1.10 \ - libpcl-ml1.10 \ - libpcl-octree1.10 \ - libpcl-outofcore1.10 \ - libpcl-people1.10 \ - libpcl-recognition1.10 \ - libpcl-registration1.10 \ - libpcl-sample-consensus1.10 \ - libpcl-search1.10 \ - libpcl-segmentation1.10 \ - libpcl-stereo1.10 \ - libpcl-surface1.10 \ - libpcl-tracking1.10 \ - libpcl-visualization1.10 \ - ros-noetic-catkin-virtualenv \ - python3-zmq \ - ros-noetic-moveit-ros-planning \ - ros-noetic-moveit-setup-assistant \ - ros-noetic-ompl \ - ros-noetic-moveit-ros-manipulation - -# Set entrypoint -COPY ./ros_entrypoint.sh / -RUN chmod a+x /ros_entrypoint.sh - -ENTRYPOINT ["/ros_entrypoint.sh"] -CMD ["zsh"] - -# Switch back to dialog for any ad-hoc use of apt-get -ENV DEBIAN_FRONTEND= \ No newline at end of file diff --git a/dockerfiles/kawada_lab_application.ddeploy.yaml b/dockerfiles/ddeploy/kawada_lab_application.ddeploy.yaml similarity index 100% rename from dockerfiles/kawada_lab_application.ddeploy.yaml rename to dockerfiles/ddeploy/kawada_lab_application.ddeploy.yaml diff --git a/dockerfiles/robouton_core.ddeploy.yaml b/dockerfiles/ddeploy/robouton_core.ddeploy.yaml similarity index 100% rename from dockerfiles/robouton_core.ddeploy.yaml rename to dockerfiles/ddeploy/robouton_core.ddeploy.yaml diff --git a/dockerfiles/DevenvFoxy.Dockerfile b/dockerfiles/foxy.Dockerfile similarity index 100% rename from dockerfiles/DevenvFoxy.Dockerfile rename to dockerfiles/foxy.Dockerfile diff --git a/dockerfiles/DevenvMelodic.Dockerfile b/dockerfiles/melodic.Dockerfile similarity index 54% rename from dockerfiles/DevenvMelodic.Dockerfile rename to dockerfiles/melodic.Dockerfile index 073f5ab..95d5199 100644 --- a/dockerfiles/DevenvMelodic.Dockerfile +++ b/dockerfiles/melodic.Dockerfile @@ -1,7 +1,5 @@ FROM osrf/ros:melodic-desktop-full - ENV ROS_DISTRO melodic -ENV RUNNING_IN_DOCKER true # Avoid warnings by switching to noninteractive ENV DEBIAN_FRONTEND=noninteractive @@ -15,33 +13,30 @@ ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 # Configure apt and install packages -RUN apt-get -y install --no-install-recommends \ +RUN apt-get update && apt-get -y install --no-install-recommends \ apt-transport-https \ ca-certificates \ - software-properties-common \ curl \ gnupg-agent \ + software-properties-common \ apt-utils dialog 2>&1 \ + # Verify if git, process tools, lsb-release (common in install instructions for CLIs) are installed + # Install the https transport support package for The Artifactory debian repository git \ git-lfs \ nano \ - less \ - iproute2 \ - procps \ - lsb-release \ - curl \ - cmake \ - openssh-client \ - python-pip \ - python-catkin-tools \ - python-osrf-pycommon \ - libclang-dev \ - cppcheck \ - lcov \ - iwyu \ + clang-format \ + direnv \ xterm \ + terminator \ zsh \ - && rm -rf /var/lib/apt/lists/* + # + ros-${ROS_DISTRO}-catkin \ + ros-${ROS_DISTRO}-rosmon \ + python-catkin-tools \ + python-numpy \ + python-osrf-pycommon \ + ipython # Install docker-ce #RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - @@ -64,109 +59,92 @@ RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7E72C5B411 RUN sh -c "echo 'yaml https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/master/rosdistro/rosdep_tecnalia.yaml' \ >> /etc/ros/rosdep/sources.list.d/20-default.list" +# Ros WS dependencies RUN apt-get update && apt-get install -y \ - ros-melodic-ros-control-boilerplate \ - ros-melodic-ur-msgs \ - ros-melodic-eigen-stl-containers \ - ros-melodic-industrial-robot-simulator \ - ros-melodic-srdfdom \ - ros-melodic-joint-state-publisher-gui \ - ros-${ROS_DISTRO}-rosmon \ - python-pyside \ + ros-${ROS_DISTRO}-abb-driver \ + ros-${ROS_DISTRO}-ackermann-msgs \ + ros-${ROS_DISTRO}-amcl \ + ros-${ROS_DISTRO}-ar-track-alvar \ + ros-${ROS_DISTRO}-ar-track-alvar-msgs \ + ros-${ROS_DISTRO}-catkin-virtualenv \ + ros-${ROS_DISTRO}-effort-controllers \ + ros-${ROS_DISTRO}-eigen-conversions \ + ros-${ROS_DISTRO}-eigen-stl-containers \ + ros-${ROS_DISTRO}-executive-smach-visualization \ + ros-${ROS_DISTRO}-force-torque-sensor-controller \ + ros-${ROS_DISTRO}-gmapping \ + ros-${ROS_DISTRO}-hector-gazebo-plugins \ + ros-${ROS_DISTRO}-hector-mapping \ + ros-${ROS_DISTRO}-image-view \ + ros-${ROS_DISTRO}-imu-complementary-filter \ + ros-${ROS_DISTRO}-imu-tools \ + ros-${ROS_DISTRO}-industrial-core \ + ros-${ROS_DISTRO}-industrial-robot-simulator \ + ros-${ROS_DISTRO}-interactive-marker-twist-server \ + ros-${ROS_DISTRO}-joint-state-publisher-gui \ + ros-${ROS_DISTRO}-joint-trajectory-controller \ + ros-${ROS_DISTRO}-joy \ + ros-${ROS_DISTRO}-lms1xx \ + ros-${ROS_DISTRO}-map-server \ + ros-${ROS_DISTRO}-mavros-msgs \ + ros-${ROS_DISTRO}-move-base \ + ros-${ROS_DISTRO}-moveit \ + ros-${ROS_DISTRO}-moveit-opw-kinematics-plugin \ + ros-${ROS_DISTRO}-moveit-resources \ + ros-${ROS_DISTRO}-moveit-visual-tools \ + ros-${ROS_DISTRO}-navigation \ + ros-${ROS_DISTRO}-realsense2-camera \ + ros-${ROS_DISTRO}-robot-localization \ + ros-${ROS_DISTRO}-ros-control \ + ros-${ROS_DISTRO}-ros-control-boilerplate \ + ros-${ROS_DISTRO}-ros-controllers \ + ros-${ROS_DISTRO}-rosbridge-server \ + ros-${ROS_DISTRO}-rqt-controller-manager \ + ros-${ROS_DISTRO}-rqt-joint-trajectory-controller \ + ros-${ROS_DISTRO}-rviz-visual-tools \ + ros-${ROS_DISTRO}-serial \ + ros-${ROS_DISTRO}-spacenav-node \ + ros-${ROS_DISTRO}-srdfdom \ + ros-${ROS_DISTRO}-swri-profiler \ + ros-${ROS_DISTRO}-teb-local-planner \ + ros-${ROS_DISTRO}-trac-ik-kinematics-plugin \ + ros-${ROS_DISTRO}-twist-mux \ + ros-${ROS_DISTRO}-ur-msgs \ + ros-${ROS_DISTRO}-usb-cam \ + ros-${ROS_DISTRO}-velocity-controllers \ + # + python-funcsigs \ python-lxml \ + python-mock \ + python-pyside \ python-qt4 \ python-qt4-dev \ - libshiboken-dev \ - shiboken \ - libpyside-dev \ - libcomedi-dev \ - libmodbus-dev \ - libcanberra-gtk-module \ - libcanberra-gtk0 \ - cmake - -RUN apt-get install -y \ - ros-melodic-rosbridge-server \ - ros-melodic-moveit \ - ros-melodic-hector-mapping \ - ros-melodic-hector-gazebo-plugins \ - ros-melodic-amcl \ - ros-melodic-gmapping \ - ros-melodic-twist-mux \ - ros-melodic-map-server \ - ros-melodic-joy \ - ros-melodic-teb-local-planner \ - ros-melodic-move-base \ - ros-melodic-velocity-controllers \ - ros-melodic-ackermann-msgs \ - ros-melodic-robot-localization \ - ros-melodic-imu-complementary-filter \ - ros-melodic-mavros-msgs \ - ros-melodic-joint-trajectory-controller \ - ros-melodic-executive-smach-visualization \ - ros-melodic-catkin-virtualenv \ - ros-melodic-rviz-visual-tools \ - python-sqlalchemy \ python-zmq \ - ros-melodic-trac-ik-kinematics-plugin \ - python3-catkin-pkg-modules - -RUN apt-get install -y \ - ros-melodic-ar-track-alvar-msgs \ - ros-melodic-navigation - -RUN apt-get install -y \ - ros-melodic-ar-track-alvar \ - ros-melodic-usb-cam \ + # + libbluetooth-dev \ + libcanberra-gtk-module \ + libcanberra-gtk0 \ + libcanberra-gtk3-module \ libceres-dev \ + libcomedi-dev \ + libcwiid-dev \ + libdouble-conversion-dev \ libglfw3-dev \ - sqlite3 - -RUN apt-get install -y \ - ros-melodic-realsense2-camera \ - ros-melodic-eigen-conversions \ - ros-melodic-abb-driver \ + libmodbus-dev \ + libpyside-dev \ libqd-dev \ - ros-melodic-swri-profiler \ - ros-melodic-force-torque-sensor-controller \ - ros-melodic-effort-controllers - -RUN apt-get install -y \ - libdouble-conversion-dev - -RUN apt-get update \ - && apt-get upgrade ca-certificates -y - -RUN curl -fsSLk https://deb.nodesource.com/setup_14.x | bash - \ - && apt-get install -y -qq nodejs \ - && npm install -g yarn - -RUN apt-get install -y \ + libshiboken-dev \ + libspnav-dev \ + # gir1.2-gtk-3.0 \ - python3-gi \ - python3-gi-cairo \ - python3-numpy \ - python3-pip \ graphviz \ - xdot \ - ros-melodic-image-view \ - libcanberra-gtk-module \ - libcanberra-gtk3-module \ - wget \ - terminator \ - direnv \ - libspnav-dev \ - libbluetooth-dev \ - libcwiid-dev \ - ros-melodic-joy - -RUN apt-get update && apt-get install -y \ - #spacenavd \ - #ros-melodic-spacenav-node \ - ros-melodic-ros-control \ - ros-melodic-rqt-controller-manager \ - systemd + shiboken \ + spacenavd \ + sqlite3 \ + systemd \ + xdot +# Install Zivid packages #RUN wget https://www.zivid.com/hubfs/softwarefiles/releases/1.8.3+96f35dc6-1/u18/zivid-telicam-driver_3.0.1.1-1_amd64.deb \ # https://www.zivid.com/hubfs/softwarefiles/releases/1.8.3+96f35dc6-1/u18/zivid_1.8.3+96f35dc6-1_amd64.deb \ # https://www.zivid.com/hubfs/softwarefiles/releases/1.8.3+96f35dc6-1/u18/zivid-studio_1.8.3+96f35dc6-1_amd64.deb \ @@ -174,38 +152,28 @@ RUN apt-get update && apt-get install -y \ #RUN dpkg -i zivid*.deb +# Fix errors #RUN mv /usr/include/flann/ext/lz4.h /usr/include/flann/ext/lz4.h.bak #RUN mv /usr/include/flann/ext/lz4hc.h /usr/include/flann/ext/lz4.h.bak - #RUN ln -s /usr/include/lz4.h /usr/include/flann/ext/lz4.h #RUN ln -s /usr/include/lz4hc.h /usr/include/flann/ext/lz4hc.h +# Python 3 RUN apt-get update && apt-get install -y \ - ros-melodic-moveit-resources \ - ros-melodic-moveit-visual-tools \ - ros-melodic-moveit-opw-kinematics-plugin \ - ros-melodic-rqt-joint-trajectory-controller \ - ros-melodic-ros-controllers \ - python-mock \ - python-funcsigs \ - clang-format - -RUN apt-get update && apt-get install -y \ - ros-melodic-imu-tools \ - ros-melodic-interactive-marker-twist-server \ - ros-melodic-industrial-core \ - ros-melodic-lms1xx \ - ros-melodic-serial \ - ros-melodic-spacenav-node \ - spacenavd - -RUN pip3 install --upgrade pip - -RUN apt-get update && apt-get install -y \ - ipython3 \ - ipython + python3-catkin-pkg-modules \ + python3-gi \ + python3-gi-cairo \ + python3-numpy \ + python3-pip \ + ipython3 +RUN pip3 install sqlite-utils -# RUN pip3 install sqlite-utils +# Install node for UIs +# RUN curl -fsSLk https://deb.nodesource.com/setup_14.x | bash - \ +# && apt-get install -y -qq nodejs \ +# && npm install -g yarn +RUN curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash \ + && apt-get install -y nodejs && npm -g install yarn # Update final image RUN apt-get update && apt-get -y upgrade && apt-get -y autoremove @@ -218,6 +186,7 @@ RUN chmod a+x /ros_entrypoint.sh ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["zsh"] ENV SHELL /usr/bin/zsh +ENV RUNNING_IN_DOCKER true # Switch back to dialog for any ad-hoc use of apt-get ENV DEBIAN_FRONTEND= diff --git a/dockerfiles/noetic.Dockerfile b/dockerfiles/noetic.Dockerfile new file mode 100644 index 0000000..3e98908 --- /dev/null +++ b/dockerfiles/noetic.Dockerfile @@ -0,0 +1,142 @@ +FROM osrf/ros:noetic-desktop-full +ENV ROS_DISTRO noetic + +# Avoid warnings by switching to noninteractive +ENV DEBIAN_FRONTEND=noninteractive + +# Setup environment +RUN apt-get update && apt-get install -y \ + locales \ + && sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 + +# Configure apt and install packages +RUN apt-get update && apt-get -y install --no-install-recommends \ + apt-transport-https \ + ca-certificates \ + curl \ + gnupg-agent \ + software-properties-common \ + apt-utils dialog 2>&1 \ + # Verify if git, process tools, lsb-release (common in install instructions for CLIs) are installed + # Install the https transport support package for The Artifactory debian repository + git \ + git-lfs \ + nano \ + clang-format \ + direnv \ + xterm \ + terminator \ + zsh \ + # + ros-${ROS_DISTRO}-catkin \ + ros-${ROS_DISTRO}-rosmon \ + python3-catkin-tools \ + python3-osrf-pycommon \ + python3-numpy \ + python3-click \ + python-is-python3 \ + ipython3 + +# Configure system to look for debian packages in the Artifactory repository +ARG USER_API_KEY_ARTIFACTS_TECNALIA +RUN sh -c "echo \ + 'deb https://${USER_API_KEY_ARTIFACTS_TECNALIA}@artifact.tecnalia.com/artifactory/tecnalia-robotics-debian xenial main' \ + >> /etc/apt/sources.list.d/tecnalia.list" + +# Import the key in order to be able to use the packages from the repository +RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7E72C5B4111A50084C63C9489E7A9B1D990CF897 +RUN curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add - + +# Configure rosdep +RUN sh -c "echo 'yaml https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/master/rosdistro/rosdep_tecnalia.yaml' \ + >> /etc/ros/rosdep/sources.list.d/20-default.list" + +# Ros WS dependencies +RUN apt-get update && apt-get install -y \ + # Remodel app + libceres-dev \ + libcomedi-dev \ + libglfw3-dev \ + libmodbus-dev \ + ros-${ROS_DISTRO}-ackermann-msgs \ + ros-${ROS_DISTRO}-amcl \ + ros-${ROS_DISTRO}-effort-controllers \ + ros-${ROS_DISTRO}-force-torque-sensor-controller \ + ros-${ROS_DISTRO}-gmapping \ + ros-${ROS_DISTRO}-hector-gazebo-plugins \ + ros-${ROS_DISTRO}-hector-mapping \ + ros-${ROS_DISTRO}-imu-complementary-filter \ + ros-${ROS_DISTRO}-industrial-robot-simulator \ + ros-${ROS_DISTRO}-joint-trajectory-controller \ + ros-${ROS_DISTRO}-joy \ + ros-${ROS_DISTRO}-map-server \ + ros-${ROS_DISTRO}-mavros-msgs \ + ros-${ROS_DISTRO}-move-base \ + ros-${ROS_DISTRO}-moveit-commander \ + ros-${ROS_DISTRO}-moveit-fake-controller-manager \ + ros-${ROS_DISTRO}-moveit-planners-ompl \ + ros-${ROS_DISTRO}-moveit-resources \ + ros-${ROS_DISTRO}-moveit-ros-move-group \ + ros-${ROS_DISTRO}-moveit-ros-planning-interface \ + ros-${ROS_DISTRO}-moveit-ros-visualization \ + ros-${ROS_DISTRO}-moveit-ros-warehouse \ + ros-${ROS_DISTRO}-moveit-setup-assistant\ + ros-${ROS_DISTRO}-moveit-simple-controller-manager \ + ros-${ROS_DISTRO}-moveit-visual-tools \ + ros-${ROS_DISTRO}-realsense2-camera \ + ros-${ROS_DISTRO}-robot-localization \ + ros-${ROS_DISTRO}-ros-control-boilerplate \ + ros-${ROS_DISTRO}-rosbridge-server \ + ros-${ROS_DISTRO}-spacenav-node \ + ros-${ROS_DISTRO}-teb-local-planner \ + ros-${ROS_DISTRO}-twist-mux \ + ros-${ROS_DISTRO}-ur-msgs \ + ros-${ROS_DISTRO}-velocity-controllers \ + # Smart3D + socat \ + ros-${ROS_DISTRO}-cartesian-trajectory-controller \ + ros-${ROS_DISTRO}-industrial-robot-status-controller \ + ros-${ROS_DISTRO}-industrial-robot-status-interface \ + ros-${ROS_DISTRO}-moveit-ros-benchmarks \ + ros-${ROS_DISTRO}-pass-through-controllers \ + ros-${ROS_DISTRO}-scaled-joint-trajectory-controller \ + ros-${ROS_DISTRO}-speed-scaling-interface \ + ros-${ROS_DISTRO}-speed-scaling-state-controller \ + ros-${ROS_DISTRO}-trac-ik-kinematics-plugin \ + ros-${ROS_DISTRO}-twist-controller \ + ros-${ROS_DISTRO}-ur-client-library \ + ros-${ROS_DISTRO}-warehouse-ros-mongo \ + # Odin_robot + ros-${ROS_DISTRO}-navigation \ + ros-${ROS_DISTRO}-ros-control \ + ros-${ROS_DISTRO}-ros-controllers + +# Install pip3 and packages +RUN apt-get install -y \ + python3-pip \ + && pip install sqlite_utils + +# Install node for UIs +RUN curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash \ + && apt-get install -y nodejs && npm -g install yarn + +# Update final image +RUN apt-get update \ + && apt-get -y upgrade \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Set entrypoint +COPY ./ros_entrypoint.sh / +RUN chmod a+x /ros_entrypoint.sh + +ENTRYPOINT ["/ros_entrypoint.sh"] +CMD ["zsh"] +ENV SHELL /usr/bin/zsh +ENV RUNNING_IN_DOCKER true + +# Switch back to dialog for any ad-hoc use of apt-get +ENV DEBIAN_FRONTEND= \ No newline at end of file diff --git a/dockerfiles/DevenvMelodicFlexbotics.Dockerfile b/dockerfiles/other/DevenvMelodicFlexbotics.Dockerfile similarity index 100% rename from dockerfiles/DevenvMelodicFlexbotics.Dockerfile rename to dockerfiles/other/DevenvMelodicFlexbotics.Dockerfile diff --git a/dockerfiles/DevenvPCL.Dockerfile b/dockerfiles/other/DevenvPCL.Dockerfile similarity index 100% rename from dockerfiles/DevenvPCL.Dockerfile rename to dockerfiles/other/DevenvPCL.Dockerfile diff --git a/dockerfiles/Robouton.Dockerfile b/dockerfiles/other/Robouton.Dockerfile similarity index 100% rename from dockerfiles/Robouton.Dockerfile rename to dockerfiles/other/Robouton.Dockerfile diff --git a/dockerfiles/ScanNPlan.Dockerfile b/dockerfiles/other/ScanNPlan.Dockerfile similarity index 100% rename from dockerfiles/ScanNPlan.Dockerfile rename to dockerfiles/other/ScanNPlan.Dockerfile diff --git a/dockerfiles/SherlockAPP.Dockerfile b/dockerfiles/other/SherlockAPP.Dockerfile similarity index 100% rename from dockerfiles/SherlockAPP.Dockerfile rename to dockerfiles/other/SherlockAPP.Dockerfile diff --git a/dockerfiles/Sherlock_demo.Dockerfile b/dockerfiles/other/Sherlock_demo.Dockerfile similarity index 100% rename from dockerfiles/Sherlock_demo.Dockerfile rename to dockerfiles/other/Sherlock_demo.Dockerfile diff --git a/dockerfiles/DevenvKinetic.Dockerfile b/dockerfiles/other/kinetic.Dockerfile similarity index 100% rename from dockerfiles/DevenvKinetic.Dockerfile rename to dockerfiles/other/kinetic.Dockerfile diff --git a/dockerfiles/snp_workshop.Dockerfile b/dockerfiles/other/snp_workshop.Dockerfile similarity index 100% rename from dockerfiles/snp_workshop.Dockerfile rename to dockerfiles/other/snp_workshop.Dockerfile diff --git a/dockerfiles/ssh.Dockerfile b/dockerfiles/other/ssh.Dockerfile similarity index 100% rename from dockerfiles/ssh.Dockerfile rename to dockerfiles/other/ssh.Dockerfile diff --git a/dockerfiles/urko.Dockerfile b/dockerfiles/other/urko.Dockerfile similarity index 100% rename from dockerfiles/urko.Dockerfile rename to dockerfiles/other/urko.Dockerfile diff --git a/dotfiles/docker.bash b/dotfiles/docker.bash index dfd71c5..8ee2660 100644 --- a/dotfiles/docker.bash +++ b/dotfiles/docker.bash @@ -1,80 +1,63 @@ -# Poining to pip venv -# alias rocker="~/.venv/rocker/bin/rocker" -# alias ddeploy="~/.venv/ddeploy/bin/ddeploy" - # docker common commands alias dim="docker images" -alias drm="docker rm" -alias drmi="docker rmi" - alias dpsa="docker ps -a" alias dps="docker ps" - +alias drm="docker rm" +alias drmi="docker rmi" alias dsp="docker system prune --all" +alias dimp="docker image prune" -function dex() { - docker exec -it $1 ${2:-bash} +# Run container with rocker +# usage: rundock {noetic, melodic} [{remodel_ws, odin_ws}] [cmd] +function rundock() { + cd ~/ros/$1/$2; + rocker --home --user --nvidia --x11 --ssh --git --network host --privileged --name $1 devenv:$1 $3 } -function dsr() { - docker stop $1;docker rm $1 -} - -function runremodel() { - rocker --x11 --nvidia --privileged --network=host --name remodel_docker --oyr-run-arg " -v iiwa_state_recorder:/home/remodel/iiwa_state_recorder -v /home/andres/test/remodel_shared:/home/remodel/remodel_shared" -- remodel_app:melodic bash -c "'roslaunch remodel_app remodel_app.launch use_sim:=true docker:=true skill_manager:=true collision_detector:=true ui:=true cad:=true joystick:=false'" -} - -function rundoc() { - rocker --home --user --nvidia --pulse --x11 --ssh --git --volume /dev/video0:/dev/video0 --privileged --name melodic --network host devenv:melodic $1 -} - -function docrun() { - rocker --nvidia --pulse --x11 --volume /dev/video0:/dev/video0 --privileged --oyr-run-arg " -v odin_robot_volume:/root/" --name odin_robot --network host odin_robot:melodic $1 -} - -function runodin() { - rocker --nvidia --pulse --x11 --privileged --volume /dev/video0:/dev/video0 --name odin_melodic --network host devenv:melodic $1 -} - -function runmelodic() { - rocker --home --user --nvidia --x11 --ssh --git --name melodic devenv:melodic $1 -} - -function runnoetic() { - rocker --home --user --x11 --nvidia --ssh --git --name noetic devenv:noetic $1 -} - -function runkinetic() { - rocker --home --user --nvidia --x11 --ssh --git --name kinetic devenv:kinetic $1 +# Execute container, move to workspace, and source SHELL +# usage: dat {noetic, melodic} {remodel_ws, odin_ws} +function dat() { + docker exec -it $1 bash -c "cd ~/ros/$1/$2 && $ext" } +# Remove all stoped containers function drma() { - docker rm $(docker ps -a -f status=exited -q) + drm $(docker ps -a -f status=exited -q) } -function dat() { - docker exec -it melodic bash -c "cd ~/ros/melodic/$1 && $ext" +# Stop and remove +function dsr() { + docker stop $1; + docker rm $1 } -function datmelodic() { - docker exec -it melodic bash -c "cd ~/ros/melodic/$1 && zsh" +# Remove all unused or dangling immages +function drmui(){ + drmi $(dim --filter "dangling=true" -q --no-trunc) } -function datnoetic() { - docker exec -it noetic -c "cd ~/ros/noetic/$1 && $ext" +# Build docker image +# usage: dockbuild {noetic, melodic} +function dockbuild(){ + cd ~/srcs/development_environment/dockerfiles; + docker build -t devenv:$1 --build-arg USER_API_KEY_ARTIFACTS_TECNALIA="$(cat ~/.ssh/user_api_key_artifacts_tecnalia)" -f $1.Dockerfile . } -function datremodel() { - docker exec -it remodel_docker bash -} +# function runpythonsyntax(){ +# rocker --home --name python_syntax tecnalia-docker-dev.artifact.tecnalia.com/docker:git +# } -function datkinetic() { - docker exec -it kinetic -c "cd ~/ros/kinetic/$1 && $ext" -} +# function runremodel() { +# rocker --x11 --nvidia --privileged --network=host --name remodel_docker --oyr-run-arg " -v iiwa_state_recorder:/home/remodel/iiwa_state_recorder -v /home/andres/test/remodel_shared:/home/remodel/remodel_shared" -- remodel_app:melodic bash -c "'roslaunch remodel_app remodel_app.launch use_sim:=true docker:=true skill_manager:=true collision_detector:=true ui:=true cad:=true joystick:=false'" +# } -function runpythonsyntax(){ - rocker --home --name python_syntax tecnalia-docker-dev.artifact.tecnalia.com/docker:git -} +# function docrun() { +# rocker --nvidia --pulse --x11 --volume /dev/video0:/dev/video0 --privileged --oyr-run-arg " -v odin_robot_volume:/root/" --name odin_robot --network host odin_robot:melodic $1 +# } + +# function runodin() { +# rocker --nvidia --pulse --x11 --privileged --volume /dev/video0:/dev/video0 --name odin_melodic --network host devenv:melodic $1 +# } #DOCKER alias dexec='f(){ docker exec -w /root/ --detach-keys="ctrl-@" -e DISPLAY=$DISPLAY -it $1 /bin/bash -c "terminator --no-dbus"; unset -f f; }; f' diff --git a/dotfiles/ros.bash b/dotfiles/ros.bash index e38d402..e4add5e 100644 --- a/dotfiles/ros.bash +++ b/dotfiles/ros.bash @@ -2,8 +2,17 @@ # ROS aliases and functions ################################################################### -# Define ROS_DISTRO before source ROS -if [ -z $ROS_DISTRO ]; then export ROS_DISTRO=noetic; fi +# Define ROS_DISTRO before source ROS on native OS +# if [ -z $ROS_DISTRO ]; then export ROS_DISTRO=noetic; fi +if [[ -z "${ROS_DISTRO}" ]]; then + ROS_DIR=/opt/ros + if [ -d "$ROS_DIR" ]; + then + export ROS_DISTRO=$(basename $(find /opt/ros/* -maxdepth 0 -type d | head -1)) + else + unset ROS_DISTRO + fi +fi # Determine shell extension if [ -z $SHELL ]; then echo "SHELL not set"; else ext=$(basename ${SHELL}); fi @@ -39,14 +48,19 @@ function sourcethis(){ function cb() { pwd_cb=${PWD} roshome - catkin build --summarize "$@" + catkin build --summarize --cmake-args -DCMAKE_BUILD_TYPE=Release -- "$@" sourcethis cd ${pwd_cb} } # Clean workspace (delete the generated folders, then catkin build) function cbclean(){ - roshome && rm -rf build devel install && catkin build --summarize + roshome && rm -rf build devel install && catkin build --summarize --cmake-args -DCMAKE_BUILD_TYPE=Release +} + +# Run ci locally +function runci(){ + rosrun industrial_ci run_ci ROS_DISTRO="$@" DOCKER_IMAGE=tecnalia-robotics-docker.artifact.tecnalia.com/flexbotics-base-devel:"$@" } # Initialize catkin workspace, configure and build it @@ -55,15 +69,18 @@ function cib(){ } # If terminal starts in a ws, auto source it (useful for vscode) -pwd_init=${PWD} -cropped=${PWD#${HOME}/ros/${ROS_DISTRO}/} -WS_name=${cropped%%/*} -WS_path=${HOME}/ros/${ROS_DISTRO}/${WS_name} -FILE=${WS_path}/devel/setup.${ext} -if [[ -f $FILE ]]; then - cd ${WS_path} - source $FILE - cd ${pwd_init} +if [ -z ${ROS_DISTRO+x} ]; then ; else - source /opt/ros/${ROS_DISTRO}/setup.${ext} -fi + pwd_init=${PWD} + cropped=${PWD#${HOME}/ros/${ROS_DISTRO}/} + WS_name=${cropped%%/*} + WS_path=${HOME}/ros/${ROS_DISTRO}/${WS_name} + FILE=${WS_path}/devel/setup.${ext} + if [[ -f $FILE ]]; then + cd ${WS_path} + source $FILE + cd ${pwd_init} + else + source /opt/ros/${ROS_DISTRO}/setup.${ext} + fi +fi \ No newline at end of file diff --git a/notes/ci_local_test.md b/notes/ci_local_test.md index 567dbb8..c4ad4b8 100644 --- a/notes/ci_local_test.md +++ b/notes/ci_local_test.md @@ -1,13 +1,77 @@ -# Checkin python_syntax +# RUN ci local -in terminal run (from dotfiles docker.bash): +Source: https://git.code.tecnalia.com/tecnalia_robotics/documentation/-/blob/master/tutorials/docker_ci.adoc -runpythonsyntax +## Case 1: verify that a repository passes the CI without .rosinstall file -in docker container run: +1. docker login tecnalia-robotics-docker.artifact.tecnalia.com (Optional -- only to use tecnalia docker images) +2. docker pull tecnalia-robotics-docker.artifact.tecnalia.com/flexbotics-base-devel:ROSDISTRO (Optional -- point 4 actually done this) +3. Download the ci repository into the workspace: + git clone https://github.com/ros-industrial/industrial_ci.git (Optional -- pass the branch legacy (-b legacy), but the master is also working) +4. rosrun industrial_ci run_ci ROS_DISTRO=ROSDISTRO DOCKER_IMAGE=tecnalia-robotics-docker.artifact.tecnalia.com/flexbotics-base-devel:ROSDISTRO (Replace ROSDISTRO by melodic, noetic, etc.) -apk add --update python2 +## Case 2: Case 2: verify that a repository passes the CI with .rosinstall file +4. rosrun industrial_ci run_ci ROS_DISTRO=ROSDISTRO DOCKER_IMAGE=tecnalia-robotics-docker.artifact.tecnalia.com/flexbotics-base-devel:ROSDISTRO UPSTREAM_WORKSPACE=file ROSINSTALL_FILENAME=.rosinstall + +## Other options: +DOCKER_COMMIT=test_ci -- Save the docker image in order to iteract later with it. + +## Simplify using a alias + +function runci(){ + rosrun industrial_ci run_ci ROS_DISTRO="$@" DOCKER_IMAGE=tecnalia-robotics-docker.artifact.tecnalia.com/flexbotics-base-devel:"$@" +} + +Usage: runci noetic + runci melodic + +## Check python_syntax + +a. Locally -- just run: + python -m compileall -q . + +b. In docker (using the same docker than tecnalia ci) + +function runpythonsyntax(){ + rocker --home --name python_syntax tecnalia-docker-dev.artifact.tecnalia.com/docker:git +} + +inside docker container run: + apk add --update python2 go to project source folder, and run: + python -m compileall -q . + + +## Check adoc_syntax +a. Locally -- just run: + curl -Ls https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/master/scripts/asciidoctor_syntax_check.bash | bash -s -- . + +b. In docker: + 1. apk add --update curl asciidoctor bash + 2. Then a. + +## Check bash_syntax +a. Locally -- just run: + 1. find . -type f -name '*.sh' -exec shellcheck -s sh {} + || RET=1 + 2. find . -type f -name '*.bash' -exec shellcheck -s bash {} + || RET=1 + +b. In docker: + 1. apk add --update shellcheck + +## Check clang format (Not tested) +a. Locally -- just run: + 1. wget https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/master/clang-format -O .clang-format + 2. .ci_config/gitlab.sh + +## Check file structure + docker run -v ${PWD}:/ac tecnalia-docker-dev.artifact.tecnalia.com/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 tecnalia-docker-dev.artifact.tecnalia.com/cytopia/awesome-ci file-utf8 --path=/ac --extension=py,txt,cpp,h,md,sh,bash,xml,launch --ignore=.ci_config || RET=1 + +## More tips + docker login tecnalia-docker-dev.artifact.tecnalia.com -u ${ARTIFACT_CI_USER} -p ${ARTIFACT_CI_TOKEN} -python -m compileall -q . \ No newline at end of file +### Black magic + curl -L "https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/-/jobs/artifacts/master/raw/dot_devcontainer.tar.gz?job=deploy_devcontainer" | tar xz + + -- GitLab