Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utilize fog default dds profiles #13

Merged
merged 50 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
984fc5f
add riscv64 build support
jari-hodju Mar 20, 2023
d60183d
fix workflow
jari-hodju Mar 20, 2023
a5789aa
fix workflow
jari-hodju Mar 20, 2023
df62dff
fix entrypoint
jari-hodju Mar 20, 2023
d06c083
amend dockerfile for lib
jari-hodju Mar 20, 2023
6b604cb
fix dockerfile
jari-hodju Mar 20, 2023
31f03b0
amend dockerfile for paths
jari-hodju Mar 20, 2023
1d08b2f
add more env settings
jari-hodju Mar 20, 2023
d2d5c03
add more env settings
jari-hodju Mar 20, 2023
987fbcf
multi-platform improvements
jari-hodju Mar 22, 2023
1c8a535
build with bake
jari-hodju Mar 23, 2023
44d716d
build with bake
jari-hodju Mar 23, 2023
d995b83
build with bake
jari-hodju Mar 23, 2023
696d7c1
build with bake
jari-hodju Mar 23, 2023
b3502bc
build with bake
jari-hodju Mar 23, 2023
b77df69
build with bake
jari-hodju Mar 24, 2023
b639360
build with bake
jari-hodju Mar 24, 2023
f86967d
build with bake
jari-hodju Mar 24, 2023
0edcca5
build with bake
jari-hodju Mar 24, 2023
4abd5a4
add labels to build
jari-hodju Mar 24, 2023
7e515f2
add labels to build
jari-hodju Mar 24, 2023
bb10575
add labels to build
jari-hodju Mar 24, 2023
f1751ac
add labels to build
jari-hodju Mar 24, 2023
2a8df21
add labels to build
jari-hodju Mar 24, 2023
1a17e33
add labels to build
jari-hodju Mar 24, 2023
a6dbfaf
add labels to build
jari-hodju Mar 24, 2023
48c60fb
add labels to build
jari-hodju Mar 24, 2023
6deee3f
add labels to build
jari-hodju Mar 24, 2023
98869c0
add labels to build
jari-hodju Mar 24, 2023
8ae6453
fix ps x flag error
jari-hodju Mar 28, 2023
f0d974c
upgrade base-image
jari-hodju Mar 30, 2023
ad9faaf
remove amd64, make riscv64 variant the default base for multi-arch
joonas-fi May 22, 2023
f7bdce2
docker-bake not required
joonas-fi May 22, 2023
4456f34
revert disable of healthcheck
joonas-fi May 22, 2023
a3aca17
remove commented-out package install
joonas-fi May 22, 2023
92febb8
Dockerfile: move ENTRYPOINT up
joonas-fi May 22, 2023
b6e5ed7
Dockerfile: collapse multiple COPY instructions into one
joonas-fi May 22, 2023
2fbb462
multi-arch build
joonas-fi May 22, 2023
ece0741
Enable multi-arch builds using Yocto SDK
mehmetkillioglu Jun 28, 2023
de6d0e8
Update workflow permissions to push package
mehmetkillioglu Jun 28, 2023
7a4ee6a
Update baseimage
mehmetkillioglu Jul 5, 2023
f58b365
Upgrade run-time base image
jari-hodju Aug 7, 2023
25c4cb1
Utilize fog default dds profiles
Aug 10, 2023
231a0a5
Merge branch 'master' into DP-5623-utilize-default-dds-profiles
maseabunikie Sep 29, 2023
683eca6
This repo still used master as default branch
maseabunikie Sep 29, 2023
29f9d66
fog-ros-baseimage: FastDDS profiles with whitelist
maseabunikie Sep 29, 2023
41aff90
Update actions and remove warnings
maseabunikie Sep 29, 2023
475a469
Merge branch 'master' into DP-5623-utilize-default-dds-profiles
maseabunikie Oct 2, 2023
b1fed37
fog-ros-baseimage: v3.0.0 multiarch
maseabunikie Oct 3, 2023
9ae7ef0
Upgrade baseimage version to v3.0.1
mehmetkillioglu Oct 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -544,4 +544,14 @@ __pycache__/
*_LOCAL_*.txt
*_REMOTE_*.txt

# End of https://www.gitignore.io/api/git
# End of https://www.gitignore.io/api/git

.circleci/
.github/
.git/
.github/
.vscode/
.dockerignore
.gitignore
**Dockerfile
**.Dockerfile
2 changes: 1 addition & 1 deletion .github/workflows/tii-microxrce-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'README.md'
- 'CHANGELOG.md'
pull_request:
branches: [ "main" ]
branches: [ "master" ]
repository_dispatch:
types: [fog-ros-baseimage-update]
workflow_dispatch:
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ option(UAGENT_BUILD_USAGE_EXAMPLES "Build Micro XRCE-DDS Agent built-in usage ex

set(UAGENT_P2P_CLIENT_VERSION 2.2.0 CACHE STRING "Sets Micro XRCE-DDS client version for P2P")
set(UAGENT_P2P_CLIENT_TAG v2.2.0 CACHE STRING "Sets Micro XRCE-DDS client tag for P2P")
set(ignoreMe "${BUILD_TESTING}")

option(UAGENT_BUILD_CI_TESTS "Build CI test cases.")
if(UAGENT_BUILD_CI_TESTS)
Expand Down Expand Up @@ -285,7 +286,6 @@ target_compile_options(${PROJECT_NAME}
$<$<CXX_COMPILER_ID:GNU>:-fstrict-aliasing>
$<$<CXX_COMPILER_ID:GNU>:-Wall>
$<$<CXX_COMPILER_ID:GNU>:-Wextra>
$<$<CXX_COMPILER_ID:GNU>:-Wcast-align>
$<$<CXX_COMPILER_ID:GNU>:-Wshadow>
$<$<CXX_COMPILER_ID:MSVC>:/W4>
$<$<CXX_COMPILER_ID:MSVC>:/wd4700>
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Given dynamically from CI job.
FROM --platform=${BUILDPLATFORM:-linux/amd64} ghcr.io/tiiuae/fog-ros-sdk:sha-6d67ecf-${TARGETARCH:-amd64} AS builder
FROM --platform=${BUILDPLATFORM:-linux/amd64} ghcr.io/tiiuae/fog-ros-sdk:v3.0.1-${TARGETARCH:-amd64} AS builder

# Must be defined another time after "FROM" keyword.
ARG TARGETARCH
Expand All @@ -16,7 +16,7 @@ RUN /packaging/build_colcon_sdk.sh ${TARGETARCH:-amd64}
# ▲ runtime ──┐
# └── build ▼

FROM ghcr.io/tiiuae/fog-ros-baseimage:sha-6d67ecf
FROM ghcr.io/tiiuae/fog-ros-baseimage:v3.0.1

ENTRYPOINT [ "/entrypoint.sh" ]

Expand All @@ -42,4 +42,4 @@ RUN ln -s /usr/local/lib/libmicroxrcedds_agent.so.2.2.0 /usr/local/lib/libmicrox
ENV PATH="/usr/local/bin:$PATH" \
LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"

COPY entrypoint.sh parse_agent_refs.py agent.refs.mustache agent.refs /
COPY entrypoint.sh parse_dds_security_part.py dds_security_part_mustache.xml combine_default_profiles.py agent.refs /
1 change: 0 additions & 1 deletion cmake/common/check_configuration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ function(set_common_compile_options target)
-Wshadow
$<$<COMPILE_LANGUAGE:CXX>:-Wnon-virtual-dtor>
-pedantic
-Wcast-align
-Wunused
$<$<COMPILE_LANGUAGE:CXX>:-Woverloaded-virtual>
-Wconversion
Expand Down
4 changes: 2 additions & 2 deletions cmake/modules/FindTinyXML2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ else()
include(FindPackageHandleStandardArgs)

if(TINYXML2_FROM_SOURCE)
find_package_handle_standard_args(tinyxml2 DEFAULT_MSG TINYXML2_SOURCE_DIR TINYXML2_INCLUDE_DIR)
find_package_handle_standard_args(TinyXML2 DEFAULT_MSG TINYXML2_SOURCE_DIR TINYXML2_INCLUDE_DIR)

mark_as_advanced(TINYXML2_INCLUDE_DIR TINYXML2_SOURCE_DIR)
else()
find_package_handle_standard_args(tinyxml2 DEFAULT_MSG TINYXML2_LIBRARY TINYXML2_INCLUDE_DIR)
find_package_handle_standard_args(TinyXML2 DEFAULT_MSG TINYXML2_LIBRARY TINYXML2_INCLUDE_DIR)

mark_as_advanced(TINYXML2_INCLUDE_DIR TINYXML2_LIBRARY)
endif()
Expand Down
66 changes: 66 additions & 0 deletions combine_default_profiles.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/usr/bin/python3

import sys, os, re
import shutil

agent_refs_path=""
if len(sys.argv) > 1:
agent_refs_path=sys.argv[1]

dds_security_part_file = os.path.join(agent_refs_path, "dds_security_part.xml")
default_profiles_file = os.path.join(agent_refs_path, "default_profiles.xml")
agent_refs_tmp_file = os.path.join(agent_refs_path, "agent.refs.tmp")
agent_refs_file = os.path.join(agent_refs_path, "agent.refs")

def cleanup_temporary_files():
# cleanup
if os.path.exists(agent_refs_tmp_file):
os.remove(agent_refs_tmp_file)
if os.path.exists(default_profiles_file):
os.remove(default_profiles_file)
if os.path.exists(dds_security_part_file):
os.remove(dds_security_part_file)

sec_part_data = ""
add_sec_part = False
if os.path.exists(dds_security_part_file):
add_sec_part = True
with open(dds_security_part_file, "r") as f:
sec_part_data = f.read()
else:
print("No ROS2 security additions found for default profiles")

### Combine original profiles data to agent.refs
keep_config = True
with open(default_profiles_file, "r") as in_f:
with open(agent_refs_tmp_file, "w") as out_f:
for line in in_f.readlines():
line_str = line.strip()

# Replace participant profile name
if line_str.startswith("<participant profile_name="):
line = re.sub(
'<participant profile_name="\S+"',
'<participant profile_name="default_xrce_participant"',
line)

# Remove data_reader and data_writer configs
# as they conflicts with xrce client side configs
if line_str.startswith("<data_writer") or line_str.startswith("<data_reader"):
keep_config = False

if keep_config:
out_f.write(line)
if add_sec_part and line_str.startswith("<rtps>"):
out_f.write(sec_part_data)

if line_str.startswith("</data_writer") or line_str.startswith("</data_reader"):
keep_config = True

# Replace original agent.refs with generated one
if os.path.exists(agent_refs_tmp_file):
if os.path.exists(agent_refs_file):
os.remove(agent_refs_file)
shutil.copyfile(agent_refs_tmp_file, agent_refs_file)

cleanup_temporary_files()
8 changes: 0 additions & 8 deletions agent.refs.mustache → dds_security_part_mustache.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
<profiles>
<participant profile_name="default_xrce_participant">
<domainId>0</domainId>
<rtps>
<name>default_xrce_participant</name>
<propertiesPolicy>
<properties>
<!-- Activate DDS:Auth:PKI-DH plugin -->
Expand Down Expand Up @@ -58,6 +53,3 @@
</property>
</properties>
</propertiesPolicy>
</rtps>
</participant>
</profiles>
14 changes: 11 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
#!/bin/bash -e

unset FASTRTPS_DEFAULT_PROFILES_FILE

./parse_agent_refs.py
if [ "$FASTRTPS_DEFAULT_PROFILES_FILE" != "" ]; then
cp $FASTRTPS_DEFAULT_PROFILES_FILE /default_profiles.xml
else
cp agent.refs default_profiles.xml
fi

/parse_dds_security_part.py
/combine_default_profiles.py

unset FASTRTPS_DEFAULT_PROFILES_FILE

_term() {
# FILL UP PROCESS SEARCH PATTERN HERE TO FIND PROPER PROCESS FOR SIGINT:
pattern="MicroXRCEAgent"

pid_value="$(ps -ax | grep $pattern | grep -v grep | awk '{ print $1 }')"
pid_value="$(ps -e | grep $pattern | grep -v grep | awk '{ print $1 }')"
if [ "$pid_value" != "" ]; then
pid=$pid_value
echo "Send SIGINT to pid $pid"
Expand Down
24 changes: 12 additions & 12 deletions parse_agent_refs.py → parse_dds_security_part.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import sys, os
import pystache

agent_refs_path=""
dds_security_part_path=""
if len(sys.argv) > 1:
agent_refs_path=sys.argv[1]
dds_security_part_path=sys.argv[1]

env_keystore = os.environ.get("ROS_SECURITY_KEYSTORE")
env_enclave_override = os.environ.get("ROS_SECURITY_ENCLAVE_OVERRIDE")
Expand Down Expand Up @@ -36,17 +36,17 @@
with open(key_path, "r") as f:
key = f.read().rstrip()

agent_refs_must_file = os.path.join(agent_refs_path, "agent.refs.mustache")
with open(agent_refs_must_file, "r") as f:
dds_security_part_must_file = os.path.join(dds_security_part_path, "dds_security_part_mustache.xml")
with open(dds_security_part_must_file, "r") as f:
tmpl = f.read()

agent_refs_data = pystache.render(tmpl, {'enclave_path': enclave_path, 'key_p11': key })
dds_security_part_data = pystache.render(tmpl, {'enclave_path': enclave_path, 'key_p11': key })

# Remove original agent.refs
agent_refs_file = os.path.join(agent_refs_path, "agent.refs")
if os.path.exists(agent_refs_file):
os.remove(agent_refs_file)
# Remove old dds_security_part.xml if exists
dds_security_part_file = os.path.join(dds_security_part_path, "dds_security_part.xml")
if os.path.exists(dds_security_part_file):
os.remove(dds_security_part_file)

# Write new agent.refs with sros params
with open(agent_refs_file, 'w') as f:
f.write(agent_refs_data)
# Write new dds_security_part.xml with sros params for combining
with open(dds_security_part_file, 'w') as f:
f.write(dds_security_part_data)