From 23a64a7098ee5ff4e5842bcd904286bcb5ee03c9 Mon Sep 17 00:00:00 2001 From: Mehmet Killioglu Date: Tue, 22 Oct 2024 10:53:07 +0200 Subject: [PATCH 1/7] Update versions of the submodules --- Fast-DDS | 2 +- foonathan_memory_vendor | 2 +- rmw_fastrtps | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Fast-DDS b/Fast-DDS index 824cddc..7606b96 160000 --- a/Fast-DDS +++ b/Fast-DDS @@ -1 +1 @@ -Subproject commit 824cddc62c1de2bd261c5ff9e59d6907fcf94144 +Subproject commit 7606b96087a8bcfa7d8fe4434cd5d2d253607dfc diff --git a/foonathan_memory_vendor b/foonathan_memory_vendor index 2ef9fc0..da062db 160000 --- a/foonathan_memory_vendor +++ b/foonathan_memory_vendor @@ -1 +1 @@ -Subproject commit 2ef9fc02d9e5483d719d32b06c4670514b25c62a +Subproject commit da062db05975d24a4b53de5a4122b47f6824997f diff --git a/rmw_fastrtps b/rmw_fastrtps index 8932659..c6efdc9 160000 --- a/rmw_fastrtps +++ b/rmw_fastrtps @@ -1 +1 @@ -Subproject commit 89326591772936baeb87c1ffebc73af30e153f68 +Subproject commit c6efdc9fd47cd50043535a2bff27a5c402728bab From 03747a4ef426cef32329eadf202b717af0e24d04 Mon Sep 17 00:00:00 2001 From: Mehmet Killioglu Date: Tue, 22 Oct 2024 15:02:11 +0200 Subject: [PATCH 2/7] Update build scripts --- .github/workflows/main.yaml | 332 ++++++++---------- Dockerfile.build_env | 2 +- build.sh | 89 ++++- ...-PKCS-11-changes-to-Humble-branch-12.patch | 167 +++++++++ packaging/package.sh | 25 +- 5 files changed, 401 insertions(+), 214 deletions(-) create mode 100644 packaging/module_specific_patches/rmw_fastrtps/0001-Add-PKCS-11-changes-to-Humble-branch-12.patch diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 796f098..fae5cae 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -7,11 +7,6 @@ on: branches: [ humble ] workflow_dispatch: inputs: - push_to_artifactory: - description: 'Push packages to artifactory?' - required: true - default: false - type: boolean push_to_docker: description: 'Push packages to docker image?' required: true @@ -37,147 +32,145 @@ jobs: run: | set -eux mkdir bin - source build.sh - build_image $IMAGE_NAME latest ${{env.ROS_DISTRO}} - - # Run docker build - - name: Run foonathan_memory_vendor docker build - env: - ROS: 1 - IMAGE_NAME: tii_fastdds_builder - PACKAGE_NAME: foonathan_memory_vendor - ROS_DISTRO: ${{env.ROS_DISTRO}} - DEPENDENCIES: "" - run: | - set -eux - source build.sh - build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" - + PLATFORM=linux/amd64 ./build.sh ./bin/ # Run docker build - - name: Run Fast-CDR docker build - env: - ROS: 1 - IMAGE_NAME: tii_fastdds_builder - PACKAGE_NAME: Fast-CDR - ROS_DISTRO: ${{env.ROS_DISTRO}} - DEPENDENCIES: "" - run: | - set -eux - source build.sh - build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" - - - name: Run Fast-DDS docker build - env: - ROS: 1 - IMAGE_NAME: tii_fastdds_builder - PACKAGE_NAME: Fast-DDS - ROS_DISTRO: ${{env.ROS_DISTRO}} - DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \ - ros-${{env.ROS_DISTRO}}-fastcdr" - run: | - set -eux - source build.sh - build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" - - - name: Run rosidl_typesupport_fastrtps/fastrtps_cmake_module docker build - env: - ROS: 1 - IMAGE_NAME: tii_fastdds_builder - PACKAGE_NAME: rosidl_typesupport_fastrtps/fastrtps_cmake_module - ROS_DISTRO: ${{env.ROS_DISTRO}} - DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \ - ros-${{env.ROS_DISTRO}}-fastcdr \ - ros-${{env.ROS_DISTRO}}-fastrtps" - run: | - set -eux - source build.sh - build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" - - - name: Run rosidl_typesupport_fastrtps/rosidl_typesupport_fastrtps_cpp docker build - env: - ROS: 1 - IMAGE_NAME: tii_fastdds_builder - PACKAGE_NAME: rosidl_typesupport_fastrtps/rosidl_typesupport_fastrtps_cpp - ROS_DISTRO: ${{env.ROS_DISTRO}} - DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \ - ros-${{env.ROS_DISTRO}}-fastcdr \ - ros-${{env.ROS_DISTRO}}-fastrtps \ - ros-${{env.ROS_DISTRO}}-fastrtps-cmake-module" - run: | - set -eux - source build.sh - build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" - - - name: Run rosidl_typesupport_fastrtps/rosidl_typesupport_fastrtps_c docker build - env: - ROS: 1 - IMAGE_NAME: tii_fastdds_builder - PACKAGE_NAME: rosidl_typesupport_fastrtps/rosidl_typesupport_fastrtps_c - ROS_DISTRO: ${{env.ROS_DISTRO}} - DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \ - ros-${{env.ROS_DISTRO}}-fastcdr \ - ros-${{env.ROS_DISTRO}}-fastrtps \ - ros-${{env.ROS_DISTRO}}-fastrtps-cmake-module \ - ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-cpp" - run: | - set -eux - source build.sh - build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" - - - name: Run rmw_fastrtps/rmw_fastrtps_shared_cpp docker build - env: - ROS: 1 - IMAGE_NAME: tii_fastdds_builder - PACKAGE_NAME: rmw_fastrtps/rmw_fastrtps_shared_cpp - ROS_DISTRO: ${{env.ROS_DISTRO}} - DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \ - ros-${{env.ROS_DISTRO}}-fastcdr \ - ros-${{env.ROS_DISTRO}}-fastrtps \ - ros-${{env.ROS_DISTRO}}-fastrtps-cmake-module \ - ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-cpp \ - ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-c" - run: | - set -eux - source build.sh - build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" - - - name: Run rmw_fastrtps/rmw_fastrtps_dynamic_cpp docker build - env: - ROS: 1 - IMAGE_NAME: tii_fastdds_builder - PACKAGE_NAME: rmw_fastrtps/rmw_fastrtps_dynamic_cpp - ROS_DISTRO: ${{env.ROS_DISTRO}} - DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \ - ros-${{env.ROS_DISTRO}}-fastcdr \ - ros-${{env.ROS_DISTRO}}-fastrtps \ - ros-${{env.ROS_DISTRO}}-fastrtps-cmake-module \ - ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-cpp \ - ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-c \ - ros-${{env.ROS_DISTRO}}-rmw-fastrtps-shared-cpp" - run: | - set -eux - source build.sh - build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" - - name: Run rmw_fastrtps/rmw_fastrtps_cpp docker build - env: - ROS: 1 - IMAGE_NAME: tii_fastdds_builder - PACKAGE_NAME: rmw_fastrtps/rmw_fastrtps_cpp - ROS_DISTRO: ${{env.ROS_DISTRO}} - DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \ - ros-${{env.ROS_DISTRO}}-fastcdr \ - ros-${{env.ROS_DISTRO}}-fastrtps \ - ros-${{env.ROS_DISTRO}}-fastrtps-cmake-module \ - ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-cpp \ - ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-c \ - ros-${{env.ROS_DISTRO}}-rmw-fastrtps-shared-cpp" - run: | - set -eux - source build.sh - build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" + # - name: Run foonathan_memory_vendor docker build + # env: + # ROS: 1 + # IMAGE_NAME: tii_fastdds_builder + # PACKAGE_NAME: foonathan_memory_vendor + # ROS_DISTRO: ${{env.ROS_DISTRO}} + # DEPENDENCIES: "" + # run: | + # set -eux + # source build.sh + # build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" + + # # Run docker build + # - name: Run Fast-CDR docker build + # env: + # ROS: 1 + # IMAGE_NAME: tii_fastdds_builder + # PACKAGE_NAME: Fast-CDR + # ROS_DISTRO: ${{env.ROS_DISTRO}} + # DEPENDENCIES: "" + # run: | + # set -eux + # source build.sh + # build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" + + # - name: Run Fast-DDS docker build + # env: + # ROS: 1 + # IMAGE_NAME: tii_fastdds_builder + # PACKAGE_NAME: Fast-DDS + # ROS_DISTRO: ${{env.ROS_DISTRO}} + # DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \ + # ros-${{env.ROS_DISTRO}}-fastcdr" + # run: | + # set -eux + # source build.sh + # build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" + + # - name: Run rosidl_typesupport_fastrtps/fastrtps_cmake_module docker build + # env: + # ROS: 1 + # IMAGE_NAME: tii_fastdds_builder + # PACKAGE_NAME: rosidl_typesupport_fastrtps/fastrtps_cmake_module + # ROS_DISTRO: ${{env.ROS_DISTRO}} + # DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \ + # ros-${{env.ROS_DISTRO}}-fastcdr \ + # ros-${{env.ROS_DISTRO}}-fastrtps" + # run: | + # set -eux + # source build.sh + # build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" + + # - name: Run rosidl_typesupport_fastrtps/rosidl_typesupport_fastrtps_cpp docker build + # env: + # ROS: 1 + # IMAGE_NAME: tii_fastdds_builder + # PACKAGE_NAME: rosidl_typesupport_fastrtps/rosidl_typesupport_fastrtps_cpp + # ROS_DISTRO: ${{env.ROS_DISTRO}} + # DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \ + # ros-${{env.ROS_DISTRO}}-fastcdr \ + # ros-${{env.ROS_DISTRO}}-fastrtps \ + # ros-${{env.ROS_DISTRO}}-fastrtps-cmake-module" + # run: | + # set -eux + # source build.sh + # build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" + + # - name: Run rosidl_typesupport_fastrtps/rosidl_typesupport_fastrtps_c docker build + # env: + # ROS: 1 + # IMAGE_NAME: tii_fastdds_builder + # PACKAGE_NAME: rosidl_typesupport_fastrtps/rosidl_typesupport_fastrtps_c + # ROS_DISTRO: ${{env.ROS_DISTRO}} + # DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \ + # ros-${{env.ROS_DISTRO}}-fastcdr \ + # ros-${{env.ROS_DISTRO}}-fastrtps \ + # ros-${{env.ROS_DISTRO}}-fastrtps-cmake-module \ + # ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-cpp" + # run: | + # set -eux + # source build.sh + # build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" + + # - name: Run rmw_fastrtps/rmw_fastrtps_shared_cpp docker build + # env: + # ROS: 1 + # IMAGE_NAME: tii_fastdds_builder + # PACKAGE_NAME: rmw_fastrtps/rmw_fastrtps_shared_cpp + # ROS_DISTRO: ${{env.ROS_DISTRO}} + # DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \ + # ros-${{env.ROS_DISTRO}}-fastcdr \ + # ros-${{env.ROS_DISTRO}}-fastrtps \ + # ros-${{env.ROS_DISTRO}}-fastrtps-cmake-module \ + # ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-cpp \ + # ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-c" + # run: | + # set -eux + # source build.sh + # build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" + + # - name: Run rmw_fastrtps/rmw_fastrtps_dynamic_cpp docker build + # env: + # ROS: 1 + # IMAGE_NAME: tii_fastdds_builder + # PACKAGE_NAME: rmw_fastrtps/rmw_fastrtps_dynamic_cpp + # ROS_DISTRO: ${{env.ROS_DISTRO}} + # DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \ + # ros-${{env.ROS_DISTRO}}-fastcdr \ + # ros-${{env.ROS_DISTRO}}-fastrtps \ + # ros-${{env.ROS_DISTRO}}-fastrtps-cmake-module \ + # ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-cpp \ + # ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-c \ + # ros-${{env.ROS_DISTRO}}-rmw-fastrtps-shared-cpp" + # run: | + # set -eux + # source build.sh + # build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" + # - name: Run rmw_fastrtps/rmw_fastrtps_cpp docker build + # env: + # ROS: 1 + # IMAGE_NAME: tii_fastdds_builder + # PACKAGE_NAME: rmw_fastrtps/rmw_fastrtps_cpp + # ROS_DISTRO: ${{env.ROS_DISTRO}} + # DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \ + # ros-${{env.ROS_DISTRO}}-fastcdr \ + # ros-${{env.ROS_DISTRO}}-fastrtps \ + # ros-${{env.ROS_DISTRO}}-fastrtps-cmake-module \ + # ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-cpp \ + # ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-c \ + # ros-${{env.ROS_DISTRO}}-rmw-fastrtps-shared-cpp" + # run: | + # set -eux + # source build.sh + # build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" - name: Upload build - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: fastdds_debs path: bin/*.deb @@ -189,7 +182,7 @@ jobs: if: (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push_to_docker)) steps: - name: Checkout rmw_fastrtps - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Download builds uses: actions/download-artifact@v2 @@ -201,7 +194,7 @@ jobs: - name: Docker meta id: meta - uses: docker/metadata-action@v3 + uses: docker/metadata-action@v5 with: images: ghcr.io/tiiuae/tii-fastdds-artifacts tags: | @@ -211,62 +204,17 @@ jobs: type=sha - name: Login to GitHub Container Registry - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build px4-sitl-gazebo-artifacts image and push - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5 with: context: . push: true file: ./Dockerfile.deb_packages tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - - artifactory: - runs-on: ubuntu-latest - needs: tii-deb-build - if: (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push_to_artifactory)) - strategy: - matrix: - package: [ - foonathan_memory_vendor, fastcdr, fastrtps, - fastrtps_cmake_module, rosidl_typesupport_fastrtps_c, rosidl_typesupport_fastrtps_cpp, - rmw_fastrtps_cpp, rmw_fastrtps_dynamic_cpp, rmw_fastrtps_shared_cpp - ] - steps: - - name: Download builds - uses: actions/download-artifact@v2 - with: - name: fastdds_debs - path: bin/ - - uses: jfrog/setup-jfrog-cli@v2 - env: - JF_ARTIFACTORY_1: ${{ secrets.ARTIFACTORY_TOKEN }} - - name: Upload to Artifactory - env: - ARTIFACTORY_REPO: ssrc-deb-public-local - DISTRIBUTION: jammy - COMPONENT: fog-sw-sros - ARCHITECTURE: amd64 - BUILD_NAME: fastdds_libraries - CI: true - run: | - set -exu - deb_pkg_name=$(echo ${{ matrix.package }} | tr _ -) - pkg=$(find bin -name "ros-${{env.ROS_DISTRO}}-${deb_pkg_name}_*.deb") - if [ "${pkg}" == "" ]; then echo "ERROR: Package not found."; exit 1; fi - pkg_name=$(basename ${pkg}) - jfrog rt u --deb "$DISTRIBUTION/$COMPONENT/$ARCHITECTURE" \ - --target-props COMMIT="$GITHUB_SHA" \ - --build-name "$BUILD_NAME" \ - --build-number "$GITHUB_SHA" \ - "$pkg" \ - "$ARTIFACTORY_REPO/$pkg_name" - jfrog rt build-publish "$BUILD_NAME" "$GITHUB_SHA" - jfrog rt bpr "$BUILD_NAME" "$GITHUB_SHA" "$ARTIFACTORY_REPO" \ - --status dev \ - --comment "development build" diff --git a/Dockerfile.build_env b/Dockerfile.build_env index d851468..790480a 100644 --- a/Dockerfile.build_env +++ b/Dockerfile.build_env @@ -51,7 +51,7 @@ USER root # ros-${ROS_DISTRO}-foonathan-memory-vendor RUN dpkg -r --force-depends ros-${ROS_DISTRO}-foonathan-memory-vendor -USER builder +# USER builder # RUN /$IMAGE_NAME/packaging/build_deps.sh /$IMAGE_NAME diff --git a/build.sh b/build.sh index f48d814..263d099 100755 --- a/build.sh +++ b/build.sh @@ -1,7 +1,4 @@ -#!/bin/bash -eux - -# set -euxo pipefail -# set -eux +#!/bin/bash -eu output_dir=${1:-./bin/.} @@ -19,23 +16,68 @@ iname=${IMAGE_NAME:=tii_fastdds_builder} iversion=${PACKAGE_VERSION:=latest} +# Determine platform argument +if [ -z "${PLATFORM}" ]; then + platform_arg="--platform linux/amd64" +else + platform_arg="--platform ${PLATFORM}" +fi + function build_image { local iname=${1} local iversion=${2} local ros_distro=${3} docker build \ - --build-arg UID=$(id -u) \ - --build-arg GID=$(id -g) \ + ${platform_arg} \ --build-arg ROS_DISTRO=${ros_distro} \ --build-arg IMAGE_NAME=${iname} \ --pull \ + --progress=plain \ + --output type=docker \ -f Dockerfile.build_env -t "${iname}:${iversion}" . } +function patch_packages { + local patches_dir=$(realpath ${1}) + local target_dir=$(realpath ${2}) + local patched_components=() + + for package_dir in ${patches_dir}/*; do + if [ -d "${package_dir}" ]; then + local package_name=$(basename ${package_dir}) + + if [ -d "${target_dir}/${package_name}" ]; then + echo "Found directory ${package_name} in ${target_dir}. Applying patches..." >&2 + + for patch in ${package_dir}/*.patch; do + pushd ${target_dir}/${package_name} > /dev/null + echo "Applying patch ${patch}" >&2 + git_am_output=$(git am "${patch}" 2>&1) + if [ $? -eq 0 ]; then + echo "${git_am_output}" >&2 + patched_components+=("${package_name}:git_am") + else + echo "${git_am_output}" >&2 + echo "git am failed for ${patch}, aborting git am and applying with patch command" >&2 + git am --abort + patch -p1 < "${patch}" + patched_components+=("${package_name}:patch") + fi + popd > /dev/null + done + else + echo "Directory ${package_name} does not exist in ${target_dir}. Skipping..." >&2 + fi + fi + done + + echo "${patched_components[@]}" +} + function build_package { local iname=${1} local iversion=${2} - local package_path=${3} + local package_path=${3} local package_dependencies=${4:-""} pushd ${package_path} local git_commit_hash=${5:-$(git rev-parse HEAD)} @@ -44,21 +86,40 @@ function build_package { if [ -e packaging/module_specific_files/${package_path} ]; then /bin/cp -rf packaging/module_specific_files/${package_path}/* ${package_path} fi + + if [ -e packaging/module_specific_patches/${package_path} ]; then + # /bin/cp -rf packaging/module_specific_patches/${package_path}/* ${package_path} + for patch in packaging/module_specific_patches/${package_path}/*.patch; do + pushd ${package_path}/.. + pwd + echo "Applying patch ${patch}" + git am "../$patch" + popd + done + fi docker run \ + ${platform_arg} \ --rm \ -v $(pwd)/${package_path}:/${iname}/sources \ -v $(pwd)/packaging:/${iname}/packaging \ - -v $(pwd)/bin:/${iname}/bin \ + -v $(pwd)/${output_dir}:/${iname}/${output_dir} \ ${iname}:${iversion} \ /${iname}/packaging/package.sh \ -b ${build_number} \ -g ${git_commit_hash} \ -v ${git_version_string} \ - -t "${package_dependencies}" + -t "${package_dependencies}" \ + -o ${output_dir} mkdir -p ${output_dir} - /bin/cp -rf ${package_path}/*.deb ${output_dir} - rm -Rf ${package_path}/*.deb + /bin/cp -rf ${package_path}/*deb ${output_dir} + rm -Rf ${package_path}/*deb + + if [ -e packaging/module_specific_patches/${package_path} ]; then + pushd ${package_path} + git reset --hard HEAD~1 + popd + fi } function build_all_packages { @@ -98,6 +159,10 @@ function build_all_packages { # not being sourced? if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then + patched_components=$(patch_packages "packaging/module_specific_patches" ".") build_image ${iname} ${iversion} ${ros_distro} - build_all_packages + build_all_packages + + git submodule foreach git reset --hard + git submodule update --init fi diff --git a/packaging/module_specific_patches/rmw_fastrtps/0001-Add-PKCS-11-changes-to-Humble-branch-12.patch b/packaging/module_specific_patches/rmw_fastrtps/0001-Add-PKCS-11-changes-to-Humble-branch-12.patch new file mode 100644 index 0000000..dc1745c --- /dev/null +++ b/packaging/module_specific_patches/rmw_fastrtps/0001-Add-PKCS-11-changes-to-Humble-branch-12.patch @@ -0,0 +1,167 @@ +From 89326591772936baeb87c1ffebc73af30e153f68 Mon Sep 17 00:00:00 2001 +From: jsantiago-eProsima + <90755661+jsantiago-eProsima@users.noreply.github.com> +Date: Mon, 30 May 2022 13:02:06 +0200 +Subject: [PATCH] Add PKCS#11 changes to Humble branch (#12) + +Signed-off-by: Javier Santiago +--- + rmw_fastrtps_shared_cpp/src/participant.cpp | 124 +++++++++++++++++++- + 1 file changed, 123 insertions(+), 1 deletion(-) + +diff --git a/rmw_fastrtps_shared_cpp/src/participant.cpp b/rmw_fastrtps_shared_cpp/src/participant.cpp +index 1c9ee267a..19f20dbe5 100644 +--- a/rmw_fastrtps_shared_cpp/src/participant.cpp ++++ b/rmw_fastrtps_shared_cpp/src/participant.cpp +@@ -17,6 +17,9 @@ + #include + #include + #include ++#include ++#include ++#include + + #include "fastdds/dds/core/status/StatusMask.hpp" + #include "fastdds/dds/domain/DomainParticipantFactory.hpp" +@@ -33,6 +36,7 @@ + #include "fastdds/rtps/transport/shared_mem/SharedMemTransportDescriptor.h" + + #include "rcpputils/scope_exit.hpp" ++#include "rcpputils/filesystem_helper.hpp" + #include "rcutils/env.h" + #include "rcutils/filesystem.h" + +@@ -46,6 +50,124 @@ + + #include "rmw_dds_common/security.hpp" + ++#if HAVE_SECURITY ++// Processor for security attributes with FILE URI ++bool ++process_file_uri_security_file( ++ const std::string & prefix, const rcpputils::fs::path & full_path, ++ std::string & result) ++{ ++ if (!full_path.is_regular_file()) { ++ return false; ++ } ++ result = prefix + full_path.string(); ++ return true; ++} ++ ++// Processor for security attributes with PKCS#11 URI ++bool ++process_pkcs_uri_security_file( ++ const std::string & /*prefix*/, const rcpputils::fs::path & full_path, ++ std::string & result) ++{ ++ const std::string p11_prefix("pkcs11:"); ++ ++ std::ifstream ifs(full_path.string()); ++ if (!ifs.is_open()) { ++ return false; ++ } ++ if (!(ifs >> result)) { ++ return false; ++ } ++ if (result.find(p11_prefix) != 0) { ++ return false; ++ } ++ ++ return true; ++} ++ ++static ++bool ++get_security_files( ++ const std::string & prefix, const std::string & secure_root, ++ std::unordered_map & result) ++{ ++ using std::placeholders::_1; ++ using std::placeholders::_2; ++ using std::placeholders::_3; ++ using security_file_processor = ++ std::function; ++ using processor_vector = ++ std::vector>; ++ ++ // Key: the security attribute ++ // Value: ordered sequence of pairs. Each pair contains one possible file name ++ // for the attribute and the corresponding processor method ++ // Pairs are ordered by priority: the first one matching is used. ++ const std::unordered_map required_files{ ++ {"IDENTITY_CA", { ++ {"identity_ca.cert.pem", std::bind(process_file_uri_security_file, _1, _2, _3)}, ++ {"identity_ca.cert.p11", std::bind(process_pkcs_uri_security_file, _1, _2, _3)}}}, ++ {"CERTIFICATE", { ++ {"cert.pem", std::bind(process_file_uri_security_file, _1, _2, _3)}, ++ {"cert.p11", std::bind(process_pkcs_uri_security_file, _1, _2, _3)}}}, ++ {"PRIVATE_KEY", { ++ {"key.pem", std::bind(process_file_uri_security_file, _1, _2, _3)}, ++ {"key.p11", std::bind(process_pkcs_uri_security_file, _1, _2, _3)}}}, ++ {"PERMISSIONS_CA", { ++ {"permissions_ca.cert.pem", std::bind(process_file_uri_security_file, _1, _2, _3)}, ++ {"permissions_ca.cert.p11", std::bind(process_pkcs_uri_security_file, _1, _2, _3)}}}, ++ {"GOVERNANCE", { ++ {"governance.p7s", std::bind(process_file_uri_security_file, _1, _2, _3)}}}, ++ {"PERMISSIONS", { ++ {"permissions.p7s", std::bind(process_file_uri_security_file, _1, _2, _3)}}}, ++ }; ++ ++ const std::unordered_map optional_files{ ++ {"CRL", { ++ {"crl.pem", std::bind(process_file_uri_security_file, _1, _2, _3)}}} ++ }; ++ ++ for (const std::pair>> & el : required_files) ++ { ++ std::string attribute_value; ++ bool processed = false; ++ for (auto & proc : el.second) { ++ rcpputils::fs::path full_path(secure_root); ++ full_path /= proc.first; ++ if (proc.second(prefix, full_path, attribute_value)) { ++ processed = true; ++ break; ++ } ++ } ++ if (!processed) { ++ result.clear(); ++ return false; ++ } ++ result[el.first] = attribute_value; ++ } ++ ++ for (const std::pair & el : optional_files) { ++ std::string attribute_value; ++ bool processed = false; ++ for (auto & proc : el.second) { ++ rcpputils::fs::path full_path(secure_root); ++ full_path /= proc.first; ++ if (proc.second(prefix, full_path, attribute_value)) { ++ processed = true; ++ break; ++ } ++ } ++ if (processed) { ++ result[el.first] = attribute_value; ++ } ++ } ++ ++ return true; ++} ++#endif ++ + // Private function to create Participant with QoS + static CustomParticipantInfo * + __create_participant( +@@ -232,7 +354,7 @@ rmw_fastrtps_shared_cpp::create_participant( + // if security_root_path provided, try to find the key and certificate files + #if HAVE_SECURITY + std::unordered_map security_files_paths; +- if (rmw_dds_common::get_security_files( ++ if (get_security_files( + "file://", security_options->security_root_path, security_files_paths)) + { + eprosima::fastrtps::rtps::PropertyPolicy property_policy; diff --git a/packaging/package.sh b/packaging/package.sh index 92b6cf5..6113ba0 100755 --- a/packaging/package.sh +++ b/packaging/package.sh @@ -12,6 +12,7 @@ Params: -d Distribution string in debian changelog. -g Git commit hash. -v Git version string + -o Output dir " exit 0 } @@ -36,8 +37,9 @@ version="" git_commit_hash="" git_version_string="" dependencies="" +output_dir="bin/" -while getopts "hb:d:g:v:t:" opt +while getopts "hb:d:g:v:t:o:" opt do case $opt in h) @@ -58,6 +60,9 @@ do t) check_arg $OPTARG && dependencies=$OPTARG || error_arg $opt ;; + o) + check_arg $OPTARG && output_dir=$OPTARG || error_arg $opt + ;; \?) usage ;; @@ -89,7 +94,6 @@ echo "[INFO] Creating deb package..." version=$(grep "" package.xml | sed 's/[^>]*>\([^<"]*\).*/\1/') echo "[INFO] Version: ${version}." - #title="$version ($(date +%Y-%m-%d))" #cat << EOF_CHANGELOG > CHANGELOG.rst #$title @@ -97,13 +101,14 @@ echo "[INFO] Version: ${version}." #* commit: ${git_commit_hash} #EOF_CHANGELOG -if [ -e ${mod_dir}/bin ]; then +if [ -e ${mod_dir}/${output_dir} ]; then # Install any available debian packages for dependency in ${dependencies[@]}; do - echo "Looking to directory ${mod_dir}/bin/${dependency}_*.deb" - if [ -e ${mod_dir}/bin/${dependency}_*.deb ]; then + echo "Looking to directory ${mod_dir}/${output_dir}/${dependency}_*.deb" + ls -la ${mod_dir}/${output_dir}/${dependency}_*.deb + if [ -e ${mod_dir}/${output_dir}/${dependency}_*.deb ]; then echo "[INFO] Installing $dependency" - sudo dpkg -i ${mod_dir}/bin/${dependency}_*.deb + dpkg -i ${mod_dir}/${output_dir}/${dependency}_*.deb fi done fi @@ -126,17 +131,19 @@ bloom-generate rosdebian --os-name ubuntu --os-version jammy --ros-distro ${ROS_ && fakeroot debian/rules "binary --parallel" || exit 1 echo "[INFO] Clean up." +ls -la ${mod_dir}/sources -rm -rf ${mod_dir}/sources/.obj-x86_64-linux-gnu debian + +rm -rf ${mod_dir}/sources/.obj-* debian if [ -e ${mod_dir}/debian_bak ]; then cp -r debian_bak debian rm -rf debian_bak fi - +ls -la ${mod_dir} echo "[INFO] Move debian packages to volume." -mv ${mod_dir}/*.deb ${mod_dir}/sources +mv ${mod_dir}/*deb ${mod_dir}/sources echo "[INFO] Done." exit 0 From e937eac1615074e077316354b3f90b342eb2fbb0 Mon Sep 17 00:00:00 2001 From: Mehmet Killioglu Date: Tue, 22 Oct 2024 15:22:43 +0200 Subject: [PATCH 3/7] Update build scripts --- .github/workflows/main.yaml | 5 ++++- build.sh | 10 ---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index fae5cae..36529e4 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -32,7 +32,10 @@ jobs: run: | set -eux mkdir bin + git config --global user.email "ci@ci.ci" + git config --global user.name "ci" PLATFORM=linux/amd64 ./build.sh ./bin/ + # Run docker build # - name: Run foonathan_memory_vendor docker build # env: @@ -185,7 +188,7 @@ jobs: uses: actions/checkout@v4 - name: Download builds - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: fastdds_debs path: bin/ diff --git a/build.sh b/build.sh index 263d099..8c236ae 100755 --- a/build.sh +++ b/build.sh @@ -87,16 +87,6 @@ function build_package { /bin/cp -rf packaging/module_specific_files/${package_path}/* ${package_path} fi - if [ -e packaging/module_specific_patches/${package_path} ]; then - # /bin/cp -rf packaging/module_specific_patches/${package_path}/* ${package_path} - for patch in packaging/module_specific_patches/${package_path}/*.patch; do - pushd ${package_path}/.. - pwd - echo "Applying patch ${patch}" - git am "../$patch" - popd - done - fi docker run \ ${platform_arg} \ --rm \ From 65e666f64d9c07ffc3c8fd159a09df5f06b1817c Mon Sep 17 00:00:00 2001 From: Mehmet Killioglu Date: Wed, 23 Oct 2024 08:07:39 +0200 Subject: [PATCH 4/7] Enable multiarch build --- .github/workflows/main.yaml | 202 ++++++++---------------------------- 1 file changed, 45 insertions(+), 157 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 36529e4..6e5033a 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -19,12 +19,20 @@ env: jobs: tii-deb-build: runs-on: ubuntu-latest + strategy: + matrix: + architecture: [amd64, arm64] steps: - name: Checkout rmw_fastrtps - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: submodules: recursive - # Run docker build + + - name: Setup QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: ${{ matrix.platform }} + - name: Run docker builder env: ROS: 1 @@ -34,152 +42,45 @@ jobs: mkdir bin git config --global user.email "ci@ci.ci" git config --global user.name "ci" - PLATFORM=linux/amd64 ./build.sh ./bin/ - - # Run docker build - # - name: Run foonathan_memory_vendor docker build - # env: - # ROS: 1 - # IMAGE_NAME: tii_fastdds_builder - # PACKAGE_NAME: foonathan_memory_vendor - # ROS_DISTRO: ${{env.ROS_DISTRO}} - # DEPENDENCIES: "" - # run: | - # set -eux - # source build.sh - # build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" + PLATFORM=linux/${{ matrix.platform }} ./build.sh ./bin/ - # # Run docker build - # - name: Run Fast-CDR docker build - # env: - # ROS: 1 - # IMAGE_NAME: tii_fastdds_builder - # PACKAGE_NAME: Fast-CDR - # ROS_DISTRO: ${{env.ROS_DISTRO}} - # DEPENDENCIES: "" - # run: | - # set -eux - # source build.sh - # build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" + - uses: docker/setup-buildx-action@v3 - # - name: Run Fast-DDS docker build - # env: - # ROS: 1 - # IMAGE_NAME: tii_fastdds_builder - # PACKAGE_NAME: Fast-DDS - # ROS_DISTRO: ${{env.ROS_DISTRO}} - # DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \ - # ros-${{env.ROS_DISTRO}}-fastcdr" - # run: | - # set -eux - # source build.sh - # build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" - - # - name: Run rosidl_typesupport_fastrtps/fastrtps_cmake_module docker build - # env: - # ROS: 1 - # IMAGE_NAME: tii_fastdds_builder - # PACKAGE_NAME: rosidl_typesupport_fastrtps/fastrtps_cmake_module - # ROS_DISTRO: ${{env.ROS_DISTRO}} - # DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \ - # ros-${{env.ROS_DISTRO}}-fastcdr \ - # ros-${{env.ROS_DISTRO}}-fastrtps" - # run: | - # set -eux - # source build.sh - # build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" - - # - name: Run rosidl_typesupport_fastrtps/rosidl_typesupport_fastrtps_cpp docker build - # env: - # ROS: 1 - # IMAGE_NAME: tii_fastdds_builder - # PACKAGE_NAME: rosidl_typesupport_fastrtps/rosidl_typesupport_fastrtps_cpp - # ROS_DISTRO: ${{env.ROS_DISTRO}} - # DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \ - # ros-${{env.ROS_DISTRO}}-fastcdr \ - # ros-${{env.ROS_DISTRO}}-fastrtps \ - # ros-${{env.ROS_DISTRO}}-fastrtps-cmake-module" - # run: | - # set -eux - # source build.sh - # build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" - - # - name: Run rosidl_typesupport_fastrtps/rosidl_typesupport_fastrtps_c docker build - # env: - # ROS: 1 - # IMAGE_NAME: tii_fastdds_builder - # PACKAGE_NAME: rosidl_typesupport_fastrtps/rosidl_typesupport_fastrtps_c - # ROS_DISTRO: ${{env.ROS_DISTRO}} - # DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \ - # ros-${{env.ROS_DISTRO}}-fastcdr \ - # ros-${{env.ROS_DISTRO}}-fastrtps \ - # ros-${{env.ROS_DISTRO}}-fastrtps-cmake-module \ - # ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-cpp" - # run: | - # set -eux - # source build.sh - # build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/tiiuae/tii-fastdds-artifacts + tags: | + type=ref,event=branch,suffix=-${{ matrix.platform }} + type=ref,event=pr,suffix=-${{ matrix.platform }} + type=semver,pattern={{version}},suffix=-${{ matrix.platform }} + type=sha,suffix=-${{ matrix.platform }} - # - name: Run rmw_fastrtps/rmw_fastrtps_shared_cpp docker build - # env: - # ROS: 1 - # IMAGE_NAME: tii_fastdds_builder - # PACKAGE_NAME: rmw_fastrtps/rmw_fastrtps_shared_cpp - # ROS_DISTRO: ${{env.ROS_DISTRO}} - # DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \ - # ros-${{env.ROS_DISTRO}}-fastcdr \ - # ros-${{env.ROS_DISTRO}}-fastrtps \ - # ros-${{env.ROS_DISTRO}}-fastrtps-cmake-module \ - # ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-cpp \ - # ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-c" - # run: | - # set -eux - # source build.sh - # build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - # - name: Run rmw_fastrtps/rmw_fastrtps_dynamic_cpp docker build - # env: - # ROS: 1 - # IMAGE_NAME: tii_fastdds_builder - # PACKAGE_NAME: rmw_fastrtps/rmw_fastrtps_dynamic_cpp - # ROS_DISTRO: ${{env.ROS_DISTRO}} - # DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \ - # ros-${{env.ROS_DISTRO}}-fastcdr \ - # ros-${{env.ROS_DISTRO}}-fastrtps \ - # ros-${{env.ROS_DISTRO}}-fastrtps-cmake-module \ - # ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-cpp \ - # ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-c \ - # ros-${{env.ROS_DISTRO}}-rmw-fastrtps-shared-cpp" - # run: | - # set -eux - # source build.sh - # build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" - # - name: Run rmw_fastrtps/rmw_fastrtps_cpp docker build - # env: - # ROS: 1 - # IMAGE_NAME: tii_fastdds_builder - # PACKAGE_NAME: rmw_fastrtps/rmw_fastrtps_cpp - # ROS_DISTRO: ${{env.ROS_DISTRO}} - # DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \ - # ros-${{env.ROS_DISTRO}}-fastcdr \ - # ros-${{env.ROS_DISTRO}}-fastrtps \ - # ros-${{env.ROS_DISTRO}}-fastrtps-cmake-module \ - # ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-cpp \ - # ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-c \ - # ros-${{env.ROS_DISTRO}}-rmw-fastrtps-shared-cpp" - # run: | - # set -eux - # source build.sh - # build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES" + - name: Build px4-sitl-gazebo-artifacts image and push + uses: docker/build-push-action@v5 + with: + context: . + push: true + file: ./Dockerfile.deb_packages + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} - name: Upload build uses: actions/upload-artifact@v4 with: - name: fastdds_debs + name: fastdds_debs_${{ matrix.platform }} path: bin/*.deb retention-days: 14 - docker_image: + merge_images: runs-on: ubuntu-latest needs: tii-deb-build if: (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push_to_docker)) @@ -187,25 +88,14 @@ jobs: - name: Checkout rmw_fastrtps uses: actions/checkout@v4 - - name: Download builds - uses: actions/download-artifact@v4 - with: - name: fastdds_debs - path: bin/ - - - uses: docker/setup-buildx-action@v1 - - name: Docker meta id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/tiiuae/tii-fastdds-artifacts tags: | - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} type=sha - + - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: @@ -213,11 +103,9 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build px4-sitl-gazebo-artifacts image and push - uses: docker/build-push-action@v5 - with: - context: . - push: true - file: ./Dockerfile.deb_packages - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + - name: Create combined image + run : | + docker manifest create $(echo "${{ steps.meta.outputs.tags }}" | head -1) \ + $(echo "${{ steps.meta.outputs.tags }}" | head -1)-amd64 \ + $(echo "${{ steps.meta.outputs.tags }}" | head -1)-arm64 + docker manifest push $(echo "${{ steps.meta.outputs.tags }}" | head -1) From ffe32562a70f554838ad8ec680af45ca064bf621 Mon Sep 17 00:00:00 2001 From: Mehmet Killioglu Date: Wed, 23 Oct 2024 08:14:36 +0200 Subject: [PATCH 5/7] Enable multiarch build --- .github/workflows/main.yaml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 6e5033a..e00e9b3 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -20,6 +20,7 @@ jobs: tii-deb-build: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: architecture: [amd64, arm64] steps: @@ -31,9 +32,9 @@ jobs: - name: Setup QEMU uses: docker/setup-qemu-action@v3 with: - platforms: ${{ matrix.platform }} + platforms: ${{ matrix.architecture }} - - name: Run docker builder + - name: Run deb package build env: ROS: 1 IMAGE_NAME: tii_fastdds_builder @@ -42,7 +43,7 @@ jobs: mkdir bin git config --global user.email "ci@ci.ci" git config --global user.name "ci" - PLATFORM=linux/${{ matrix.platform }} ./build.sh ./bin/ + PLATFORM=linux/${{ matrix.architecture }} ./build.sh ./bin/ - uses: docker/setup-buildx-action@v3 @@ -52,10 +53,10 @@ jobs: with: images: ghcr.io/tiiuae/tii-fastdds-artifacts tags: | - type=ref,event=branch,suffix=-${{ matrix.platform }} - type=ref,event=pr,suffix=-${{ matrix.platform }} - type=semver,pattern={{version}},suffix=-${{ matrix.platform }} - type=sha,suffix=-${{ matrix.platform }} + type=ref,event=branch,suffix=-${{ matrix.architecture }} + type=ref,event=pr,suffix=-${{ matrix.architecture }} + type=semver,pattern={{version}},suffix=-${{ matrix.architecture }} + type=sha,suffix=-${{ matrix.architecture }} - name: Login to GitHub Container Registry uses: docker/login-action@v3 @@ -64,11 +65,12 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build px4-sitl-gazebo-artifacts image and push + - name: Build tii-fastdds-artifacts image and push uses: docker/build-push-action@v5 with: context: . push: true + platforms: linux/${{ matrix.architecture }} file: ./Dockerfile.deb_packages tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} @@ -76,7 +78,7 @@ jobs: - name: Upload build uses: actions/upload-artifact@v4 with: - name: fastdds_debs_${{ matrix.platform }} + name: fastdds_debs_${{ matrix.architecture }} path: bin/*.deb retention-days: 14 @@ -105,6 +107,7 @@ jobs: - name: Create combined image run : | + echo "Debug: Tags are ${{ steps.meta.outputs.tags }}" docker manifest create $(echo "${{ steps.meta.outputs.tags }}" | head -1) \ $(echo "${{ steps.meta.outputs.tags }}" | head -1)-amd64 \ $(echo "${{ steps.meta.outputs.tags }}" | head -1)-arm64 From 576dc5ea72c9a96cd6a084a2991e7f142c346653 Mon Sep 17 00:00:00 2001 From: Mehmet Killioglu Date: Wed, 23 Oct 2024 08:26:13 +0200 Subject: [PATCH 6/7] Give required permissions for package write --- .github/workflows/main.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index e00e9b3..48322dd 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -13,6 +13,10 @@ on: default: true type: boolean +permissions: + contents: read + packages: write + env: ROS_DISTRO: humble From 3adf62123e06406ff0a0fe4fe17c48eb7c4e2bbf Mon Sep 17 00:00:00 2001 From: Mehmet Killioglu Date: Wed, 23 Oct 2024 10:44:34 +0200 Subject: [PATCH 7/7] Add readme, fix manifest list issue --- .github/workflows/main.yaml | 3 +++ README.md | 53 +++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 README.md diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 48322dd..ee81068 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -3,6 +3,8 @@ name: humble-build on: push: branches: [ humble ] + paths-ignore: + - 'README.md' pull_request: branches: [ humble ] workflow_dispatch: @@ -78,6 +80,7 @@ jobs: file: ./Dockerfile.deb_packages tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + provenance: false - name: Upload build uses: actions/upload-artifact@v4 diff --git a/README.md b/README.md new file mode 100644 index 0000000..62e9e91 --- /dev/null +++ b/README.md @@ -0,0 +1,53 @@ +# tii-fastdds-builder + + +## Description +This repository builds the required Fast-DDS libraries using `ros:humble-ros-base` baseimage. It has the SECURITY enabled, and has the patch for the PKCS#11. + + +## How to use +### Clone and build the debs locally +Platform selection can be as "linux/amd64" or "linux/arm64". The arm64 build on a amd64 will be executed with qemu. You can find the instructions online about how to enable qemu on your system. + +Make sure to create the bin directory. If the script creates it, it will be owned by root and make the script fail. +```bash +mkdir -p ~/tii-fastdds-builder-ws && cd ~/tii-fastdds-builder-ws +git clone --recurse-submodules https://github.com/tiiuae/tii-fastdds-builder.git +cd tii-fastdds-builder +mkdir bin +PLATFORM=linux/amd64 ./build.sh ./bin/ +``` + +### Copy the deb packages to your local directory +```bash +docker create --name tii-fastdds-builder ghcr.io/tiiuae/tii-fastdds-artifacts:humble +mkdir -p ~/tii-fastdds-builder-ws/bin +docker cp tii-fastdds-builder:/artifacts/. ~/tii-fastdds-builder-ws/bin/ +docker rm tii-fastdds-builder +ls -la ~/tii-fastdds-builder-ws/bin +``` + +Keep in mind that the artifacts include both "deb" packages and "ddeb" debugsymbol messages. If installing with dpkg command, use it as "dpkg -i *.deb". + +### Copy and install deb packages in Dockerfile +Modify the tag name accordingly. The baseimage is given as an example, could be used any that has the ros2 installed. If the ROS2 installation is done later, install the deb packages after the ROS2 installation. +```Dockerfile +FROM ros:humble-ros-base + +RUN mkdir -p /tmp/fastdds_debs +COPY --from=ghcr.io/tiiuae/tii-fastdds-artifacts:humble /artifacts/*.deb /tmp/fastdds_debs/ +RUN dpkg -i /tmp/fastdds_debs/*.deb +``` + +Warning: If you are running an `apt upgrade` operation later, some of the packages might be upgraded to the version in the ROS2 repo. To avoid this, you can pin the packages to the version you have installed. For example, you can pin the Fast-DDS packages as follows: +```Dockerfile +RUN apt-mark hold ros-humble-fastcdr \ + ros-humble-fastrtps \ + ros-humble-rmw-fastrtps-cpp \ + ros-humble-rmw-fastrtps-dynamic-cpp \ + ros-humble-rmw-fastrtps-shared-cpp \ + ros-humble-rosidl-typesupport-fastrtps-c \ + ros-humble-rosidl-typesupport-fastrtps-cpp \ + ros-humble-foonathan-memory-vendor \ + ros-humble-fastrtps-cmake-module +```