From e78a7c9e022d93c34c155a7542ab5fe78be28340 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Thu, 6 Jun 2024 14:07:51 +0200 Subject: [PATCH 01/15] warn that blacklisting is only supported for ros2 --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 731e295..36e4efb 100644 --- a/README.md +++ b/README.md @@ -303,6 +303,8 @@ Most of the steps listed in [*About*](#about) and below can be toggled between r ### Package Blacklist +*:warning: only supported on ROS 2* + If your ROS-based repository (or any of your repository's upstream dependencies, see `.repos`) contains ROS packages that should neither be built nor be used for determining dependencies, you can blacklist those in a special `blacklisted-packages.txt` file. Create a file `blacklisted-packages.txt` in your `docker` folder (or configure a different `BLACKLISTED_PACKAGES_FILE`) and list any ROS package name to blacklist. From c759b4bd25cfaeeedc998079d0634859b2ab07ba Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Thu, 6 Jun 2024 14:08:49 +0200 Subject: [PATCH 02/15] update readme notice --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 36e4efb..c94100f 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,7 @@ > This repository is open-sourced and maintained by the [**Institute for Automotive Engineering (ika) at RWTH Aachen University**](https://www.ika.rwth-aachen.de/). > **DevOps, Containerization and Orchestration of Software-Defined Vehicles** are some of many research topics within our [*Vehicle Intelligence & Automated Driving*](https://www.ika.rwth-aachen.de/en/competences/fields-of-research/vehicle-intelligence-automated-driving.html) domain. > If you would like to learn more about how we can support your DevOps or automated driving efforts, feel free to reach out to us! ->      *Timo Woopen - Manager Research Area Vehicle Intelligence & Automated Driving* ->      *+49 241 80 23549* ->      *timo.woopen@ika.rwth-aachen.de* +> :email: ***opensource@ika.rwth-aachen.de*** - [About](#about) - [Prerequisites](#prerequisites) From 3954a36291337fd67cb89ff2c84f07daeb5cf26d Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Thu, 6 Jun 2024 12:42:32 +0000 Subject: [PATCH 03/15] implement blacklisting for ros1 --- docker/Dockerfile | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 2212eb5..39312b2 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -33,8 +33,12 @@ RUN apt-get update && \ git \ python3-rosdep \ python3-vcstool \ - ros-${ROS_DISTRO}-ros-core \ - && rm -rf /var/lib/apt/lists/* + ros-${ROS_DISTRO}-ros-core && \ + if [[ "$ROS_DISTRO" == "noetic" ]]; then \ + apt-get install -y \ + python3-catkin-tools ; \ + fi && \ + rm -rf /var/lib/apt/lists/* # copy contents of repository COPY . src/target @@ -72,15 +76,23 @@ RUN if [[ $ENABLE_RECURSIVE_VCS_IMPORT == 'true' ]]; then \ # remove blacklisted packages from workspace ARG BLACKLISTED_PACKAGES_FILE="docker/blacklisted-packages.txt" ARG ENABLE_RECURSIVE_BLACKLISTED_PACKAGES="false" -RUN echo "colcon list -p --base-paths src/ --packages-select \\" >> $WORKSPACE/.remove-packages.sh && \ +RUN if [[ -x "$(command -v colcon)" ]]; then \ + echo "colcon list -p --base-paths src/ --packages-select \\" >> $WORKSPACE/.remove-packages.sh ; \ + elif [[ -x "$(command -v catkin)" ]]; then \ + echo "for pkg in \\" >> $WORKSPACE/.remove-packages.sh ; \ + fi && \ if [[ $ENABLE_RECURSIVE_BLACKLISTED_PACKAGES == 'true' ]]; then \ find . -type f -name $(basename ${BLACKLISTED_PACKAGES_FILE}) -exec sed '$a\' {} \; | awk '{print " " $0 " \\"}' >> $WORKSPACE/.remove-packages.sh ; \ elif [[ -f src/target/${BLACKLISTED_PACKAGES_FILE} ]]; then \ cat src/target/${BLACKLISTED_PACKAGES_FILE} | awk '{print " " $0 " \\"}' >> $WORKSPACE/.remove-packages.sh ; \ fi && \ - echo ";" >> $WORKSPACE/.remove-packages.sh && \ + if [[ -x "$(command -v colcon)" ]]; then \ + echo ";" >> $WORKSPACE/.remove-packages.sh ; \ + elif [[ -x "$(command -v catkin)" ]]; then \ + echo "do find . -type f -name package.xml -path \"*/$pkg/package.xml\" -exec dirname {} \;; done" >> $WORKSPACE/.remove-packages.sh ; \ + fi && \ chmod +x $WORKSPACE/.remove-packages.sh && \ - $WORKSPACE/.remove-packages.sh 2> /dev/null | xargs rm -rf + $WORKSPACE/.remove-packages.sh 2> /dev/null | xargs rm -rfv # create install script with list of rosdep dependencies RUN echo "set -e" >> $WORKSPACE/.install-dependencies.sh && \ From 754c31b6adaf821ff014f346f1940fa8c7a176d0 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Thu, 6 Jun 2024 12:50:47 +0000 Subject: [PATCH 04/15] temporarily add printing of package removal script --- docker/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index 39312b2..91598f9 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -92,6 +92,7 @@ RUN if [[ -x "$(command -v colcon)" ]]; then \ echo "do find . -type f -name package.xml -path \"*/$pkg/package.xml\" -exec dirname {} \;; done" >> $WORKSPACE/.remove-packages.sh ; \ fi && \ chmod +x $WORKSPACE/.remove-packages.sh && \ + cat $WORKSPACE/.remove-packages.sh && \ $WORKSPACE/.remove-packages.sh 2> /dev/null | xargs rm -rfv # create install script with list of rosdep dependencies From b803b51a9f236fc7896aa5df47f95383b822971e Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Thu, 6 Jun 2024 12:55:58 +0000 Subject: [PATCH 05/15] try to fix ros1 blacklisting --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 91598f9..70557d0 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -89,7 +89,7 @@ RUN if [[ -x "$(command -v colcon)" ]]; then \ if [[ -x "$(command -v colcon)" ]]; then \ echo ";" >> $WORKSPACE/.remove-packages.sh ; \ elif [[ -x "$(command -v catkin)" ]]; then \ - echo "do find . -type f -name package.xml -path \"*/$pkg/package.xml\" -exec dirname {} \;; done" >> $WORKSPACE/.remove-packages.sh ; \ + echo "; do find . -type f -name package.xml -path \"*/\$pkg/package.xml\" -exec dirname {} \;; done" >> $WORKSPACE/.remove-packages.sh ; \ fi && \ chmod +x $WORKSPACE/.remove-packages.sh && \ cat $WORKSPACE/.remove-packages.sh && \ From 34c1e48b509a47894b86b8e146c2ac5e87a958ac Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Thu, 6 Jun 2024 13:00:34 +0000 Subject: [PATCH 06/15] remove temporary print of pkg removal script --- docker/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 70557d0..8650d9d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -92,7 +92,6 @@ RUN if [[ -x "$(command -v colcon)" ]]; then \ echo "; do find . -type f -name package.xml -path \"*/\$pkg/package.xml\" -exec dirname {} \;; done" >> $WORKSPACE/.remove-packages.sh ; \ fi && \ chmod +x $WORKSPACE/.remove-packages.sh && \ - cat $WORKSPACE/.remove-packages.sh && \ $WORKSPACE/.remove-packages.sh 2> /dev/null | xargs rm -rfv # create install script with list of rosdep dependencies From cab9bd15b47ac396737f2782d6af8d9e324c54d5 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Thu, 6 Jun 2024 13:00:53 +0000 Subject: [PATCH 07/15] remove warning that blacklisting is only supported for ros2 --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index c94100f..f173e5e 100644 --- a/README.md +++ b/README.md @@ -301,8 +301,6 @@ Most of the steps listed in [*About*](#about) and below can be toggled between r ### Package Blacklist -*:warning: only supported on ROS 2* - If your ROS-based repository (or any of your repository's upstream dependencies, see `.repos`) contains ROS packages that should neither be built nor be used for determining dependencies, you can blacklist those in a special `blacklisted-packages.txt` file. Create a file `blacklisted-packages.txt` in your `docker` folder (or configure a different `BLACKLISTED_PACKAGES_FILE`) and list any ROS package name to blacklist. From bc1309f72f5b32f0f26719ba0ba76b725a46d6cc Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Thu, 6 Jun 2024 13:19:41 +0000 Subject: [PATCH 08/15] add options to toggle to continue rosdep and catkin/colcon on failure --- .gitlab-ci/docker-ros.yml | 68 ++++++++++++++------------- README.md | 8 ++++ action.yml | 6 +++ docker/Dockerfile | 20 ++++++-- scripts/build.sh | 2 + scripts/ci.sh | 2 + templates/docker-compose.template.yml | 2 + 7 files changed, 72 insertions(+), 36 deletions(-) diff --git a/.gitlab-ci/docker-ros.yml b/.gitlab-ci/docker-ros.yml index 3f22462..a08d951 100644 --- a/.gitlab-ci/docker-ros.yml +++ b/.gitlab-ci/docker-ros.yml @@ -9,39 +9,41 @@ workflow: variables: - TARGET: run # Target stage of Dockerfile (comma-separated list) [dev|run] - PLATFORM: amd64 # Target platform architecture (comma-separated list) [amd64|arm64|...] - BASE_IMAGE: '' # Base image name:tag (required) - COMMAND: '' # Launch command of run image (required if target=run) - IMAGE_NAME: ${CI_REGISTRY_IMAGE} # Image name of run image - IMAGE_TAG: latest # Image tag of run image - DEV_IMAGE_NAME: ${IMAGE_NAME} # Image name of dev image - DEV_IMAGE_TAG: ${IMAGE_TAG}-dev # Image tag of dev image - BUILD_CONTEXT: . # Build context of Docker build process - REGISTRY: ${CI_REGISTRY} # Docker registry to push images to - REGISTRY_USER: ${CI_REGISTRY_USER} # Docker registry username - REGISTRY_PASSWORD: ${CI_REGISTRY_PASSWORD} # Docker registry password - ENABLE_INDUSTRIAL_CI: 'false' # Enable industrial_ci - ENABLE_SINGLEARCH_PUSH: 'false' # Enable push of single arch images with [-amd64|-arm64] postfix - ENABLE_PUSH_AS_LATEST: 'false' # Push images with tag `latest`/`latest-dev` in addition to the configured image names - RMW_IMPLEMENTATION: 'rmw_cyclonedds_cpp' # RMW implementation to use (only for ROS 2) - ROS_DISTRO: '' # ROS Distro (required if ROS is not installed in `base-image`) - GIT_HTTPS_SERVER: ${CI_SERVER_HOST} # Server URL (without protocol) for cloning private Git repositories via HTTPS - GIT_HTTPS_USER: gitlab-ci-token # Username for cloning private Git repositories via HTTPS - GIT_HTTPS_PASSWORD: ${CI_JOB_TOKEN} # Password for cloning private Git repositories via HTTPS - GIT_SSH_PRIVATE_KEY: '' # SSH private key for cloning private Git repositories via SSH - GIT_SSH_KNOWN_HOST_KEYS: '' # Known SSH host keys for cloning private Git repositories via SSH (may be obtained using `ssh-keyscan`) - ADDITIONAL_DEBS_FILE: docker/additional-debs.txt # Relative filepath to file containing additional apt deb packages to install - ENABLE_RECURSIVE_ADDITIONAL_DEBS: 'false' # Enable recursive discovery of files named `additional-debs-file` - ADDITIONAL_FILES_DIR: docker/additional-files # Relative path to directory containing additional files to copy into image" - ADDITIONAL_PIP_FILE: docker/additional-pip-requirements.txt # Relative filepath to file containing additional pip packages to install - ENABLE_RECURSIVE_ADDITIONAL_PIP: 'false' # Enable recursive discovery of files named `additional-pip-file` - BLACKLISTED_PACKAGES_FILE: docker/blacklisted-packages.txt # Relative filepath to file containing the blacklisted packages - ENABLE_RECURSIVE_BLACKLISTED_PACKAGES: 'false' # Enable recursive discovery of files named `blacklisted-packages-file` - CUSTOM_SCRIPT_FILE: docker/custom.sh # Relative filepath to script containing custom installation commands - ENABLE_RECURSIVE_CUSTOM_SCRIPT: 'false' # Enable recursive discovery of files named `custom-script-file` - VCS_IMPORT_FILE: .repos # Relative filepath to file containing additional repos to install via vcstools (only relevant if ENABLE_RECURSIVE_VCS_IMPORT=false) - ENABLE_RECURSIVE_VCS_IMPORT: 'true' # Enable recursive discovery of files named `*.repos` + TARGET: run # Target stage of Dockerfile (comma-separated list) [dev|run] + PLATFORM: amd64 # Target platform architecture (comma-separated list) [amd64|arm64|...] + BASE_IMAGE: '' # Base image name:tag (required) + COMMAND: '' # Launch command of run image (required if target=run) + IMAGE_NAME: ${CI_REGISTRY_IMAGE} # Image name of run image + IMAGE_TAG: latest # Image tag of run image + DEV_IMAGE_NAME: ${IMAGE_NAME} # Image name of dev image + DEV_IMAGE_TAG: ${IMAGE_TAG}-dev # Image tag of dev image + BUILD_CONTEXT: . # Build context of Docker build process + REGISTRY: ${CI_REGISTRY} # Docker registry to push images to + REGISTRY_USER: ${CI_REGISTRY_USER} # Docker registry username + REGISTRY_PASSWORD: ${CI_REGISTRY_PASSWORD} # Docker registry password + ENABLE_INDUSTRIAL_CI: 'false' # Enable industrial_ci + ENABLE_SINGLEARCH_PUSH: 'false' # Enable push of single arch images with [-amd64|-arm64] postfix + ENABLE_PUSH_AS_LATEST: 'false' # Push images with tag `latest`/`latest-dev` in addition to the configured image names + RMW_IMPLEMENTATION: 'rmw_cyclonedds_cpp' # RMW implementation to use (only for ROS 2) + ROS_DISTRO: '' # ROS Distro (required if ROS is not installed in `base-image`) + GIT_HTTPS_SERVER: ${CI_SERVER_HOST} # Server URL (without protocol) for cloning private Git repositories via HTTPS + GIT_HTTPS_USER: gitlab-ci-token # Username for cloning private Git repositories via HTTPS + GIT_HTTPS_PASSWORD: ${CI_JOB_TOKEN} # Password for cloning private Git repositories via HTTPS + GIT_SSH_PRIVATE_KEY: '' # SSH private key for cloning private Git repositories via SSH + GIT_SSH_KNOWN_HOST_KEYS: '' # Known SSH host keys for cloning private Git repositories via SSH (may be obtained using `ssh-keyscan`) + ADDITIONAL_DEBS_FILE: docker/additional-debs.txt # Relative filepath to file containing additional apt deb packages to install + ENABLE_RECURSIVE_ADDITIONAL_DEBS: 'false' # Enable recursive discovery of files named `additional-debs-file` + ADDITIONAL_FILES_DIR: docker/additional-files # Relative path to directory containing additional files to copy into image" + ADDITIONAL_PIP_FILE: docker/additional-pip-requirements.txt # Relative filepath to file containing additional pip packages to install + ENABLE_RECURSIVE_ADDITIONAL_PIP: 'false' # Enable recursive discovery of files named `additional-pip-file` + BLACKLISTED_PACKAGES_FILE: docker/blacklisted-packages.txt # Relative filepath to file containing the blacklisted packages + ENABLE_RECURSIVE_BLACKLISTED_PACKAGES: 'false' # Enable recursive discovery of files named `blacklisted-packages-file` + CUSTOM_SCRIPT_FILE: docker/custom.sh # Relative filepath to script containing custom installation commands + ENABLE_RECURSIVE_CUSTOM_SCRIPT: 'false' # Enable recursive discovery of files named `custom-script-file` + VCS_IMPORT_FILE: .repos # Relative filepath to file containing additional repos to install via vcstools (only relevant if ENABLE_RECURSIVE_VCS_IMPORT=false) + ENABLE_RECURSIVE_VCS_IMPORT: 'true' # Enable recursive discovery of files named `*.repos` + ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS: 'false' # Enable `rosdep install -r` + ENABLE_CONTINUE_BUILD_DESPITE_ERRORS 'false' # Enable `catkin build --continue-on-failure` / `colcon build --continue-on-error` # ----- DOCKER_ROS_GIT_REF: main diff --git a/README.md b/README.md index f173e5e..961c2a2 100644 --- a/README.md +++ b/README.md @@ -305,6 +305,8 @@ If your ROS-based repository (or any of your repository's upstream dependencies, Create a file `blacklisted-packages.txt` in your `docker` folder (or configure a different `BLACKLISTED_PACKAGES_FILE`) and list any ROS package name to blacklist. +If you are having problems with (upstream) packages that you don't need, also have a look at `ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS` and `ENABLE_CONTINUE_BUILD_DESPITE_ERRORS`. + ### Extra System Dependencies (*apt*) If your ROS-based repository requires system dependencies that cannot be installed by specifying their [rosdep](https://docs.ros.org/en/independent/api/rosdep/html/) keys in a `package.xml`, you can use a special `additional-debs.txt` file. @@ -395,6 +397,12 @@ Create a folder `additional-files` in your `docker` folder (or configure a diffe - **`git-https-user` | `GIT_HTTPS_USER`** Username for cloning private Git repositories via HTTPS *default:* `${{ github.actor }}` | `gitlab-ci-token` +- **`enable-continue-build-despite-errors` | `ENABLE_CONTINUE_BUILD_DESPITE_ERRORS`** + Enable `catkin build --continue-on-failure` / `colcon build --continue-on-error` + *default:* `false` +- **`enable-continue-rosdep-install-despite-errors` | `ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS`** + Enable `rosdep install -r` + *default:* `false` - **`enable-recursive-additional-debs` | `ENABLE_RECURSIVE_ADDITIONAL_DEBS`** Enable recursive discovery of files named `additional-debs-file` *default:* `false` diff --git a/action.yml b/action.yml index 6dbbd89..0eefdd7 100644 --- a/action.yml +++ b/action.yml @@ -216,6 +216,8 @@ runs: ENABLE_RECURSIVE_CUSTOM_SCRIPT: ${{ inputs.enable-recursive-custom-script }} VCS_IMPORT_FILE: ${{ inputs.vcs-import-file }} ENABLE_RECURSIVE_VCS_IMPORT: ${{ inputs.enable-recursive-vcs-import }} + ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS: ${{ inputs.enable-continue-rosdep-install-despite-errors }} + ENABLE_CONTINUE_BUILD_DESPITE_ERRORS: ${{ inputs.enable-continue-build-despite-errors }} - name: Set up industrial_ci if: ${{ inputs.enable-industrial-ci == 'true' }} @@ -274,6 +276,8 @@ runs: ENABLE_RECURSIVE_CUSTOM_SCRIPT: ${{ inputs.enable-recursive-custom-script }} VCS_IMPORT_FILE: ${{ inputs.vcs-import-file }} ENABLE_RECURSIVE_VCS_IMPORT: ${{ inputs.enable-recursive-vcs-import }} + ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS: ${{ inputs.enable-continue-rosdep-install-despite-errors }} + ENABLE_CONTINUE_BUILD_DESPITE_ERRORS: ${{ inputs.enable-continue-build-despite-errors }} _ENABLE_IMAGE_PUSH: true _IMAGE_POSTFIX: ${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) && format('_{0}_ci', steps.slugify-ref-name.outputs.slug) || '' }} @@ -310,5 +314,7 @@ runs: ENABLE_RECURSIVE_CUSTOM_SCRIPT: ${{ inputs.enable-recursive-custom-script }} VCS_IMPORT_FILE: ${{ inputs.vcs-import-file }} ENABLE_RECURSIVE_VCS_IMPORT: ${{ inputs.enable-recursive-vcs-import }} + ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS: ${{ inputs.enable-continue-rosdep-install-despite-errors }} + ENABLE_CONTINUE_BUILD_DESPITE_ERRORS: ${{ inputs.enable-continue-build-despite-errors }} _ENABLE_IMAGE_PUSH: true _IMAGE_POSTFIX: ${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) && format('_{0}_ci', steps.slugify-ref-name.outputs.slug) || '' }} \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index 8650d9d..02c1b96 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -95,6 +95,7 @@ RUN if [[ -x "$(command -v colcon)" ]]; then \ $WORKSPACE/.remove-packages.sh 2> /dev/null | xargs rm -rfv # create install script with list of rosdep dependencies +ARG ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS="false" RUN echo "set -e" >> $WORKSPACE/.install-dependencies.sh && \ source /opt/ros/$ROS_DISTRO/setup.bash && \ apt-get update && \ @@ -103,7 +104,11 @@ RUN echo "set -e" >> $WORKSPACE/.install-dependencies.sh && \ export OS="ubuntu:$(lsb_release -c | awk '{print $2}')" && \ if [[ "$ROS_DISTRO" = "rolling" && "$OS" = "ubuntu:focal" ]]; then export OS="ubuntu:jammy"; fi && \ set -o pipefail && \ - ROS_PACKAGE_PATH=$(pwd):$ROS_PACKAGE_PATH rosdep install --os $OS -y --simulate --from-paths src --ignore-src | tee -a $WORKSPACE/.install-dependencies.sh && \ + if [[ $ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS == 'true' ]]; then \ + ROS_PACKAGE_PATH=$(pwd):$ROS_PACKAGE_PATH rosdep install --os $OS -y --simulate --from-paths src --ignore-src -r | tee -a $WORKSPACE/.install-dependencies.sh ; \ + else \ + ROS_PACKAGE_PATH=$(pwd):$ROS_PACKAGE_PATH rosdep install --os $OS -y --simulate --from-paths src --ignore-src | tee -a $WORKSPACE/.install-dependencies.sh ; \ + fi && \ chmod +x $WORKSPACE/.install-dependencies.sh && \ rm -rf /var/lib/apt/lists/* @@ -250,12 +255,21 @@ CMD ["bash"] FROM dev as build # build ROS workspace +ARG ENABLE_CONTINUE_BUILD_DESPITE_ERRORS="false" RUN if [[ -x "$(command -v colcon)" ]]; then \ source /opt/ros/${ROS_DISTRO}/setup.bash && \ - colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release ; \ + if [[ $ENABLE_CONTINUE_BUILD_DESPITE_ERRORS == 'true' ]]; then \ + colcon build --continue-on-error --cmake-args -DCMAKE_BUILD_TYPE=Release ; \ + else \ + colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release ; \ + fi ; \ elif [[ -x "$(command -v catkin)" ]]; then \ catkin config --install --extend /opt/ros/${ROS_DISTRO} && \ - catkin build -DCMAKE_BUILD_TYPE=Release --force-color --no-status --summarize ; \ + if [[ $ENABLE_CONTINUE_BUILD_DESPITE_ERRORS == 'true' ]]; then \ + catkin build -DCMAKE_BUILD_TYPE=Release --force-color --no-status --summarize --continue-on-failure ; \ + else \ + catkin build -DCMAKE_BUILD_TYPE=Release --force-color --no-status --summarize ; \ + fi ; \ fi ############ run ############################################################### diff --git a/scripts/build.sh b/scripts/build.sh index 83b59a6..9a82b67 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -35,6 +35,8 @@ build_image() { $(if [[ -n "${ENABLE_RECURSIVE_CUSTOM_SCRIPT}" ]]; then echo "--build-arg ENABLE_RECURSIVE_CUSTOM_SCRIPT=${ENABLE_RECURSIVE_CUSTOM_SCRIPT}"; fi) \ $(if [[ -n "${VCS_IMPORT_FILE}" ]]; then echo "--build-arg VCS_IMPORT_FILE=${VCS_IMPORT_FILE}"; fi) \ $(if [[ -n "${ENABLE_RECURSIVE_VCS_IMPORT}" ]]; then echo "--build-arg ENABLE_RECURSIVE_VCS_IMPORT=${ENABLE_RECURSIVE_VCS_IMPORT}"; fi) \ + $(if [[ -n "${ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS}" ]]; then echo "--build-arg ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS=${ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS}"; fi) \ + $(if [[ -n "${ENABLE_CONTINUE_BUILD_DESPITE_ERRORS}" ]]; then echo "--build-arg ENABLE_CONTINUE_BUILD_DESPITE_ERRORS=${ENABLE_CONTINUE_BUILD_DESPITE_ERRORS}"; fi) \ . echo "Successfully built stage '${TARGET}' for platform '${PLATFORM}' as '${IMAGE}'" } diff --git a/scripts/ci.sh b/scripts/ci.sh index 8f76fd4..6a1cad9 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh @@ -38,6 +38,8 @@ CUSTOM_SCRIPT_FILE="${CUSTOM_SCRIPT_FILE:-}" ENABLE_RECURSIVE_CUSTOM_SCRIPT="${ENABLE_RECURSIVE_CUSTOM_SCRIPT:-}" VCS_IMPORT_FILE="${VCS_IMPORT_FILE:-}" ENABLE_RECURSIVE_VCS_IMPORT="${ENABLE_RECURSIVE_VCS_IMPORT:-}" +ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS="${ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS:-}" +ENABLE_CONTINUE_BUILD_DESPITE_ERRORS="${ENABLE_CONTINUE_BUILD_DESPITE_ERRORS:-}" _ENABLE_IMAGE_PUSH="${_ENABLE_IMAGE_PUSH:-false}" _IMAGE_POSTFIX="${_IMAGE_POSTFIX:-""}" diff --git a/templates/docker-compose.template.yml b/templates/docker-compose.template.yml index 54280bf..686e7c4 100644 --- a/templates/docker-compose.template.yml +++ b/templates/docker-compose.template.yml @@ -22,6 +22,8 @@ x-build: &build ENABLE_RECURSIVE_BLACKLISTED_PACKAGES: $ENABLE_RECURSIVE_BLACKLISTED_PACKAGES ENABLE_RECURSIVE_CUSTOM_SCRIPT: $ENABLE_RECURSIVE_CUSTOM_SCRIPT ENABLE_RECURSIVE_VCS_IMPORT: $ENABLE_RECURSIVE_VCS_IMPORT + ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS: $ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS + ENABLE_CONTINUE_BUILD_DESPITE_ERRORS: $ENABLE_CONTINUE_BUILD_DESPITE_ERRORS GIT_HTTPS_PASSWORD: $GIT_HTTPS_PASSWORD GIT_HTTPS_SERVER: $GIT_HTTPS_SERVER GIT_HTTPS_USER: $GIT_HTTPS_USER From 20a8991867758db6c7bf0d9b84df8676d3caa69b Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Thu, 6 Jun 2024 13:21:38 +0000 Subject: [PATCH 09/15] fix typo in .gitlab-ci --- .gitlab-ci/docker-ros.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci/docker-ros.yml b/.gitlab-ci/docker-ros.yml index a08d951..d26a3fe 100644 --- a/.gitlab-ci/docker-ros.yml +++ b/.gitlab-ci/docker-ros.yml @@ -43,7 +43,7 @@ variables: VCS_IMPORT_FILE: .repos # Relative filepath to file containing additional repos to install via vcstools (only relevant if ENABLE_RECURSIVE_VCS_IMPORT=false) ENABLE_RECURSIVE_VCS_IMPORT: 'true' # Enable recursive discovery of files named `*.repos` ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS: 'false' # Enable `rosdep install -r` - ENABLE_CONTINUE_BUILD_DESPITE_ERRORS 'false' # Enable `catkin build --continue-on-failure` / `colcon build --continue-on-error` + ENABLE_CONTINUE_BUILD_DESPITE_ERRORS: 'false' # Enable `catkin build --continue-on-failure` / `colcon build --continue-on-error` # ----- DOCKER_ROS_GIT_REF: main From b5cd5ff05ef6ff11fdb8801ef0140bbea59d5a71 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Thu, 6 Jun 2024 14:31:30 +0000 Subject: [PATCH 10/15] add option to build to devel space in ros1 --- .gitlab-ci/docker-ros.yml | 49 +++++----- README.md | 45 +++++---- action.yml | 133 +++++++++++++------------- docker/Dockerfile | 9 +- scripts/build.sh | 27 +++--- scripts/ci.sh | 33 +++---- templates/docker-compose.template.yml | 5 +- 7 files changed, 158 insertions(+), 143 deletions(-) diff --git a/.gitlab-ci/docker-ros.yml b/.gitlab-ci/docker-ros.yml index d26a3fe..c1d7f01 100644 --- a/.gitlab-ci/docker-ros.yml +++ b/.gitlab-ci/docker-ros.yml @@ -9,41 +9,42 @@ workflow: variables: - TARGET: run # Target stage of Dockerfile (comma-separated list) [dev|run] - PLATFORM: amd64 # Target platform architecture (comma-separated list) [amd64|arm64|...] + ADDITIONAL_DEBS_FILE: docker/additional-debs.txt # Relative filepath to file containing additional apt deb packages to install + ADDITIONAL_FILES_DIR: docker/additional-files # Relative path to directory containing additional files to copy into image" + ADDITIONAL_PIP_FILE: docker/additional-pip-requirements.txt # Relative filepath to file containing additional pip packages to install BASE_IMAGE: '' # Base image name:tag (required) + BLACKLISTED_PACKAGES_FILE: docker/blacklisted-packages.txt # Relative filepath to file containing the blacklisted packages + BUILD_CONTEXT: . # Build context of Docker build process COMMAND: '' # Launch command of run image (required if target=run) - IMAGE_NAME: ${CI_REGISTRY_IMAGE} # Image name of run image - IMAGE_TAG: latest # Image tag of run image + CUSTOM_SCRIPT_FILE: docker/custom.sh # Relative filepath to script containing custom installation commands DEV_IMAGE_NAME: ${IMAGE_NAME} # Image name of dev image DEV_IMAGE_TAG: ${IMAGE_TAG}-dev # Image tag of dev image - BUILD_CONTEXT: . # Build context of Docker build process - REGISTRY: ${CI_REGISTRY} # Docker registry to push images to - REGISTRY_USER: ${CI_REGISTRY_USER} # Docker registry username - REGISTRY_PASSWORD: ${CI_REGISTRY_PASSWORD} # Docker registry password + ENABLE_CONTINUE_BUILD_DESPITE_ERRORS: 'false' # Enable `catkin build --continue-on-failure` / `colcon build --continue-on-error` + ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS: 'false' # Enable `rosdep install -r` ENABLE_INDUSTRIAL_CI: 'false' # Enable industrial_ci - ENABLE_SINGLEARCH_PUSH: 'false' # Enable push of single arch images with [-amd64|-arm64] postfix ENABLE_PUSH_AS_LATEST: 'false' # Push images with tag `latest`/`latest-dev` in addition to the configured image names - RMW_IMPLEMENTATION: 'rmw_cyclonedds_cpp' # RMW implementation to use (only for ROS 2) - ROS_DISTRO: '' # ROS Distro (required if ROS is not installed in `base-image`) - GIT_HTTPS_SERVER: ${CI_SERVER_HOST} # Server URL (without protocol) for cloning private Git repositories via HTTPS - GIT_HTTPS_USER: gitlab-ci-token # Username for cloning private Git repositories via HTTPS - GIT_HTTPS_PASSWORD: ${CI_JOB_TOKEN} # Password for cloning private Git repositories via HTTPS - GIT_SSH_PRIVATE_KEY: '' # SSH private key for cloning private Git repositories via SSH - GIT_SSH_KNOWN_HOST_KEYS: '' # Known SSH host keys for cloning private Git repositories via SSH (may be obtained using `ssh-keyscan`) - ADDITIONAL_DEBS_FILE: docker/additional-debs.txt # Relative filepath to file containing additional apt deb packages to install ENABLE_RECURSIVE_ADDITIONAL_DEBS: 'false' # Enable recursive discovery of files named `additional-debs-file` - ADDITIONAL_FILES_DIR: docker/additional-files # Relative path to directory containing additional files to copy into image" - ADDITIONAL_PIP_FILE: docker/additional-pip-requirements.txt # Relative filepath to file containing additional pip packages to install ENABLE_RECURSIVE_ADDITIONAL_PIP: 'false' # Enable recursive discovery of files named `additional-pip-file` - BLACKLISTED_PACKAGES_FILE: docker/blacklisted-packages.txt # Relative filepath to file containing the blacklisted packages ENABLE_RECURSIVE_BLACKLISTED_PACKAGES: 'false' # Enable recursive discovery of files named `blacklisted-packages-file` - CUSTOM_SCRIPT_FILE: docker/custom.sh # Relative filepath to script containing custom installation commands ENABLE_RECURSIVE_CUSTOM_SCRIPT: 'false' # Enable recursive discovery of files named `custom-script-file` - VCS_IMPORT_FILE: .repos # Relative filepath to file containing additional repos to install via vcstools (only relevant if ENABLE_RECURSIVE_VCS_IMPORT=false) ENABLE_RECURSIVE_VCS_IMPORT: 'true' # Enable recursive discovery of files named `*.repos` - ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS: 'false' # Enable `rosdep install -r` - ENABLE_CONTINUE_BUILD_DESPITE_ERRORS: 'false' # Enable `catkin build --continue-on-failure` / `colcon build --continue-on-error` + ENABLE_ROS1_DEVEL_SPACE: 'false' # Enable building to ROS devel space instead of install space (ROS 1 only) + ENABLE_SINGLEARCH_PUSH: 'false' # Enable push of single arch images with [-amd64|-arm64] postfix + GIT_HTTPS_PASSWORD: ${CI_JOB_TOKEN} # Password for cloning private Git repositories via HTTPS + GIT_HTTPS_SERVER: ${CI_SERVER_HOST} # Server URL (without protocol) for cloning private Git repositories via HTTPS + GIT_HTTPS_USER: gitlab-ci-token # Username for cloning private Git repositories via HTTPS + GIT_SSH_KNOWN_HOST_KEYS: '' # Known SSH host keys for cloning private Git repositories via SSH (may be obtained using `ssh-keyscan`) + GIT_SSH_PRIVATE_KEY: '' # SSH private key for cloning private Git repositories via SSH + IMAGE_NAME: ${CI_REGISTRY_IMAGE} # Image name of run image + IMAGE_TAG: latest # Image tag of run image + PLATFORM: amd64 # Target platform architecture (comma-separated list) [amd64|arm64|...] + REGISTRY_PASSWORD: ${CI_REGISTRY_PASSWORD} # Docker registry password + REGISTRY_USER: ${CI_REGISTRY_USER} # Docker registry username + REGISTRY: ${CI_REGISTRY} # Docker registry to push images to + RMW_IMPLEMENTATION: 'rmw_cyclonedds_cpp' # RMW implementation to use (only for ROS 2) + ROS_DISTRO: '' # ROS Distro (required if ROS is not installed in `base-image`) + TARGET: run # Target stage of Dockerfile (comma-separated list) [dev|run] + VCS_IMPORT_FILE: .repos # Relative filepath to file containing additional repos to install via vcstools (only relevant if ENABLE_RECURSIVE_VCS_IMPORT=false) # ----- DOCKER_ROS_GIT_REF: main diff --git a/README.md b/README.md index 961c2a2..d6d522a 100644 --- a/README.md +++ b/README.md @@ -373,36 +373,24 @@ Create a folder `additional-files` in your `docker` folder (or configure a diffe - **`enable-checkout` | `-`** Enable [*checkout*](https://github.com/actions/checkout) action to (re-)download your repository prior to running the pipeline *default:* `true` -- **`enable-checkout-submodules` | `-`** - Enable submodules for the [*checkout*](https://github.com/actions/checkout) action (`false`|`true`|`recursive`) - *default:* `recursive` - **`enable-checkout-lfs` | `-`** Enable [*Git LFS*](https://git-lfs.com/) support for the [*checkout*](https://github.com/actions/checkout) action *default:* `true` -- **`enable-industrial-ci` | `ENABLE_INDUSTRIAL_CI`** - Enable [*industrial_ci*](https://github.com/ros-industrial/industrial_ci) - *default:* `false` -- **`enable-push-as-latest` | `ENABLE_PUSH_AS_LATEST`** - Push images with tag `latest`/`latest-dev` in addition to the configured image names - *default:* `false` -- **`enable-singlearch-push` | `ENABLE_SINGLEARCH_PUSH`** - Enable push of single arch images with `-amd64`/`-arm64` postfix - *default:* `false` -- **`git-https-password` | `GIT_HTTPS_PASSWORD`** - Password for cloning private Git repositories via HTTPS - *default:* `${{ github.token }}` | `$CI_JOB_TOKEN` -- **`git-https-server` | `GIT_HTTPS_SERVER`** - Server URL (without protocol) for cloning private Git repositories via HTTPS - *default:* `github.com` | `$CI_SERVER_HOST:$CI_SERVER_PORT` -- **`git-https-user` | `GIT_HTTPS_USER`** - Username for cloning private Git repositories via HTTPS - *default:* `${{ github.actor }}` | `gitlab-ci-token` +- **`enable-checkout-submodules` | `-`** + Enable submodules for the [*checkout*](https://github.com/actions/checkout) action (`false`|`true`|`recursive`) + *default:* `recursive` - **`enable-continue-build-despite-errors` | `ENABLE_CONTINUE_BUILD_DESPITE_ERRORS`** Enable `catkin build --continue-on-failure` / `colcon build --continue-on-error` *default:* `false` - **`enable-continue-rosdep-install-despite-errors` | `ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS`** Enable `rosdep install -r` *default:* `false` +- **`enable-industrial-ci` | `ENABLE_INDUSTRIAL_CI`** + Enable [*industrial_ci*](https://github.com/ros-industrial/industrial_ci) + *default:* `false` +- **`enable-push-as-latest` | `ENABLE_PUSH_AS_LATEST`** + Push images with tag `latest`/`latest-dev` in addition to the configured image names + *default:* `false` - **`enable-recursive-additional-debs` | `ENABLE_RECURSIVE_ADDITIONAL_DEBS`** Enable recursive discovery of files named `additional-debs-file` *default:* `false` @@ -418,6 +406,21 @@ Create a folder `additional-files` in your `docker` folder (or configure a diffe - **`enable-recursive-vcs-import` | `ENABLE_RECURSIVE_VCS_IMPORT`** Enable recursive discovery of files named `*.repos` *default:* `true` +- **`enable-ros1-devel-space` | `ENABLE_ROS1_DEVEL_SPACE`** + Enable building to ROS devel space instead of install space (ROS 1 only) + *default:* `false` +- **`enable-singlearch-push` | `ENABLE_SINGLEARCH_PUSH`** + Enable push of single arch images with `-amd64`/`-arm64` postfix + *default:* `false` +- **`git-https-password` | `GIT_HTTPS_PASSWORD`** + Password for cloning private Git repositories via HTTPS + *default:* `${{ github.token }}` | `$CI_JOB_TOKEN` +- **`git-https-server` | `GIT_HTTPS_SERVER`** + Server URL (without protocol) for cloning private Git repositories via HTTPS + *default:* `github.com` | `$CI_SERVER_HOST:$CI_SERVER_PORT` +- **`git-https-user` | `GIT_HTTPS_USER`** + Username for cloning private Git repositories via HTTPS + *default:* `${{ github.actor }}` | `gitlab-ci-token` - **`git-ssh-known-host-keys` | `GIT_SSH_KNOWN_HOST_KEYS`** Known SSH host keys for cloning private Git repositories via SSH (may be obtained using `ssh-keyscan`) - **`git-ssh-private-key` | `GIT_SSH_PRIVATE_KEY`** diff --git a/action.yml b/action.yml index 0eefdd7..1e4c2fc 100644 --- a/action.yml +++ b/action.yml @@ -132,6 +132,8 @@ inputs: description: "Enable Git LFS support for the checkout action" default: true + # TODO! + runs: using: "composite" @@ -190,34 +192,35 @@ runs: working-directory: ${{ inputs.build-context }} run: docker/docker-ros/scripts/ci.sh env: - PLATFORM: ${{ inputs.platform }} - TARGET: ${{ inputs.target }} + ADDITIONAL_DEBS_FILE: ${{ inputs.additional-debs-file }} + ADDITIONAL_FILES_DIR: ${{ inputs.additional-files-dir }} + ADDITIONAL_PIP_FILE: ${{ inputs.additional-pip-file }} BASE_IMAGE: ${{ inputs.base-image }} + BLACKLISTED_PACKAGES_FILE: ${{ inputs.blacklisted-packages-file }} COMMAND: ${{ inputs.command }} - IMAGE_NAME: ${{ steps.image-name.outputs.lowercase }} - IMAGE_TAG: ${{ inputs.image-tag }} + CUSTOM_SCRIPT_FILE: ${{ inputs.custom-script-file }} DEV_IMAGE_NAME: ${{ steps.dev-image-name.outputs.lowercase }} DEV_IMAGE_TAG: ${{ inputs.dev-image-tag }} - RMW_IMPLEMENTATION: ${{ inputs.rmw-implementation }} - ROS_DISTRO: ${{ inputs.ros-distro }} - GIT_HTTPS_SERVER: ${{ inputs.git-https-server }} - GIT_HTTPS_USER: ${{ inputs.git-https-user }} - GIT_HTTPS_PASSWORD: ${{ inputs.git-https-password }} - GIT_SSH_PRIVATE_KEY: ${{ inputs.git-ssh-private-key }} - GIT_SSH_KNOWN_HOST_KEYS: ${{ inputs.git-ssh-known-host-keys }} - ADDITIONAL_DEBS_FILE: ${{ inputs.additional-debs-file }} + ENABLE_CONTINUE_BUILD_DESPITE_ERRORS: ${{ inputs.enable-continue-build-despite-errors }} + ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS: ${{ inputs.enable-continue-rosdep-install-despite-errors }} ENABLE_RECURSIVE_ADDITIONAL_DEBS: ${{ inputs.enable-recursive-additional-debs }} - ADDITIONAL_FILES_DIR: ${{ inputs.additional-files-dir }} - ADDITIONAL_PIP_FILE: ${{ inputs.additional-pip-file }} ENABLE_RECURSIVE_ADDITIONAL_PIP: ${{ inputs.enable-recursive-additional-pip }} - BLACKLISTED_PACKAGES_FILE: ${{ inputs.blacklisted-packages-file }} ENABLE_RECURSIVE_BLACKLISTED_PACKAGES: ${{ inputs.enable-recursive-blacklisted-packages }} - CUSTOM_SCRIPT_FILE: ${{ inputs.custom-script-file }} ENABLE_RECURSIVE_CUSTOM_SCRIPT: ${{ inputs.enable-recursive-custom-script }} - VCS_IMPORT_FILE: ${{ inputs.vcs-import-file }} ENABLE_RECURSIVE_VCS_IMPORT: ${{ inputs.enable-recursive-vcs-import }} - ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS: ${{ inputs.enable-continue-rosdep-install-despite-errors }} - ENABLE_CONTINUE_BUILD_DESPITE_ERRORS: ${{ inputs.enable-continue-build-despite-errors }} + ENABLE_ROS1_DEVEL_SPACE: ${{ inputs.enable-ros1-devel-space }} + GIT_HTTPS_PASSWORD: ${{ inputs.git-https-password }} + GIT_HTTPS_SERVER: ${{ inputs.git-https-server }} + GIT_HTTPS_USER: ${{ inputs.git-https-user }} + GIT_SSH_KNOWN_HOST_KEYS: ${{ inputs.git-ssh-known-host-keys }} + GIT_SSH_PRIVATE_KEY: ${{ inputs.git-ssh-private-key }} + IMAGE_NAME: ${{ steps.image-name.outputs.lowercase }} + IMAGE_TAG: ${{ inputs.image-tag }} + PLATFORM: ${{ inputs.platform }} + RMW_IMPLEMENTATION: ${{ inputs.rmw-implementation }} + ROS_DISTRO: ${{ inputs.ros-distro }} + TARGET: ${{ inputs.target }} + VCS_IMPORT_FILE: ${{ inputs.vcs-import-file }} - name: Set up industrial_ci if: ${{ inputs.enable-industrial-ci == 'true' }} @@ -228,15 +231,15 @@ runs: if: ${{ inputs.enable-industrial-ci == 'true' }} uses: ros-industrial/industrial_ci@master env: - UPSTREAM_WORKSPACE: ${{ inputs.build-context }}/.repos - TARGET_WORKSPACE: ${{ inputs.build-context }} ADDITIONAL_DEBS: git AFTER_INIT_EMBED: '[[ -n ${{ inputs.git-https-server }} ]] && git config --global url.https://${{ inputs.git-https-user }}:${{ inputs.git-https-password }}@${{ inputs.git-https-server }}.insteadOf https://${{ inputs.git-https-server }}' - SSH_PRIVATE_KEY: ${{ inputs.git-ssh-private-key }} - SSH_SERVER_HOSTKEYS: ${{ inputs.git-ssh-known-host-keys }} - DOCKER_RUN_OPTS: -u root:root DOCKER_IMAGE: ${{ steps.build-images.outputs.INDUSTRIAL_CI_IMAGE }} DOCKER_PULL: false + DOCKER_RUN_OPTS: -u root:root + SSH_PRIVATE_KEY: ${{ inputs.git-ssh-private-key }} + SSH_SERVER_HOSTKEYS: ${{ inputs.git-ssh-known-host-keys }} + TARGET_WORKSPACE: ${{ inputs.build-context }} + UPSTREAM_WORKSPACE: ${{ inputs.build-context }}/.repos - name: Slugify ref name id: slugify-ref-name @@ -249,35 +252,36 @@ runs: working-directory: ${{ inputs.build-context }} run: docker/docker-ros/scripts/ci.sh env: - PLATFORM: ${{ inputs.platform }} - TARGET: ${{ inputs.target }} + ADDITIONAL_DEBS_FILE: ${{ inputs.additional-debs-file }} + ADDITIONAL_FILES_DIR: ${{ inputs.additional-files-dir }} + ADDITIONAL_PIP_FILE: ${{ inputs.additional-pip-file }} BASE_IMAGE: ${{ inputs.base-image }} + BLACKLISTED_PACKAGES_FILE: ${{ inputs.blacklisted-packages-file }} COMMAND: ${{ inputs.command }} - IMAGE_NAME: ${{ steps.image-name.outputs.lowercase }} - IMAGE_TAG: ${{ inputs.image-tag }} + CUSTOM_SCRIPT_FILE: ${{ inputs.custom-script-file }} DEV_IMAGE_NAME: ${{ inputs.dev-image-name }} DEV_IMAGE_TAG: ${{ inputs.dev-image-tag }} - ENABLE_SINGLEARCH_PUSH: ${{ inputs.enable-singlearch-push }} - RMW_IMPLEMENTATION: ${{ inputs.rmw-implementation }} - ROS_DISTRO: ${{ inputs.ros-distro }} - GIT_HTTPS_SERVER: ${{ inputs.git-https-server }} - GIT_HTTPS_USER: ${{ inputs.git-https-user }} - GIT_HTTPS_PASSWORD: ${{ inputs.git-https-password }} - GIT_SSH_PRIVATE_KEY: ${{ inputs.git-ssh-private-key }} - GIT_SSH_KNOWN_HOST_KEYS: ${{ inputs.git-ssh-known-host-keys }} - ADDITIONAL_DEBS_FILE: ${{ inputs.additional-debs-file }} + ENABLE_CONTINUE_BUILD_DESPITE_ERRORS: ${{ inputs.enable-continue-build-despite-errors }} + ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS: ${{ inputs.enable-continue-rosdep-install-despite-errors }} ENABLE_RECURSIVE_ADDITIONAL_DEBS: ${{ inputs.enable-recursive-additional-debs }} - ADDITIONAL_FILES_DIR: ${{ inputs.additional-files-dir }} - ADDITIONAL_PIP_FILE: ${{ inputs.additional-pip-file }} ENABLE_RECURSIVE_ADDITIONAL_PIP: ${{ inputs.enable-recursive-additional-pip }} - BLACKLISTED_PACKAGES_FILE: ${{ inputs.blacklisted-packages-file }} ENABLE_RECURSIVE_BLACKLISTED_PACKAGES: ${{ inputs.enable-recursive-blacklisted-packages }} - CUSTOM_SCRIPT_FILE: ${{ inputs.custom-script-file }} ENABLE_RECURSIVE_CUSTOM_SCRIPT: ${{ inputs.enable-recursive-custom-script }} - VCS_IMPORT_FILE: ${{ inputs.vcs-import-file }} ENABLE_RECURSIVE_VCS_IMPORT: ${{ inputs.enable-recursive-vcs-import }} - ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS: ${{ inputs.enable-continue-rosdep-install-despite-errors }} - ENABLE_CONTINUE_BUILD_DESPITE_ERRORS: ${{ inputs.enable-continue-build-despite-errors }} + ENABLE_ROS1_DEVEL_SPACE: ${{ inputs.enable-ros1-devel-space }} + ENABLE_SINGLEARCH_PUSH: ${{ inputs.enable-singlearch-push }} + GIT_HTTPS_PASSWORD: ${{ inputs.git-https-password }} + GIT_HTTPS_SERVER: ${{ inputs.git-https-server }} + GIT_HTTPS_USER: ${{ inputs.git-https-user }} + GIT_SSH_KNOWN_HOST_KEYS: ${{ inputs.git-ssh-known-host-keys }} + GIT_SSH_PRIVATE_KEY: ${{ inputs.git-ssh-private-key }} + IMAGE_NAME: ${{ steps.image-name.outputs.lowercase }} + IMAGE_TAG: ${{ inputs.image-tag }} + PLATFORM: ${{ inputs.platform }} + RMW_IMPLEMENTATION: ${{ inputs.rmw-implementation }} + ROS_DISTRO: ${{ inputs.ros-distro }} + TARGET: ${{ inputs.target }} + VCS_IMPORT_FILE: ${{ inputs.vcs-import-file }} _ENABLE_IMAGE_PUSH: true _IMAGE_POSTFIX: ${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) && format('_{0}_ci', steps.slugify-ref-name.outputs.slug) || '' }} @@ -287,34 +291,35 @@ runs: working-directory: ${{ inputs.build-context }} run: docker/docker-ros/scripts/ci.sh env: - PLATFORM: ${{ inputs.platform }} - TARGET: ${{ inputs.target }} + ADDITIONAL_DEBS_FILE: ${{ inputs.additional-debs-file }} + ADDITIONAL_FILES_DIR: ${{ inputs.additional-files-dir }} + ADDITIONAL_PIP_FILE: ${{ inputs.additional-pip-file }} BASE_IMAGE: ${{ inputs.base-image }} + BLACKLISTED_PACKAGES_FILE: ${{ inputs.blacklisted-packages-file }} COMMAND: ${{ inputs.command }} - IMAGE_NAME: ${{ steps.image-name.outputs.lowercase }} - IMAGE_TAG: latest + CUSTOM_SCRIPT_FILE: ${{ inputs.custom-script-file }} DEV_IMAGE_NAME: ${{ inputs.dev-image-name }} DEV_IMAGE_TAG: latest-dev - ENABLE_SINGLEARCH_PUSH: ${{ inputs.enable-singlearch-push }} - RMW_IMPLEMENTATION: ${{ inputs.rmw-implementation }} - ROS_DISTRO: ${{ inputs.ros-distro }} - GIT_HTTPS_SERVER: ${{ inputs.git-https-server }} - GIT_HTTPS_USER: ${{ inputs.git-https-user }} - GIT_HTTPS_PASSWORD: ${{ inputs.git-https-password }} - GIT_SSH_PRIVATE_KEY: ${{ inputs.git-ssh-private-key }} - GIT_SSH_KNOWN_HOST_KEYS: ${{ inputs.git-ssh-known-host-keys }} - ADDITIONAL_DEBS_FILE: ${{ inputs.additional-debs-file }} + ENABLE_CONTINUE_BUILD_DESPITE_ERRORS: ${{ inputs.enable-continue-build-despite-errors }} + ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS: ${{ inputs.enable-continue-rosdep-install-despite-errors }} ENABLE_RECURSIVE_ADDITIONAL_DEBS: ${{ inputs.enable-recursive-additional-debs }} - ADDITIONAL_FILES_DIR: ${{ inputs.additional-files-dir }} - ADDITIONAL_PIP_FILE: ${{ inputs.additional-pip-file }} ENABLE_RECURSIVE_ADDITIONAL_PIP: ${{ inputs.enable-recursive-additional-pip }} - BLACKLISTED_PACKAGES_FILE: ${{ inputs.blacklisted-packages-file }} ENABLE_RECURSIVE_BLACKLISTED_PACKAGES: ${{ inputs.enable-recursive-blacklisted-packages }} - CUSTOM_SCRIPT_FILE: ${{ inputs.custom-script-file }} ENABLE_RECURSIVE_CUSTOM_SCRIPT: ${{ inputs.enable-recursive-custom-script }} - VCS_IMPORT_FILE: ${{ inputs.vcs-import-file }} ENABLE_RECURSIVE_VCS_IMPORT: ${{ inputs.enable-recursive-vcs-import }} - ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS: ${{ inputs.enable-continue-rosdep-install-despite-errors }} - ENABLE_CONTINUE_BUILD_DESPITE_ERRORS: ${{ inputs.enable-continue-build-despite-errors }} + ENABLE_ROS1_DEVEL_SPACE: ${{ inputs.enable-ros1-devel-space }} + ENABLE_SINGLEARCH_PUSH: ${{ inputs.enable-singlearch-push }} + GIT_HTTPS_PASSWORD: ${{ inputs.git-https-password }} + GIT_HTTPS_SERVER: ${{ inputs.git-https-server }} + GIT_HTTPS_USER: ${{ inputs.git-https-user }} + GIT_SSH_KNOWN_HOST_KEYS: ${{ inputs.git-ssh-known-host-keys }} + GIT_SSH_PRIVATE_KEY: ${{ inputs.git-ssh-private-key }} + IMAGE_NAME: ${{ steps.image-name.outputs.lowercase }} + IMAGE_TAG: latest + PLATFORM: ${{ inputs.platform }} + RMW_IMPLEMENTATION: ${{ inputs.rmw-implementation }} + ROS_DISTRO: ${{ inputs.ros-distro }} + TARGET: ${{ inputs.target }} + VCS_IMPORT_FILE: ${{ inputs.vcs-import-file }} _ENABLE_IMAGE_PUSH: true _IMAGE_POSTFIX: ${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) && format('_{0}_ci', steps.slugify-ref-name.outputs.slug) || '' }} \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index 02c1b96..b3c2870 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -256,15 +256,18 @@ FROM dev as build # build ROS workspace ARG ENABLE_CONTINUE_BUILD_DESPITE_ERRORS="false" -RUN if [[ -x "$(command -v colcon)" ]]; then \ - source /opt/ros/${ROS_DISTRO}/setup.bash && \ +ARG ENABLE_ROS1_DEVEL_SPACE="false" +RUN source /opt/ros/${ROS_DISTRO}/setup.bash && \ + if [[ -x "$(command -v colcon)" ]]; then \ if [[ $ENABLE_CONTINUE_BUILD_DESPITE_ERRORS == 'true' ]]; then \ colcon build --continue-on-error --cmake-args -DCMAKE_BUILD_TYPE=Release ; \ else \ colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release ; \ fi ; \ elif [[ -x "$(command -v catkin)" ]]; then \ - catkin config --install --extend /opt/ros/${ROS_DISTRO} && \ + if [[ $ENABLE_ROS1_DEVEL_SPACE == 'false' ]]; then \ + catkin config --install --extend /opt/ros/${ROS_DISTRO} ; \ + fi && \ if [[ $ENABLE_CONTINUE_BUILD_DESPITE_ERRORS == 'true' ]]; then \ catkin build -DCMAKE_BUILD_TYPE=Release --force-color --no-status --summarize --continue-on-failure ; \ else \ diff --git a/scripts/build.sh b/scripts/build.sh index 9a82b67..6e5dd4f 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -17,26 +17,27 @@ build_image() { $(if [[ "${_ENABLE_IMAGE_PUSH}" == "true" ]]; then echo "--push"; else echo "--load"; fi) \ --build-arg BASE_IMAGE="${BASE_IMAGE}" \ --build-arg COMMAND="${COMMAND}" \ - $(if [[ -n "${RMW_IMPLEMENTATION}" ]]; then echo "--build-arg RMW_IMPLEMENTATION=${RMW_IMPLEMENTATION}"; fi) \ - $(if [[ -n "${ROS_DISTRO}" ]]; then echo "--build-arg ROS_DISTRO=${ROS_DISTRO}"; fi) \ - $(if [[ -n "${GIT_HTTPS_SERVER}" ]]; then echo "--build-arg GIT_HTTPS_SERVER=${GIT_HTTPS_SERVER}"; fi) \ - $(if [[ -n "${GIT_HTTPS_USER}" ]]; then echo "--build-arg GIT_HTTPS_USER=${GIT_HTTPS_USER}"; fi) \ - $(if [[ -n "${GIT_HTTPS_PASSWORD}" ]]; then echo "--build-arg GIT_HTTPS_PASSWORD=${GIT_HTTPS_PASSWORD}"; fi) \ - $(if [[ -n "${GIT_SSH_PRIVATE_KEY}" ]]; then echo "--build-arg GIT_SSH_PRIVATE_KEY=${GIT_SSH_PRIVATE_KEY}"; fi) \ - $(if [[ -n "${GIT_SSH_KNOWN_HOST_KEYS}" ]]; then echo "--build-arg GIT_SSH_KNOWN_HOST_KEYS=${GIT_SSH_KNOWN_HOST_KEYS}"; fi) \ $(if [[ -n "${ADDITIONAL_DEBS_FILE}" ]]; then echo "--build-arg ADDITIONAL_DEBS_FILE=${ADDITIONAL_DEBS_FILE}"; fi) \ - $(if [[ -n "${ENABLE_RECURSIVE_ADDITIONAL_DEBS}" ]]; then echo "--build-arg ENABLE_RECURSIVE_ADDITIONAL_DEBS=${ENABLE_RECURSIVE_ADDITIONAL_DEBS}"; fi) \ $(if [[ -n "${ADDITIONAL_FILES_DIR}" ]]; then echo "--build-arg ADDITIONAL_FILES_DIR=${ADDITIONAL_FILES_DIR}"; fi) \ $(if [[ -n "${ADDITIONAL_PIP_FILE}" ]]; then echo "--build-arg ADDITIONAL_PIP_FILE=${ADDITIONAL_PIP_FILE}"; fi) \ - $(if [[ -n "${ENABLE_RECURSIVE_ADDITIONAL_PIP}" ]]; then echo "--build-arg ENABLE_RECURSIVE_ADDITIONAL_PIP=${ENABLE_RECURSIVE_ADDITIONAL_PIP}"; fi) \ $(if [[ -n "${BLACKLISTED_PACKAGES_FILE}" ]]; then echo "--build-arg BLACKLISTED_PACKAGES_FILE=${BLACKLISTED_PACKAGES_FILE}"; fi) \ - $(if [[ -n "${ENABLE_RECURSIVE_BLACKLISTED_PACKAGES}" ]]; then echo "--build-arg ENABLE_RECURSIVE_BLACKLISTED_PACKAGES=${ENABLE_RECURSIVE_BLACKLISTED_PACKAGES}"; fi) \ $(if [[ -n "${CUSTOM_SCRIPT_FILE}" ]]; then echo "--build-arg CUSTOM_SCRIPT_FILE=${CUSTOM_SCRIPT_FILE}"; fi) \ + $(if [[ -n "${ENABLE_CONTINUE_BUILD_DESPITE_ERRORS}" ]]; then echo "--build-arg ENABLE_CONTINUE_BUILD_DESPITE_ERRORS=${ENABLE_CONTINUE_BUILD_DESPITE_ERRORS}"; fi) \ + $(if [[ -n "${ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS}" ]]; then echo "--build-arg ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS=${ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS}"; fi) \ + $(if [[ -n "${ENABLE_RECURSIVE_ADDITIONAL_DEBS}" ]]; then echo "--build-arg ENABLE_RECURSIVE_ADDITIONAL_DEBS=${ENABLE_RECURSIVE_ADDITIONAL_DEBS}"; fi) \ + $(if [[ -n "${ENABLE_RECURSIVE_ADDITIONAL_PIP}" ]]; then echo "--build-arg ENABLE_RECURSIVE_ADDITIONAL_PIP=${ENABLE_RECURSIVE_ADDITIONAL_PIP}"; fi) \ + $(if [[ -n "${ENABLE_RECURSIVE_BLACKLISTED_PACKAGES}" ]]; then echo "--build-arg ENABLE_RECURSIVE_BLACKLISTED_PACKAGES=${ENABLE_RECURSIVE_BLACKLISTED_PACKAGES}"; fi) \ $(if [[ -n "${ENABLE_RECURSIVE_CUSTOM_SCRIPT}" ]]; then echo "--build-arg ENABLE_RECURSIVE_CUSTOM_SCRIPT=${ENABLE_RECURSIVE_CUSTOM_SCRIPT}"; fi) \ - $(if [[ -n "${VCS_IMPORT_FILE}" ]]; then echo "--build-arg VCS_IMPORT_FILE=${VCS_IMPORT_FILE}"; fi) \ $(if [[ -n "${ENABLE_RECURSIVE_VCS_IMPORT}" ]]; then echo "--build-arg ENABLE_RECURSIVE_VCS_IMPORT=${ENABLE_RECURSIVE_VCS_IMPORT}"; fi) \ - $(if [[ -n "${ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS}" ]]; then echo "--build-arg ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS=${ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS}"; fi) \ - $(if [[ -n "${ENABLE_CONTINUE_BUILD_DESPITE_ERRORS}" ]]; then echo "--build-arg ENABLE_CONTINUE_BUILD_DESPITE_ERRORS=${ENABLE_CONTINUE_BUILD_DESPITE_ERRORS}"; fi) \ + $(if [[ -n "${ENABLE_ROS1_DEVEL_SPACE}" ]]; then echo "--build-arg ENABLE_ROS1_DEVEL_SPACE=${ENABLE_ROS1_DEVEL_SPACE}"; fi) \ + $(if [[ -n "${GIT_HTTPS_PASSWORD}" ]]; then echo "--build-arg GIT_HTTPS_PASSWORD=${GIT_HTTPS_PASSWORD}"; fi) \ + $(if [[ -n "${GIT_HTTPS_SERVER}" ]]; then echo "--build-arg GIT_HTTPS_SERVER=${GIT_HTTPS_SERVER}"; fi) \ + $(if [[ -n "${GIT_HTTPS_USER}" ]]; then echo "--build-arg GIT_HTTPS_USER=${GIT_HTTPS_USER}"; fi) \ + $(if [[ -n "${GIT_SSH_KNOWN_HOST_KEYS}" ]]; then echo "--build-arg GIT_SSH_KNOWN_HOST_KEYS=${GIT_SSH_KNOWN_HOST_KEYS}"; fi) \ + $(if [[ -n "${GIT_SSH_PRIVATE_KEY}" ]]; then echo "--build-arg GIT_SSH_PRIVATE_KEY=${GIT_SSH_PRIVATE_KEY}"; fi) \ + $(if [[ -n "${RMW_IMPLEMENTATION}" ]]; then echo "--build-arg RMW_IMPLEMENTATION=${RMW_IMPLEMENTATION}"; fi) \ + $(if [[ -n "${ROS_DISTRO}" ]]; then echo "--build-arg ROS_DISTRO=${ROS_DISTRO}"; fi) \ + $(if [[ -n "${VCS_IMPORT_FILE}" ]]; then echo "--build-arg VCS_IMPORT_FILE=${VCS_IMPORT_FILE}"; fi) \ . echo "Successfully built stage '${TARGET}' for platform '${PLATFORM}' as '${IMAGE}'" } diff --git a/scripts/ci.sh b/scripts/ci.sh index 6a1cad9..8c9ad7a 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh @@ -17,29 +17,30 @@ IMAGE_TAG="${IMAGE_TAG:-latest}" DEV_IMAGE_NAME="${DEV_IMAGE_NAME:-${IMAGE_NAME}}" DEV_IMAGE_TAG="${DEV_IMAGE_TAG:-${IMAGE_TAG}-dev}" -IMAGE="${IMAGE_NAME}:${IMAGE_TAG}" -DEV_IMAGE="${DEV_IMAGE_NAME}:${DEV_IMAGE_TAG}" -ENABLE_SINGLEARCH_PUSH="${ENABLE_SINGLEARCH_PUSH:-false}" -RMW_IMPLEMENTATION="${RMW_IMPLEMENTATION:-}" -ROS_DISTRO="${ROS_DISTRO:-}" -GIT_HTTPS_SERVER="${GIT_HTTPS_SERVER:-}" -GIT_HTTPS_USER="${GIT_HTTPS_USER:-}" -GIT_HTTPS_PASSWORD="${GIT_HTTPS_PASSWORD:-}" -GIT_SSH_PRIVATE_KEY="${GIT_SSH_PRIVATE_KEY:-}" -GIT_SSH_KNOWN_HOST_KEYS="${GIT_SSH_KNOWN_HOST_KEYS:-}" ADDITIONAL_DEBS_FILE="${ADDITIONAL_DEBS_FILE:-}" -ENABLE_RECURSIVE_ADDITIONAL_DEBS="${ENABLE_RECURSIVE_ADDITIONAL_DEBS:-}" ADDITIONAL_FILES_DIR="${ADDITIONAL_FILES_DIR:-}" ADDITIONAL_PIP_FILE="${ADDITIONAL_PIP_FILE:-}" -ENABLE_RECURSIVE_ADDITIONAL_PIP="${ENABLE_RECURSIVE_ADDITIONAL_PIP:-}" BLACKLISTED_PACKAGES_FILE="${BLACKLISTED_PACKAGES_FILE:-}" -ENABLE_RECURSIVE_BLACKLISTED_PACKAGES="${ENABLE_RECURSIVE_BLACKLISTED_PACKAGES:-}" CUSTOM_SCRIPT_FILE="${CUSTOM_SCRIPT_FILE:-}" +DEV_IMAGE="${DEV_IMAGE_NAME}:${DEV_IMAGE_TAG}" +ENABLE_CONTINUE_BUILD_DESPITE_ERRORS="${ENABLE_CONTINUE_BUILD_DESPITE_ERRORS:-}" +ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS="${ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS:-}" +ENABLE_RECURSIVE_ADDITIONAL_DEBS="${ENABLE_RECURSIVE_ADDITIONAL_DEBS:-}" +ENABLE_RECURSIVE_ADDITIONAL_PIP="${ENABLE_RECURSIVE_ADDITIONAL_PIP:-}" +ENABLE_RECURSIVE_BLACKLISTED_PACKAGES="${ENABLE_RECURSIVE_BLACKLISTED_PACKAGES:-}" ENABLE_RECURSIVE_CUSTOM_SCRIPT="${ENABLE_RECURSIVE_CUSTOM_SCRIPT:-}" -VCS_IMPORT_FILE="${VCS_IMPORT_FILE:-}" ENABLE_RECURSIVE_VCS_IMPORT="${ENABLE_RECURSIVE_VCS_IMPORT:-}" -ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS="${ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS:-}" -ENABLE_CONTINUE_BUILD_DESPITE_ERRORS="${ENABLE_CONTINUE_BUILD_DESPITE_ERRORS:-}" +ENABLE_ROS1_DEVEL_SPACE="${ENABLE_ROS1_DEVEL_SPACE:-}" +ENABLE_SINGLEARCH_PUSH="${ENABLE_SINGLEARCH_PUSH:-false}" +GIT_HTTPS_PASSWORD="${GIT_HTTPS_PASSWORD:-}" +GIT_HTTPS_SERVER="${GIT_HTTPS_SERVER:-}" +GIT_HTTPS_USER="${GIT_HTTPS_USER:-}" +GIT_SSH_KNOWN_HOST_KEYS="${GIT_SSH_KNOWN_HOST_KEYS:-}" +GIT_SSH_PRIVATE_KEY="${GIT_SSH_PRIVATE_KEY:-}" +IMAGE="${IMAGE_NAME}:${IMAGE_TAG}" +RMW_IMPLEMENTATION="${RMW_IMPLEMENTATION:-}" +ROS_DISTRO="${ROS_DISTRO:-}" +VCS_IMPORT_FILE="${VCS_IMPORT_FILE:-}" _ENABLE_IMAGE_PUSH="${_ENABLE_IMAGE_PUSH:-false}" _IMAGE_POSTFIX="${_IMAGE_POSTFIX:-""}" diff --git a/templates/docker-compose.template.yml b/templates/docker-compose.template.yml index 686e7c4..509fc39 100644 --- a/templates/docker-compose.template.yml +++ b/templates/docker-compose.template.yml @@ -17,13 +17,14 @@ x-build: &build BLACKLISTED_PACKAGES_FILE: $BLACKLISTED_PACKAGES_FILE VCS_IMPORT_FILE: $VCS_IMPORT_FILE CUSTOM_SCRIPT_FILE: $CUSTOM_SCRIPT_FILE + ENABLE_CONTINUE_BUILD_DESPITE_ERRORS: $ENABLE_CONTINUE_BUILD_DESPITE_ERRORS + ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS: $ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS ENABLE_RECURSIVE_ADDITIONAL_DEBS: $ENABLE_RECURSIVE_ADDITIONAL_DEBS ENABLE_RECURSIVE_ADDITIONAL_PIP: $ENABLE_RECURSIVE_ADDITIONAL_PIP ENABLE_RECURSIVE_BLACKLISTED_PACKAGES: $ENABLE_RECURSIVE_BLACKLISTED_PACKAGES ENABLE_RECURSIVE_CUSTOM_SCRIPT: $ENABLE_RECURSIVE_CUSTOM_SCRIPT ENABLE_RECURSIVE_VCS_IMPORT: $ENABLE_RECURSIVE_VCS_IMPORT - ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS: $ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS - ENABLE_CONTINUE_BUILD_DESPITE_ERRORS: $ENABLE_CONTINUE_BUILD_DESPITE_ERRORS + ENABLE_ROS1_DEVEL_SPACE: $ENABLE_ROS1_DEVEL_SPACE GIT_HTTPS_PASSWORD: $GIT_HTTPS_PASSWORD GIT_HTTPS_SERVER: $GIT_HTTPS_SERVER GIT_HTTPS_USER: $GIT_HTTPS_USER From bf8b8ce1887fbbee6410ddf0ad44c4c9b7d14398 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Thu, 6 Jun 2024 14:33:48 +0000 Subject: [PATCH 11/15] fix missing github action inputs for new config vars --- action.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 1e4c2fc..18d35f3 100644 --- a/action.yml +++ b/action.yml @@ -132,7 +132,17 @@ inputs: description: "Enable Git LFS support for the checkout action" default: true - # TODO! + enable-continue-build-despite-errors: + description: Enable `catkin build --continue-on-failure` / `colcon build --continue-on-error` + default: false + + enable-continue-rosdep-install-despite-errors: + description: Enable `rosdep install -r` + default: false + + enable-ros1-devel-space: + description: Enable building to ROS devel space instead of install space (ROS 1 only) + default: false runs: From f1d405c79402fb776bb065966cc4de54823f1f57 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Thu, 6 Jun 2024 15:11:11 +0000 Subject: [PATCH 12/15] ignore failures in catkin/colcon build, if arg is set --- docker/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index b3c2870..4dc97a4 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -260,7 +260,7 @@ ARG ENABLE_ROS1_DEVEL_SPACE="false" RUN source /opt/ros/${ROS_DISTRO}/setup.bash && \ if [[ -x "$(command -v colcon)" ]]; then \ if [[ $ENABLE_CONTINUE_BUILD_DESPITE_ERRORS == 'true' ]]; then \ - colcon build --continue-on-error --cmake-args -DCMAKE_BUILD_TYPE=Release ; \ + colcon build --continue-on-error --cmake-args -DCMAKE_BUILD_TYPE=Release || true ; \ else \ colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release ; \ fi ; \ @@ -269,7 +269,7 @@ RUN source /opt/ros/${ROS_DISTRO}/setup.bash && \ catkin config --install --extend /opt/ros/${ROS_DISTRO} ; \ fi && \ if [[ $ENABLE_CONTINUE_BUILD_DESPITE_ERRORS == 'true' ]]; then \ - catkin build -DCMAKE_BUILD_TYPE=Release --force-color --no-status --summarize --continue-on-failure ; \ + catkin build -DCMAKE_BUILD_TYPE=Release --force-color --no-status --summarize --continue-on-failure || true ; \ else \ catkin build -DCMAKE_BUILD_TYPE=Release --force-color --no-status --summarize ; \ fi ; \ From e8e6b177a46835dd57bb6f32c20896bf4571164f Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Thu, 6 Jun 2024 16:30:35 +0000 Subject: [PATCH 13/15] add option to build target=build image containing devel/install and src spaces --- .gitlab-ci/docker-ros.yml | 86 ++++++++++++++++++++++----- README.md | 14 ++++- action.yml | 24 +++++++- docker/Dockerfile | 11 +++- scripts/ci.sh | 5 ++ templates/docker-compose.template.yml | 20 ++++--- 6 files changed, 130 insertions(+), 30 deletions(-) diff --git a/.gitlab-ci/docker-ros.yml b/.gitlab-ci/docker-ros.yml index c1d7f01..194129b 100644 --- a/.gitlab-ci/docker-ros.yml +++ b/.gitlab-ci/docker-ros.yml @@ -15,7 +15,9 @@ variables: BASE_IMAGE: '' # Base image name:tag (required) BLACKLISTED_PACKAGES_FILE: docker/blacklisted-packages.txt # Relative filepath to file containing the blacklisted packages BUILD_CONTEXT: . # Build context of Docker build process - COMMAND: '' # Launch command of run image (required if target=run) + BUILD_IMAGE_NAME: ${IMAGE_NAME} # Image name of build image + BUILD_IMAGE_TAG: ${IMAGE_TAG}-build # Image tag of build image + COMMAND: '' # Launch command of build/run image (required if target=run) CUSTOM_SCRIPT_FILE: docker/custom.sh # Relative filepath to script containing custom installation commands DEV_IMAGE_NAME: ${IMAGE_NAME} # Image name of dev image DEV_IMAGE_TAG: ${IMAGE_TAG}-dev # Image tag of dev image @@ -43,26 +45,33 @@ variables: REGISTRY: ${CI_REGISTRY} # Docker registry to push images to RMW_IMPLEMENTATION: 'rmw_cyclonedds_cpp' # RMW implementation to use (only for ROS 2) ROS_DISTRO: '' # ROS Distro (required if ROS is not installed in `base-image`) - TARGET: run # Target stage of Dockerfile (comma-separated list) [dev|run] + TARGET: run # Target stage of Dockerfile (comma-separated list) [dev|build|run] VCS_IMPORT_FILE: .repos # Relative filepath to file containing additional repos to install via vcstools (only relevant if ENABLE_RECURSIVE_VCS_IMPORT=false) # ----- DOCKER_ROS_GIT_REF: main _RUN_IMAGE: ${IMAGE_NAME}:${IMAGE_TAG} + _BUILD_IMAGE: ${BUILD_IMAGE_NAME}:${BUILD_IMAGE_TAG} _DEV_IMAGE: ${DEV_IMAGE_NAME}:${DEV_IMAGE_TAG} - _IMAGE_DEV_CI: ${_DEV_IMAGE}_${CI_COMMIT_REF_SLUG}_ci - _IMAGE_RUN_CI: ${_RUN_IMAGE}_${CI_COMMIT_REF_SLUG}_ci - _IMAGE_DEV_CI_AMD64: ${_IMAGE_DEV_CI}-amd64 - _IMAGE_DEV_CI_ARM64: ${_IMAGE_DEV_CI}-arm64 - _IMAGE_RUN_CI_AMD64: ${_IMAGE_RUN_CI}-amd64 - _IMAGE_RUN_CI_ARM64: ${_IMAGE_RUN_CI}-arm64 - _IMAGE_DEV_LATEST: ${DEV_IMAGE_NAME}:latest-dev - _IMAGE_RUN_LATEST: ${IMAGE_NAME}:latest - _IMAGE_DEV_TARGET_TAG: ${_DEV_IMAGE}-${CI_COMMIT_TAG} - _IMAGE_RUN_TARGET_TAG: ${_RUN_IMAGE}-${CI_COMMIT_TAG} - _IMAGE_DEV_TAG: ${DEV_IMAGE_NAME}:${CI_COMMIT_TAG}-dev - _IMAGE_RUN_TAG: ${IMAGE_NAME}:${CI_COMMIT_TAG} + _IMAGE_DEV_CI: ${_DEV_IMAGE}_${CI_COMMIT_REF_SLUG}_ci + _IMAGE_BUILD_CI: ${_BUILD_IMAGE}_${CI_COMMIT_REF_SLUG}_ci + _IMAGE_RUN_CI: ${_RUN_IMAGE}_${CI_COMMIT_REF_SLUG}_ci + _IMAGE_DEV_CI_AMD64: ${_IMAGE_DEV_CI}-amd64 + _IMAGE_DEV_CI_ARM64: ${_IMAGE_DEV_CI}-arm64 + _IMAGE_BUILD_CI_AMD64: ${_IMAGE_BUILD_CI}-amd64 + _IMAGE_BUILD_CI_ARM64: ${_IMAGE_BUILD_CI}-arm64 + _IMAGE_RUN_CI_AMD64: ${_IMAGE_RUN_CI}-amd64 + _IMAGE_RUN_CI_ARM64: ${_IMAGE_RUN_CI}-arm64 + _IMAGE_DEV_LATEST: ${DEV_IMAGE_NAME}:latest-dev + _IMAGE_BUILD_LATEST: ${BUILD_IMAGE_NAME}:latest-build + _IMAGE_RUN_LATEST: ${IMAGE_NAME}:latest + _IMAGE_DEV_TARGET_TAG: ${_DEV_IMAGE}-${CI_COMMIT_TAG} + _IMAGE_BUILD_TARGET_TAG: ${_BUILD_IMAGE}-${CI_COMMIT_TAG} + _IMAGE_RUN_TARGET_TAG: ${_RUN_IMAGE}-${CI_COMMIT_TAG} + _IMAGE_DEV_TAG: ${DEV_IMAGE_NAME}:${CI_COMMIT_TAG}-dev + _IMAGE_BUILD_TAG: ${BUILD_IMAGE_NAME}:${CI_COMMIT_TAG}-build + _IMAGE_RUN_TAG: ${IMAGE_NAME}:${CI_COMMIT_TAG} GIT_SUBMODULE_STRATEGY: recursive DOCKER_DRIVER: overlay2 @@ -72,6 +81,7 @@ variables: stages: - Build dev Images + - Build build Images - Build run Images - Test ROS Industrial CI - Push Multi-Arch Images @@ -138,6 +148,31 @@ dev-arm64: ENABLE_SINGLEARCH_PUSH: 'true' _IMAGE_POSTFIX: _${CI_COMMIT_REF_SLUG}_ci +build-amd64: + stage: Build build Images + extends: .build + rules: + - if: $PLATFORM =~ /.*amd64.*/ && $TARGET =~ /.*build.*/ + variables: + _PLATFORM: amd64 + _TARGET: build + IMAGE: ${_IMAGE_BUILD_CI_AMD64} + ENABLE_SINGLEARCH_PUSH: 'true' + _IMAGE_POSTFIX: _${CI_COMMIT_REF_SLUG}_ci + +build-arm64: + stage: Build build Images + extends: .build + tags: [privileged, arm64] + rules: + - if: $PLATFORM =~ /.*arm64.*/ && $TARGET =~ /.*build.*/ + variables: + _PLATFORM: arm64 + _TARGET: build + IMAGE: ${_IMAGE_BUILD_CI_ARM64} + ENABLE_SINGLEARCH_PUSH: 'true' + _IMAGE_POSTFIX: _${CI_COMMIT_REF_SLUG}_ci + run-amd64: stage: Build run Images extends: .build @@ -240,6 +275,10 @@ Test run-arm64: optional: true - job: dev-arm64 optional: true + - job: build-amd64 + optional: true + - job: build-arm64 + optional: true - job: run-amd64 optional: true - job: run-arm64 @@ -262,6 +301,10 @@ Test run-arm64: docker manifest create ${IMG_DEV} --amend ${_IMAGE_DEV_CI_AMD64} --amend ${_IMAGE_DEV_CI_ARM64} docker manifest push ${IMG_DEV} fi + if [[ "${TARGET}" =~ build ]]; then + docker manifest create ${IMG_BUILD} --amend ${_IMAGE_BUILD_CI_AMD64} --amend ${_IMAGE_BUILD_CI_ARM64} + docker manifest push ${IMG_BUILD} + fi if [[ "${TARGET}" =~ run ]]; then docker manifest create ${IMG_RUN} --amend ${_IMAGE_RUN_CI_AMD64} --amend ${_IMAGE_RUN_CI_ARM64} docker manifest push ${IMG_RUN} @@ -272,6 +315,11 @@ Test run-arm64: docker tag ${_IMAGE_DEV_CI_AMD64} ${IMG_DEV} docker push ${IMG_DEV} fi + if [[ "${TARGET}" =~ build ]]; then + docker pull ${_IMAGE_BUILD_CI_AMD64} + docker tag ${_IMAGE_BUILD_CI_AMD64} ${IMG_BUILD} + docker push ${IMG_BUILD} + fi if [[ "${TARGET}" =~ run ]]; then docker pull ${_IMAGE_RUN_CI_AMD64} docker tag ${_IMAGE_RUN_CI_AMD64} ${IMG_RUN} @@ -283,6 +331,11 @@ Test run-arm64: docker tag ${_IMAGE_DEV_CI_ARM64} ${IMG_DEV} docker push ${IMG_DEV} fi + if [[ "${TARGET}" =~ build ]]; then + docker pull ${_IMAGE_BUILD_CI_ARM64} + docker tag ${_IMAGE_BUILD_CI_ARM64} ${IMG_BUILD} + docker push ${IMG_BUILD} + fi if [[ "${TARGET}" =~ run ]]; then docker pull ${_IMAGE_RUN_CI_ARM64} docker tag ${_IMAGE_RUN_CI_ARM64} ${IMG_RUN} @@ -300,6 +353,7 @@ Push CI: - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH variables: IMG_DEV: ${_IMAGE_DEV_CI} + IMG_BUILD: ${_IMAGE_BUILD_CI} IMG_RUN: ${_IMAGE_RUN_CI} Push: @@ -310,6 +364,7 @@ Push: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH variables: IMG_DEV: ${_DEV_IMAGE} + IMG_BUILD: ${_BUILD_IMAGE} IMG_RUN: ${_RUN_IMAGE} Push latest: @@ -320,6 +375,7 @@ Push latest: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $ENABLE_PUSH_AS_LATEST == 'true' variables: IMG_DEV: ${_IMAGE_DEV_LATEST} + IMG_BUILD: ${_IMAGE_BUILD_LATEST} IMG_RUN: ${_IMAGE_RUN_LATEST} Push target tag: @@ -330,6 +386,7 @@ Push target tag: - if: $CI_COMMIT_TAG variables: IMG_DEV: ${_IMAGE_DEV_TARGET_TAG} + IMG_BUILD: ${_IMAGE_BUILD_TARGET_TAG} IMG_RUN: ${_IMAGE_RUN_TARGET_TAG} Push tag: @@ -340,4 +397,5 @@ Push tag: - if: $CI_COMMIT_TAG && $ENABLE_PUSH_AS_LATEST == 'true' variables: IMG_DEV: ${_IMAGE_DEV_TAG} + IMG_BUILD: ${_IMAGE_BUILD_TAG} IMG_RUN: ${_IMAGE_RUN_TAG} diff --git a/README.md b/README.md index d6d522a..59dfc01 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ # *docker-ros* – Automated Containerization of ROS Apps +// TODO: explain build image somewhere +

@@ -355,8 +357,14 @@ Create a folder `additional-files` in your `docker` folder (or configure a diffe - **`build-context` | `BUILD_CONTEXT`** Build context of Docker build process *default:* `${{ github.workspace }}` | `.` +- **`build-image-name` | `BUILD_IMAGE_NAME`** + Image name of build image + *default:* `` +- **`build-image-tag` | `BUILD_IMAGE_TAG`** + Image tag of build image + *default:* `-build` - **`command` | `COMMAND`** - Launch command of run image + Launch command of build/run image *required if `target=run`* - **`custom-script-file` | `CUSTOM_SCRIPT_FILE`** Relative filepath to script containing custom installation commands @@ -389,7 +397,7 @@ Create a folder `additional-files` in your `docker` folder (or configure a diffe Enable [*industrial_ci*](https://github.com/ros-industrial/industrial_ci) *default:* `false` - **`enable-push-as-latest` | `ENABLE_PUSH_AS_LATEST`** - Push images with tag `latest`/`latest-dev` in addition to the configured image names + Push images with tag `latest`/`latest-dev`/`latest-build` in addition to the configured image names *default:* `false` - **`enable-recursive-additional-debs` | `ENABLE_RECURSIVE_ADDITIONAL_DEBS`** Enable recursive discovery of files named `additional-debs-file` @@ -455,7 +463,7 @@ Create a folder `additional-files` in your `docker` folder (or configure a diffe - **`target` | `TARGET`** Target stage of Dockerfile (comma-separated list) *default:* `run` - *supported values:* `dev`, `run` + *supported values:* `dev`, `build`, `run` - **`vcs-import-file` | `VCS_IMPORT_FILE`** Relative filepath to file containing additional repos to install via vcstools (only relevant if `enable-recursive-vcs-import=false`) *default:* `.repos` diff --git a/action.yml b/action.yml index 18d35f3..3cf00ec 100644 --- a/action.yml +++ b/action.yml @@ -4,7 +4,7 @@ description: "docker-ros automatically builds development and deployment Docker inputs: target: - description: "Target stage of Dockerfile (comma-separated list) [dev|run]" + description: "Target stage of Dockerfile (comma-separated list) [dev|build|run]" default: run platform: @@ -15,7 +15,7 @@ inputs: required: true command: - description: "Launch command of run image (required if target=run)" + description: "Launch command of build/run image (required if target=run)" image-name: description: "Image name of run image" @@ -31,6 +31,12 @@ inputs: dev-image-tag: description: "Image tag of dev image" + build-image-name: + description: "Image name of build image" + + build-image-tag: + description: "Image tag of build image" + build-context: description: "Build context of Docker build process" default: ${{ github.workspace }} @@ -117,7 +123,7 @@ inputs: default: false enable-push-as-latest: - description: "Push images with tag `latest`/`latest-dev` in addition to the configured image names" + description: "Push images with tag `latest`/`latest-dev`/`latest-build` in addition to the configured image names" default: false enable-checkout: @@ -196,6 +202,12 @@ runs: with: string: ${{ inputs.dev-image-name }} + - name: Enforce lower-case build image name + id: build-image-name + uses: ASzc/change-string-case-action@v6 + with: + string: ${{ inputs.build-image-name }} + - name: Build images id: build-images shell: bash @@ -207,6 +219,8 @@ runs: ADDITIONAL_PIP_FILE: ${{ inputs.additional-pip-file }} BASE_IMAGE: ${{ inputs.base-image }} BLACKLISTED_PACKAGES_FILE: ${{ inputs.blacklisted-packages-file }} + BUILD_IMAGE_NAME: ${{ steps.build-image-name.outputs.lowercase }} + BUILD_IMAGE_TAG: ${{ inputs.build-image-tag }} COMMAND: ${{ inputs.command }} CUSTOM_SCRIPT_FILE: ${{ inputs.custom-script-file }} DEV_IMAGE_NAME: ${{ steps.dev-image-name.outputs.lowercase }} @@ -267,6 +281,8 @@ runs: ADDITIONAL_PIP_FILE: ${{ inputs.additional-pip-file }} BASE_IMAGE: ${{ inputs.base-image }} BLACKLISTED_PACKAGES_FILE: ${{ inputs.blacklisted-packages-file }} + BUILD_IMAGE_NAME: ${{ steps.build-image-name.outputs.lowercase }} + BUILD_IMAGE_TAG: ${{ inputs.build-image-tag }} COMMAND: ${{ inputs.command }} CUSTOM_SCRIPT_FILE: ${{ inputs.custom-script-file }} DEV_IMAGE_NAME: ${{ inputs.dev-image-name }} @@ -306,6 +322,8 @@ runs: ADDITIONAL_PIP_FILE: ${{ inputs.additional-pip-file }} BASE_IMAGE: ${{ inputs.base-image }} BLACKLISTED_PACKAGES_FILE: ${{ inputs.blacklisted-packages-file }} + BUILD_IMAGE_NAME: ${{ steps.build-image-name.outputs.lowercase }} + BUILD_IMAGE_TAG: ${{ inputs.build-image-tag }} COMMAND: ${{ inputs.command }} CUSTOM_SCRIPT_FILE: ${{ inputs.custom-script-file }} DEV_IMAGE_NAME: ${{ inputs.dev-image-name }} diff --git a/docker/Dockerfile b/docker/Dockerfile index 4dc97a4..835a8cc 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -234,7 +234,9 @@ RUN source /opt/ros/$ROS_DISTRO/setup.bash && \ fi # source ROS -RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> ~/.bashrc +RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> ~/.bashrc && \ + echo "[[ -f $WORKSPACE/devel/setup.bash ]] && source $WORKSPACE/devel/setup.bash" >> ~/.bashrc && \ + echo "[[ -f $WORKSPACE/install/setup.bash ]] && source $WORKSPACE/install/setup.bash" >> ~/.bashrc # set entrypoint ENV TINI_VERSION v0.19.0 @@ -275,14 +277,17 @@ RUN source /opt/ros/${ROS_DISTRO}/setup.bash && \ fi ; \ fi +# setup command +ARG COMMAND=bash +ENV DEFAULT_CMD=${COMMAND} +CMD bash -c "${DEFAULT_CMD}" + ############ run ############################################################### FROM dependencies-install as run # copy ROS install space from build stage COPY --from=build $WORKSPACE/install install RUN ldconfig -RUN echo "[[ -f $WORKSPACE/devel/setup.bash ]] && source $WORKSPACE/devel/setup.bash" >> ~/.bashrc && \ - echo "[[ -f $WORKSPACE/install/setup.bash ]] && source $WORKSPACE/install/setup.bash" >> ~/.bashrc # setup command ARG COMMAND diff --git a/scripts/ci.sh b/scripts/ci.sh index 8c9ad7a..6ae27cb 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh @@ -14,6 +14,8 @@ require_var "BASE_IMAGE" require_var "IMAGE_NAME" IMAGE_TAG="${IMAGE_TAG:-latest}" [[ "${TARGET}" == *"run"* ]] && require_var "COMMAND" +BUILD_IMAGE_NAME="${BUILD_IMAGE_NAME:-${IMAGE_NAME}}" +BUILD_IMAGE_TAG="${BUILD_IMAGE_TAG:-${IMAGE_TAG}-build}" DEV_IMAGE_NAME="${DEV_IMAGE_NAME:-${IMAGE_NAME}}" DEV_IMAGE_TAG="${DEV_IMAGE_TAG:-${IMAGE_TAG}-dev}" @@ -23,6 +25,7 @@ ADDITIONAL_PIP_FILE="${ADDITIONAL_PIP_FILE:-}" BLACKLISTED_PACKAGES_FILE="${BLACKLISTED_PACKAGES_FILE:-}" CUSTOM_SCRIPT_FILE="${CUSTOM_SCRIPT_FILE:-}" DEV_IMAGE="${DEV_IMAGE_NAME}:${DEV_IMAGE_TAG}" +BUILD_IMAGE="${BUILD_IMAGE_NAME}:${BUILD_IMAGE_TAG}" ENABLE_CONTINUE_BUILD_DESPITE_ERRORS="${ENABLE_CONTINUE_BUILD_DESPITE_ERRORS:-}" ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS="${ENABLE_CONTINUE_ROSDEP_INSTALL_DESPITE_ERRORS:-}" ENABLE_RECURSIVE_ADDITIONAL_DEBS="${ENABLE_RECURSIVE_ADDITIONAL_DEBS:-}" @@ -48,6 +51,7 @@ _IMAGE_POSTFIX="${_IMAGE_POSTFIX:-""}" if [[ -n "${GITHUB_ACTIONS}" ]]; then industrial_ci_image="${IMAGE}" [[ "${TARGET}" == *"dev"* ]] && industrial_ci_image="${DEV_IMAGE}" + [[ "${TARGET}" == *"build"* ]] && industrial_ci_image="${BUILD_IMAGE}" [[ -n "${_IMAGE_POSTFIX}" ]] && industrial_ci_image="${industrial_ci_image}${_IMAGE_POSTFIX}" if [[ "${PLATFORM}" != *","* ]]; then industrial_ci_image="${industrial_ci_image}-${PLATFORM}" @@ -73,6 +77,7 @@ for PLATFORM in "${PLATFORMS[@]}"; do open_log_group "Build ${TARGET} image (${PLATFORM})" image="${IMAGE}" [[ "${TARGET}" == "dev" ]] && image="${DEV_IMAGE}" + [[ "${TARGET}" == "build" ]] && image="${BUILD_IMAGE}" [[ -n "${_IMAGE_POSTFIX}" ]] && image="${image}${_IMAGE_POSTFIX}" [[ "${_ENABLE_IMAGE_PUSH}" != "true" || "${ENABLE_SINGLEARCH_PUSH}" == "true" ]] && image="${image}-${PLATFORM}" IMAGE="${image}" build_image diff --git a/templates/docker-compose.template.yml b/templates/docker-compose.template.yml index 509fc39..a623ba5 100644 --- a/templates/docker-compose.template.yml +++ b/templates/docker-compose.template.yml @@ -1,11 +1,12 @@ -x-base-image: &base-image BASE_IMAGE # e.g. rwthika/ros2:humble -x-dev-image: &dev-image DEV_IMAGE # e.g. my-image:latest-dev -x-run-image: &run-image RUN_IMAGE # e.g. my-image:latest -x-command: &command COMMAND # e.g. ros2 run my_pkg my_node +x-base-image: &base-image BASE_IMAGE # e.g. rwthika/ros2:humble +x-dev-image: &dev-image DEV_IMAGE # e.g. my-image:latest-dev +x-build-image: &build-image BUILD_IMAGE # e.g. my-image:latest-build +x-run-image: &run-image RUN_IMAGE # e.g. my-image:latest +x-command: &command COMMAND # e.g. ros2 run my_pkg my_node # ============================================================================== -x-build: &build +x-build-template: &build-template dockerfile: ./docker/docker-ros/docker/Dockerfile context: ../ args: @@ -38,9 +39,14 @@ services: image: *dev-image build: target: dev - <<: *build + <<: *build-template + build: + image: *build-image + build: + target: build + <<: *build-template run: image: *run-image build: target: run - <<: *build \ No newline at end of file + <<: *build-template \ No newline at end of file From b77190f5062a6fe2425b58e450c9036230858187 Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Thu, 6 Jun 2024 18:22:10 +0000 Subject: [PATCH 14/15] fix dependencies of gitlab build jobs --- .gitlab-ci/docker-ros.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitlab-ci/docker-ros.yml b/.gitlab-ci/docker-ros.yml index 194129b..c884016 100644 --- a/.gitlab-ci/docker-ros.yml +++ b/.gitlab-ci/docker-ros.yml @@ -151,6 +151,9 @@ dev-arm64: build-amd64: stage: Build build Images extends: .build + needs: + - job: dev-amd64 + optional: true rules: - if: $PLATFORM =~ /.*amd64.*/ && $TARGET =~ /.*build.*/ variables: @@ -164,6 +167,9 @@ build-arm64: stage: Build build Images extends: .build tags: [privileged, arm64] + needs: + - job: dev-arm64 + optional: true rules: - if: $PLATFORM =~ /.*arm64.*/ && $TARGET =~ /.*build.*/ variables: From 3a1c1b49788ab978ad4bb1e84eb3644edffa1e7f Mon Sep 17 00:00:00 2001 From: Lennart Reiher Date: Thu, 6 Jun 2024 18:33:42 +0000 Subject: [PATCH 15/15] only start run stage after build stage, if present --- .gitlab-ci/docker-ros.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab-ci/docker-ros.yml b/.gitlab-ci/docker-ros.yml index c884016..5b79abf 100644 --- a/.gitlab-ci/docker-ros.yml +++ b/.gitlab-ci/docker-ros.yml @@ -185,6 +185,8 @@ run-amd64: needs: - job: dev-amd64 optional: true + - job: build-amd64 + optional: true rules: - if: $PLATFORM =~ /.*amd64.*/ && $TARGET =~ /.*run.*/ variables: @@ -201,6 +203,8 @@ run-arm64: needs: - job: dev-arm64 optional: true + - job: build-arm64 + optional: true rules: - if: $PLATFORM =~ /.*arm64.*/ && $TARGET =~ /.*run.*/ variables: