From a087cd8af87b542b70b080cb330c0c696ecb18b8 Mon Sep 17 00:00:00 2001 From: Eddy Zhou Date: Fri, 23 Feb 2024 16:48:57 +0000 Subject: [PATCH 01/14] moved -dev to the config as MODE_OF_OPERATION --- watod | 70 +++++++------------------------- watod-config.sh | 12 ++++-- watod_scripts/watod-setup-env.sh | 23 ++++++----- 3 files changed, 35 insertions(+), 70 deletions(-) diff --git a/watod b/watod index f81630da..ec3a3824 100755 --- a/watod +++ b/watod @@ -8,13 +8,8 @@ ANSIBLE_TMP_DIR=/tmp/ansible-tmp-$USER function usage { echo "Usage: $programname [OPTIONS]... [COMMAND]..." - echo "Executes docker compose COMMAND in the the monorepo with appropriate environment variables." - echo " launch_autonomous launch the can_interface for autonomous mode" - echo " -dev --devel configures containers for development (allows you to edit inside a container)" + echo "Executes \"docker compose COMMAND\" in the the monorepo with appropriate environment variables." echo " -v --verbose verbose mode. Currently, prints .env variables" - echo " -lp --local-ports displays ports exposed by applications and shows the" - echo " ssh local port forwarding commands for each VNC Server found" - echo " if a docker compose command is specified, it will be run in the background." echo " -t --terminal [service_name] open a bash terminal into the desired service (eg: perception)." echo "" echo "Examples:" @@ -53,18 +48,10 @@ COMPOSE_CMD="" while [[ $# -gt 0 ]] ; do key="$1" case $key in - -dev|--devel) - DEVEL=1 - shift - ;; -v|--verbose) VERBOSE=1 shift # past argument ;; - -lp|--local-ports) - PRINT_LOCAL_PORTS=1 - shift - ;; -t|--terminal) START_TERMINAL=1 shift @@ -88,10 +75,19 @@ if [[ $# -gt 0 ]]; then COMPOSE_CMD="${COMPOSE_CMD} $@" fi -if [ ! -z $DEVEL ]; then - echo "DEVELOPER MODE ACTIVATED: Source files have been mounted within /home/bolty when you enter the container" - MODULES_DIR="$MONO_DIR/modules/dev_overrides" - export MODULES_DIR_EXP="$MODULES_DIR" +# Allow for local overrides of any of the below parameters +if [ -f "$MONO_DIR/watod-config.sh" ]; then + source "$MONO_DIR/watod-config.sh" +fi + +# Change docker-compose override according to mode of operation +MODE_OF_OPERATION=${MODE_OF_OPERATION:-"deploy"} +if [ $MODE_OF_OPERATION == "deploy" ]; then + MODULES_DIR="$MONO_DIR/modules" +elif [ $MODE_OF_OPERATION == "develop" ]; then + MODULES_DIR="$MONO_DIR/modules/dev_overrides" +else + MODULES_DIR="$MONO_DIR/modules" fi # generate .env file from watod_scripts/watod-setup-env.sh @@ -101,44 +97,6 @@ else cd $MONO_DIR && bash watod_scripts/watod-setup-env.sh &> /dev/null fi -if [ ! -z $PRINT_LOCAL_PORTS ]; then - # get list of services to traverse - SERVICE_LIST="$(run_compose ps --services | sort)" - - # fixes hostnames for VMs so that by default $HOSTNAME is the first element - # in the array, which often is the domain name that can be accessed - # externally - read -ra HOSTNAME <<< $(hostname -A) - echo "=========================================================================" - echo "Ports exposed by running containers:" - echo "=========================================================================" - LOCAL_FORWARD_ALL="" - - PORTS_STRING="" - for SERVICE in $SERVICE_LIST; do - ENV_VARS="$(run_compose exec "$SERVICE" env || true)" - VNC_PORT=$(echo "$ENV_VARS" | grep ^VNC_PORT= | cut -d '=' -f2) - VNC_PORT=${VNC_PORT:0:5} # Strip unncessary characters - - if [ ! -z $VNC_PORT ]; then - echo "$SERVICE service exposes a VNC Server at $HOSTNAME:$VNC_PORT" - - LOCAL_FORWARD="-L ${VNC_PORT}:localhost:${VNC_PORT}" - LOCAL_FORWARD_ALL="${LOCAL_FORWARD_ALL} $LOCAL_FORWARD" - PORTS_STRING="${PORTS_STRING},${VNC_PORT}:${SERVICE}_VNC" - echo " To forward it locally, run" - echo " ssh$LOCAL_FORWARD $USER@$HOSTNAME" - echo " on your local machine attach to VNC at localhost:${VNC_PORT}" - echo - fi - done - - echo "=========================================================================" - echo "To forward all ports locally:" - echo "ssh $LOCAL_FORWARD_ALL $USER@$HOSTNAME" - echo "=========================================================================" -fi - if [ ! -z "$COMPOSE_CMD" ]; then ADDITIONAL_ARGS="" # If we are starting a terminal, run docker compose up with the -d argument diff --git a/watod-config.sh b/watod-config.sh index 637c1624..931bccda 100755 --- a/watod-config.sh +++ b/watod-config.sh @@ -2,8 +2,6 @@ ############################ ACTIVE MODULE CONFIGURATION ############################ ## List of active modules to run, defined in docker-compose.yaml. -## -## List of active modules to run, defined in docker-compose.yaml. ## Possible values: ## - infrastructure : starts visualization tools (foxglove and/or vnc and/or data_stream) ## - perception : starts perception nodes @@ -14,7 +12,15 @@ # ACTIVE_MODULES="" -############################## OPTIONAL CONFIGURATIONS ############################## +################################# MODE OF OPERATION ################################# +## Possible modes of operation when running watod. +## Possible values: +## - deploy (default) : runs production-grade containers (non-editable) +## - develop : runs developer containers (editable) + +# MODE_OF_OPERATION="" + +############################## ADVANCED CONFIGURATIONS ############################## ## Name to append to docker containers. DEFAULT = "" # COMPOSE_PROJECT_NAME="" diff --git a/watod_scripts/watod-setup-env.sh b/watod_scripts/watod-setup-env.sh index 383b763c..9aa23304 100755 --- a/watod_scripts/watod-setup-env.sh +++ b/watod_scripts/watod-setup-env.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -e # This script generates a .env file to be used with docker-compose # To override any of the variables in this script, create watod-config.sh @@ -14,17 +15,22 @@ MONO_DIR="$(dirname "$(realpath "$0")")" # moves us one level out to the root monorepo directory MONO_DIR=${MONO_DIR%/*} -if [ ! -z $MODULES_DIR_EXP ]; then - MODULES_DIR="$MODULES_DIR_EXP" -else - MODULES_DIR="$MONO_DIR/modules" -fi - # Allow for local overrides of any of the below parameters if [ -f "$MONO_DIR/watod-config.sh" ]; then source "$MONO_DIR/watod-config.sh" fi +# Change docker-compose override according to mode of operation +MODE_OF_OPERATION=${MODE_OF_OPERATION:-"deploy"} +if [ $MODE_OF_OPERATION == "deploy" ]; then + MODULES_DIR="$MONO_DIR/modules" +elif [ $MODE_OF_OPERATION == "develop" ]; then + MODULES_DIR="$MONO_DIR/modules/dev_overrides" +else + MODULES_DIR="$MONO_DIR/modules" +fi + +# Retrieve git branch if ! [ -x "$(command -v git)" ]; then echo 'Error: git is not installed.' >&2 else @@ -41,11 +47,6 @@ TAG=$(echo ${TAG:-$BRANCH} | tr / -) # replace / with - TAG=${TAG/\//-} -# Happens during CI, we use the TAG from CI -if [ ! -z $MODULES_DIR_EXP ]; then - TAG="build_$TAG" -fi - # List of active modules to run, defined in docker-compose.yaml. # Possible values: # - infrastructure : starts visualization tools (foxglove and/or vnc) From b23fcda7f8379c836247daa818d5d5c51b3b63ef Mon Sep 17 00:00:00 2001 From: Eddy Zhou Date: Fri, 23 Feb 2024 17:05:21 +0000 Subject: [PATCH 02/14] caching oddities --- .github/workflows/build_and_unitest.yml | 4 +-- docs/dev/how_to_dev.md | 2 +- modules/docker-compose.action.yaml | 16 +++++------ modules/docker-compose.infrastructure.yaml | 12 ++++---- modules/docker-compose.interfacing.yaml | 8 +++--- modules/docker-compose.perception.yaml | 32 +++++++++++----------- modules/docker-compose.samples.yaml | 27 ++++++++++-------- modules/docker-compose.simulation.yaml | 4 +-- modules/docker-compose.world_modeling.yaml | 20 +++++++------- watod | 4 +-- watod-config.sh | 4 +-- watod_scripts/watod-setup-env.sh | 19 +------------ 12 files changed, 68 insertions(+), 84 deletions(-) diff --git a/.github/workflows/build_and_unitest.yml b/.github/workflows/build_and_unitest.yml index 12ef538c..649e378a 100644 --- a/.github/workflows/build_and_unitest.yml +++ b/.github/workflows/build_and_unitest.yml @@ -124,9 +124,7 @@ jobs: ${{ steps.construct-registry-url.outputs.url }}:${{ env.SOURCE_BRANCH }} cache-from: | ${{ steps.construct-registry-url.outputs.url }}:build_${{ env.SOURCE_BRANCH }} - ${{ steps.construct-registry-url.outputs.url }}:${{ env.SOURCE_BRANCH }} - ${{ steps.construct-registry-url.outputs.url }}:${{ env.TARGET_BRANCH }} - cache-to: type=inline + ${{ steps.construct-registry-url.outputs.url }}:build_${{ env.TARGET_BRANCH }} builder: ${{ steps.buildx.outputs.name }} target: deploy diff --git a/docs/dev/how_to_dev.md b/docs/dev/how_to_dev.md index 409c5ae2..0719e966 100644 --- a/docs/dev/how_to_dev.md +++ b/docs/dev/how_to_dev.md @@ -92,7 +92,7 @@ services: - "${SAMPLES_CPP_AGGREGATOR_IMAGE:?}-${CACHE_FROM_TAG}" - "${SAMPLES_CPP_AGGREGATOR_IMAGE:?}-develop" # name of the image made by the dockerfile (boilerplate, but with name change) - image: "${SAMPLES_CPP_AGGREGATOR_IMAGE:?}-${TAG}" + image: "${SAMPLES_CPP_AGGREGATOR_IMAGE:?}-build_${TAG}" # deals with permission and ownership in the container (boilerplate) user: ${FIXUID:?}:${FIXGID:?} # IMPORTANT: mounts your ROS2 node into the container so that changes in the dockerfile are reflected in your diff --git a/modules/docker-compose.action.yaml b/modules/docker-compose.action.yaml index ab4743dd..ab73667e 100644 --- a/modules/docker-compose.action.yaml +++ b/modules/docker-compose.action.yaml @@ -6,8 +6,8 @@ services: context: .. dockerfile: docker/action/global_planning/global_planning.Dockerfile cache_from: - - "${ACTION_GLOBAL_PLANNING_IMAGE}:${TAG}" - - "${ACTION_GLOBAL_PLANNING_IMAGE}:main" + - "${ACTION_GLOBAL_PLANNING_IMAGE}:build_${TAG}" + - "${ACTION_GLOBAL_PLANNING_IMAGE}:build_main" target: deploy image: "${ACTION_GLOBAL_PLANNING_IMAGE}:${TAG}" command: /bin/bash -c "ros2 launch global_planning global_planning.launch.py" @@ -17,8 +17,8 @@ services: context: .. dockerfile: docker/action/behaviour_planning/behaviour_planning.Dockerfile cache_from: - - "${ACTION_BEHAVIOUR_PLANNING_IMAGE}:${TAG}" - - "${ACTION_BEHAVIOUR_PLANNING_IMAGE}:main" + - "${ACTION_BEHAVIOUR_PLANNING_IMAGE}:build_${TAG}" + - "${ACTION_BEHAVIOUR_PLANNING_IMAGE}:build_main" target: deploy image: "${ACTION_BEHAVIOUR_PLANNING_IMAGE}:${TAG}" command: /bin/bash -c "ros2 launch behaviour_planning behaviour_planning.launch.py" @@ -28,8 +28,8 @@ services: context: .. dockerfile: docker/action/local_planning/local_planning.Dockerfile cache_from: - - "${ACTION_LOCAL_PLANNING_IMAGE}:${TAG}" - - "${ACTION_LOCAL_PLANNING_IMAGE}:main" + - "${ACTION_LOCAL_PLANNING_IMAGE}:build_${TAG}" + - "${ACTION_LOCAL_PLANNING_IMAGE}:build_main" target: deploy image: "${ACTION_LOCAL_PLANNING_IMAGE}:${TAG}" command: /bin/bash -c "ros2 launch local_planning local_planning.launch.py" @@ -39,8 +39,8 @@ services: context: .. dockerfile: docker/action/model_predictive_control/model_predictive_control.Dockerfile cache_from: - - "${ACTION_MPC_IMAGE}:${TAG}" - - "${ACTION_MPC_IMAGE}:main" + - "${ACTION_MPC_IMAGE}:build_${TAG}" + - "${ACTION_MPC_IMAGE}:build_main" target: deploy image: "${ACTION_MPC_IMAGE}:${TAG}" command: /bin/bash -c "ros2 launch model_predictive_control model_predictive_control.launch.py" diff --git a/modules/docker-compose.infrastructure.yaml b/modules/docker-compose.infrastructure.yaml index e8db67b9..32935fdb 100644 --- a/modules/docker-compose.infrastructure.yaml +++ b/modules/docker-compose.infrastructure.yaml @@ -6,8 +6,8 @@ services: context: .. dockerfile: docker/infrastructure/foxglove/foxglove.Dockerfile cache_from: - - "${INFRASTRUCTURE_FOXGLOVE_IMAGE:?}:${TAG}" - - "${INFRASTRUCTURE_FOXGLOVE_IMAGE:?}:main" + - "${INFRASTRUCTURE_FOXGLOVE_IMAGE:?}:build_build_${TAG}" + - "${INFRASTRUCTURE_FOXGLOVE_IMAGE:?}:build_main" target: deploy image: "${INFRASTRUCTURE_FOXGLOVE_IMAGE:?}:${TAG}" # command: ["ros2", "launch", "foxglove_bridge", "foxglove_bridge_launch.xml", "port:=${FOXGLOVE_BRIDGE_PORT:?}"] @@ -20,8 +20,8 @@ services: # context: .. # dockerfile: docker/infrastructure/vnc/vnc.Dockerfile # cache_from: - # - "${INFRASTRUCTURE_VIS_TOOLS_VNC_IMAGE:?}:${TAG}" - # - "${INFRASTRUCTURE_VIS_TOOLS_VNC_IMAGE:?}:main" + # - "${INFRASTRUCTURE_VIS_TOOLS_VNC_IMAGE:?}:build_${TAG}" + # - "${INFRASTRUCTURE_VIS_TOOLS_VNC_IMAGE:?}:build_main" # image: "${INFRASTRUCTURE_VIS_TOOLS_VNC_IMAGE:?}:${TAG}" # ports: # - "${GUI_TOOLS_VNC_PORT:?}:5900" @@ -33,8 +33,8 @@ services: context: .. dockerfile: docker/infrastructure/data_stream/data_stream.Dockerfile cache_from: - - "${INFRASTRUCTURE_DATA_STREAM_IMAGE:?}:${TAG}" - - "${INFRASTRUCTURE_DATA_STREAM_IMAGE:?}:main" + - "${INFRASTRUCTURE_DATA_STREAM_IMAGE:?}:build_${TAG}" + - "${INFRASTRUCTURE_DATA_STREAM_IMAGE:?}:build_main" target: deploy image: "${INFRASTRUCTURE_DATA_STREAM_IMAGE:?}:${TAG}" volumes: diff --git a/modules/docker-compose.interfacing.yaml b/modules/docker-compose.interfacing.yaml index 0024ef07..51c39102 100644 --- a/modules/docker-compose.interfacing.yaml +++ b/modules/docker-compose.interfacing.yaml @@ -6,8 +6,8 @@ services: context: .. dockerfile: docker/interfacing/sensor_interfacing/sensor_interfacing.Dockerfile cache_from: - - "${INTERFACING_SENSOR_IMAGE}:${TAG}" - - "${INTERFACING_SENSOR_IMAGE}:main" + - "${INTERFACING_SENSOR_IMAGE}:build_${TAG}" + - "${INTERFACING_SENSOR_IMAGE}:build_main" target: deploy image: "${INTERFACING_SENSOR_IMAGE}:${TAG}" command: /bin/bash -c "ros2 launch sensor_interfacing sensor_interfacing.launch.py" @@ -17,8 +17,8 @@ services: context: .. dockerfile: docker/interfacing/can_interfacing/can_interfacing.Dockerfile cache_from: - - "${INTERFACING_CAN_IMAGE}:${TAG}" - - "${INTERFACING_CAN_IMAGE}:main" + - "${INTERFACING_CAN_IMAGE}:build_${TAG}" + - "${INTERFACING_CAN_IMAGE}:build_main" target: deploy image: "${INTERFACING_CAN_IMAGE}:${TAG}" command: /bin/bash -c "ros2 launch can_interfacing can_interfacing.launch.py" diff --git a/modules/docker-compose.perception.yaml b/modules/docker-compose.perception.yaml index 1651d739..2923c8f3 100644 --- a/modules/docker-compose.perception.yaml +++ b/modules/docker-compose.perception.yaml @@ -6,8 +6,8 @@ services: context: .. dockerfile: docker/perception/radar_object_detection/radar_object_detection.Dockerfile cache_from: - - "${PERCEPTION_RADAR_OBJECT_DETECTION_IMAGE:?}:${TAG}" - - "${PERCEPTION_RADAR_OBJECT_DETECTION_IMAGE:?}:main" + - "${PERCEPTION_RADAR_OBJECT_DETECTION_IMAGE:?}:build_${TAG}" + - "${PERCEPTION_RADAR_OBJECT_DETECTION_IMAGE:?}:build_main" target: deploy image: "${PERCEPTION_RADAR_OBJECT_DETECTION_IMAGE:?}:${TAG}" command: /bin/bash -c "ros2 launch radar_object_detection radar_object_detection.launch.py" @@ -17,8 +17,8 @@ services: context: .. dockerfile: docker/perception/camera_object_detection/camera_object_detection.Dockerfile cache_from: - - "${PERCEPTION_CAMERA_OBJECT_DETECTION_IMAGE:?}:${TAG}" - - "${PERCEPTION_CAMERA_OBJECT_DETECTION_IMAGE:?}:main" + - "${PERCEPTION_CAMERA_OBJECT_DETECTION_IMAGE:?}:build_${TAG}" + - "${PERCEPTION_CAMERA_OBJECT_DETECTION_IMAGE:?}:build_main" target: deploy image: "${PERCEPTION_CAMERA_OBJECT_DETECTION_IMAGE:?}:${TAG}" deploy: @@ -37,8 +37,8 @@ services: context: .. dockerfile: docker/perception/lidar_object_detection/lidar_object_detection.Dockerfile cache_from: - - "${PERCEPTION_LIDAR_OBJECT_DETECTION_IMAGE}:${TAG}" - - "${PERCEPTION_LIDAR_OBJECT_DETECTION_IMAGE}:main" + - "${PERCEPTION_LIDAR_OBJECT_DETECTION_IMAGE}:build_${TAG}" + - "${PERCEPTION_LIDAR_OBJECT_DETECTION_IMAGE}:build_main" target: deploy image: "${PERCEPTION_LIDAR_OBJECT_DETECTION_IMAGE}:${TAG}" command: /bin/bash -c "ros2 launch lidar_object_detection lidar_object_detection.launch.py" @@ -47,8 +47,8 @@ services: context: .. dockerfile: docker/perception/traffic_light_detection/traffic_light_detection.Dockerfile cache_from: - - "${PERCEPTION_TRAFFIC_LIGHT_DETECTION_IMAGE}:${TAG}" - - "${PERCEPTION_TRAFFIC_LIGHT_DETECTION_IMAGE}:main" + - "${PERCEPTION_TRAFFIC_LIGHT_DETECTION_IMAGE}:build_${TAG}" + - "${PERCEPTION_TRAFFIC_LIGHT_DETECTION_IMAGE}:build_main" target: deploy image: "${PERCEPTION_TRAFFIC_LIGHT_DETECTION_IMAGE}:${TAG}" command: /bin/bash -c "ros2 launch traffic_light_detection traffic_light_detection.launch.py" @@ -58,8 +58,8 @@ services: context: .. dockerfile: docker/perception/traffic_sign_detection/traffic_sign_detection.Dockerfile cache_from: - - "${PERCEPTION_TRAFFIC_SIGN_DETECTION_IMAGE}:${TAG}" - - "${PERCEPTION_TRAFFIC_SIGN_DETECTION_IMAGE}:main" + - "${PERCEPTION_TRAFFIC_SIGN_DETECTION_IMAGE}:build_${TAG}" + - "${PERCEPTION_TRAFFIC_SIGN_DETECTION_IMAGE}:build_main" target: deploy image: "${PERCEPTION_TRAFFIC_SIGN_DETECTION_IMAGE}:${TAG}" command: /bin/bash -c "ros2 launch traffic_sign_detection traffic_sign_detection.launch.py" @@ -69,8 +69,8 @@ services: context: .. dockerfile: docker/perception/semantic_segmentation/semantic_segmentation.Dockerfile cache_from: - - "${PERCEPTION_SEMANTIC_SEGMENTATION_IMAGE}:${TAG}" - - "${PERCEPTION_SEMANTIC_SEGMENTATION_IMAGE}:main" + - "${PERCEPTION_SEMANTIC_SEGMENTATION_IMAGE}:build_${TAG}" + - "${PERCEPTION_SEMANTIC_SEGMENTATION_IMAGE}:build_main" target: deploy image: "${PERCEPTION_SEMANTIC_SEGMENTATION_IMAGE}:${TAG}" command: /bin/bash -c "ros2 launch semantic_segmentation semantic_segmentation.launch.py" @@ -80,8 +80,8 @@ services: context: .. dockerfile: docker/perception/lane_detection/lane_detection.Dockerfile cache_from: - - "${PERCEPTION_LANE_DETECTION_IMAGE}:${TAG}" - - "${PERCEPTION_LANE_DETECTION_IMAGE}:main" + - "${PERCEPTION_LANE_DETECTION_IMAGE}:build_${TAG}" + - "${PERCEPTION_LANE_DETECTION_IMAGE}:build_main" target: deploy image: "${PERCEPTION_LANE_DETECTION_IMAGE}:${TAG}" command: /bin/bash -c "ros2 launch lane_detection lane_detection.launch.py" @@ -91,8 +91,8 @@ services: context: .. dockerfile: docker/perception/tracking/tracking.Dockerfile cache_from: - - "${PERCEPTION_TRACKING_IMAGE}:${TAG}" - - "${PERCEPTION_TRACKING_IMAGE}:main" + - "${PERCEPTION_TRACKING_IMAGE}:build_${TAG}" + - "${PERCEPTION_TRACKING_IMAGE}:build_main" target: deploy image: "${PERCEPTION_TRACKING_IMAGE}:${TAG}" command: /bin/bash -c "ros2 launch tracking tracking.launch.py" diff --git a/modules/docker-compose.samples.yaml b/modules/docker-compose.samples.yaml index f094d080..38cd838a 100644 --- a/modules/docker-compose.samples.yaml +++ b/modules/docker-compose.samples.yaml @@ -6,8 +6,8 @@ services: context: .. dockerfile: docker/samples/cpp_aggregator/cpp_aggregator.Dockerfile cache_from: - - "${SAMPLES_CPP_AGGREGATOR_IMAGE:?}:${TAG}" - - "${SAMPLES_CPP_AGGREGATOR_IMAGE:?}:main" + - "${SAMPLES_CPP_AGGREGATOR_IMAGE:?}:build_${TAG}" + - "${SAMPLES_CPP_AGGREGATOR_IMAGE:?}:build_main" target: deploy image: "${SAMPLES_CPP_AGGREGATOR_IMAGE:?}:${TAG}" command: /bin/bash -c "ros2 launch aggregator aggregator.launch.py" @@ -17,8 +17,9 @@ services: # context: .. # dockerfile: docker/samples/py_aggregator/py_aggregator.Dockerfile # cache_from: - # - "${SAMPLES_PYTHON_AGGREGATOR_IMAGE:?}:${TAG}" - # - "${SAMPLES_PYTHON_AGGREGATOR_IMAGE:?}:main" + # - "${SAMPLES_PYTHON_AGGREGATOR_IMAGE:?}:build_${TAG}" + # - "${SAMPLES_PYTHON_AGGREGATOR_IMAGE:?}:build_main" + # target: deploy # image: "${SAMPLES_PYTHON_AGGREGATOR_IMAGE:?}:${TAG}" # command: /bin/bash -c "ros2 launch aggregator aggregator.launch.py" @@ -27,8 +28,9 @@ services: # context: .. # dockerfile: docker/samples/cpp_producer/cpp_producer.Dockerfile # cache_from: - # - "${SAMPLES_CPP_PRODUCER_IMAGE:?}:${TAG}" - # - "${SAMPLES_CPP_PRODUCER_IMAGE:?}:main" + # - "${SAMPLES_CPP_PRODUCER_IMAGE:?}:build_${TAG}" + # - "${SAMPLES_CPP_PRODUCER_IMAGE:?}:build_main" + # target: deploy # image: "${SAMPLES_CPP_PRODUCER_IMAGE:?}:${TAG}" # command: /bin/bash -c "ros2 launch producer producer.launch.py" @@ -37,8 +39,8 @@ services: context: .. dockerfile: docker/samples/py_producer/py_producer.Dockerfile cache_from: - - "${SAMPLES_PYTHON_PRODUCER_IMAGE:?}:${TAG}" - - "${SAMPLES_PYTHON_PRODUCER_IMAGE:?}:main" + - "${SAMPLES_PYTHON_PRODUCER_IMAGE:?}:build_${TAG}" + - "${SAMPLES_PYTHON_PRODUCER_IMAGE:?}:build_main" target: deploy image: "${SAMPLES_PYTHON_PRODUCER_IMAGE:?}:${TAG}" command: /bin/bash -c "ros2 launch producer producer.launch.py" @@ -48,8 +50,9 @@ services: # context: .. # dockerfile: docker/samples/cpp_transformer/cpp_transformer.Dockerfile # cache_from: - # - "${SAMPLES_CPP_TRANSFORMER_IMAGE:?}:${TAG}" - # - "${SAMPLES_CPP_TRANSFORMER_IMAGE:?}:main" + # - "${SAMPLES_CPP_TRANSFORMER_IMAGE:?}:build_${TAG}" + # - "${SAMPLES_CPP_TRANSFORMER_IMAGE:?}:build_main" + # target: deploy # image: "${SAMPLES_CPP_TRANSFORMER_IMAGE:?}:${TAG}" # command: /bin/bash -c "ros2 launch transformer transformer.launch.py" @@ -58,8 +61,8 @@ services: context: .. dockerfile: docker/samples/py_transformer/py_transformer.Dockerfile cache_from: - - "${SAMPLES_PYTHON_TRANSFORMER_IMAGE:?}:${TAG}" - - "${SAMPLES_PYTHON_TRANSFORMER_IMAGE:?}:main" + - "${SAMPLES_PYTHON_TRANSFORMER_IMAGE:?}:build_${TAG}" + - "${SAMPLES_PYTHON_TRANSFORMER_IMAGE:?}:build_main" target: deploy image: "${SAMPLES_PYTHON_TRANSFORMER_IMAGE:?}:${TAG}" command: /bin/bash -c "ros2 launch transformer transformer.launch.py" diff --git a/modules/docker-compose.simulation.yaml b/modules/docker-compose.simulation.yaml index ceba4f8b..3d9b1c57 100644 --- a/modules/docker-compose.simulation.yaml +++ b/modules/docker-compose.simulation.yaml @@ -6,8 +6,8 @@ services: context: .. dockerfile: docker/perception/carla_sim/carla_sim.Dockerfile cache_from: - - "${SIMULATION_CARLA_IMAGE:?}:${TAG}" - - "${SIMULATION_CARLA_IMAGE:?}:main" + - "${SIMULATION_CARLA_IMAGE:?}:build_${TAG}" + - "${SIMULATION_CARLA_IMAGE:?}:build_main" target: deploy image: "${SIMULATION_CARLA_IMAGE:?}:${TAG}" command: /bin/bash -c "ros2 launch carla_sim carla_sim.launch.py" diff --git a/modules/docker-compose.world_modeling.yaml b/modules/docker-compose.world_modeling.yaml index 8bd6889d..c70e4cf2 100644 --- a/modules/docker-compose.world_modeling.yaml +++ b/modules/docker-compose.world_modeling.yaml @@ -6,8 +6,8 @@ services: context: .. dockerfile: docker/world_modeling/hd_map/hd_map.Dockerfile cache_from: - - "${WORLD_MODELING_HD_MAP_IMAGE}:${TAG}" - - "${WORLD_MODELING_HD_MAP_IMAGE}:main" + - "${WORLD_MODELING_HD_MAP_IMAGE}:build_${TAG}" + - "${WORLD_MODELING_HD_MAP_IMAGE}:build_main" target: deploy image: "${WORLD_MODELING_HD_MAP_IMAGE}:${TAG}" command: /bin/bash -c "ros2 launch hd_map hd_map.launch.py" @@ -17,8 +17,8 @@ services: context: .. dockerfile: docker/world_modeling/localization/localization.Dockerfile cache_from: - - "${WORLD_MODELING_LOCALIZATION_IMAGE}:${TAG}" - - "${WORLD_MODELING_LOCALIZATION_IMAGE}:main" + - "${WORLD_MODELING_LOCALIZATION_IMAGE}:build_${TAG}" + - "${WORLD_MODELING_LOCALIZATION_IMAGE}:build_main" target: deploy image: "${WORLD_MODELING_LOCALIZATION_IMAGE}:${TAG}" command: /bin/bash -c "ros2 launch localization localization.launch.py" @@ -28,8 +28,8 @@ services: context: .. dockerfile: docker/world_modeling/occupancy/occupancy.Dockerfile cache_from: - - "${WORLD_MODELING_OCCUPANCY_IMAGE}:${TAG}" - - "${WORLD_MODELING_OCCUPANCY_IMAGE}:main" + - "${WORLD_MODELING_OCCUPANCY_IMAGE}:build_${TAG}" + - "${WORLD_MODELING_OCCUPANCY_IMAGE}:build_main" target: deploy image: "${WORLD_MODELING_OCCUPANCY_IMAGE}:${TAG}" command: /bin/bash -c "ros2 launch occupancy occupancy.launch.py" @@ -39,8 +39,8 @@ services: context: .. dockerfile: docker/world_modeling/occupancy_segmentation/occupancy_segmentation.Dockerfile cache_from: - - "${WORLD_MODELING_OCCUPANCY_SEGMENTATION_IMAGE}:${TAG}" - - "${WORLD_MODELING_OCCUPANCY_SEGMENTATION_IMAGE}:main" + - "${WORLD_MODELING_OCCUPANCY_SEGMENTATION_IMAGE}:build_${TAG}" + - "${WORLD_MODELING_OCCUPANCY_SEGMENTATION_IMAGE}:build_main" target: deploy image: "${WORLD_MODELING_OCCUPANCY_SEGMENTATION_IMAGE}:${TAG}" command: /bin/bash -c "ros2 launch occupancy_segmentation occupancy_segmentation.launch.py" @@ -50,8 +50,8 @@ services: context: .. dockerfile: docker/world_modeling/motion_forecasting/motion_forecasting.Dockerfile cache_from: - - "${WORLD_MODELING_MOTION_FORECASTING_IMAGE}:${TAG}" - - "${WORLD_MODELING_MOTION_FORECASTING_IMAGE}:main" + - "${WORLD_MODELING_MOTION_FORECASTING_IMAGE}:build_${TAG}" + - "${WORLD_MODELING_MOTION_FORECASTING_IMAGE}:build_main" target: deploy image: "${WORLD_MODELING_MOTION_FORECASTING_IMAGE}:${TAG}" command: /bin/bash -c "ros2 launch motion_forecasting motion_forecasting.launch.py" diff --git a/watod b/watod index ec3a3824..6a578b9f 100755 --- a/watod +++ b/watod @@ -92,9 +92,9 @@ fi # generate .env file from watod_scripts/watod-setup-env.sh if [ ! -z $VERBOSE ]; then # if we want to see all verbose coming from setting up env - cd $MONO_DIR && bash watod_scripts/watod-setup-env.sh + cd $MONO_DIR && . ./watod_scripts/watod-setup-env.sh else - cd $MONO_DIR && bash watod_scripts/watod-setup-env.sh &> /dev/null + cd $MONO_DIR && . ./watod_scripts/watod-setup-env.sh &> /dev/null fi if [ ! -z "$COMPOSE_CMD" ]; then diff --git a/watod-config.sh b/watod-config.sh index 931bccda..21ad8c6b 100755 --- a/watod-config.sh +++ b/watod-config.sh @@ -10,7 +10,7 @@ ## - simulation : starts simulation ## - samples : starts sample ROS2 pubsub nodes -# ACTIVE_MODULES="" +ACTIVE_MODULES="samples" ################################# MODE OF OPERATION ################################# ## Possible modes of operation when running watod. @@ -18,7 +18,7 @@ ## - deploy (default) : runs production-grade containers (non-editable) ## - develop : runs developer containers (editable) -# MODE_OF_OPERATION="" +MODE_OF_OPERATION="develop" ############################## ADVANCED CONFIGURATIONS ############################## ## Name to append to docker containers. DEFAULT = "" diff --git a/watod_scripts/watod-setup-env.sh b/watod_scripts/watod-setup-env.sh index 9aa23304..b704f83d 100755 --- a/watod_scripts/watod-setup-env.sh +++ b/watod_scripts/watod-setup-env.sh @@ -11,24 +11,7 @@ if [ -f /.dockerenv ]; then exit 1 fi -MONO_DIR="$(dirname "$(realpath "$0")")" -# moves us one level out to the root monorepo directory -MONO_DIR=${MONO_DIR%/*} - -# Allow for local overrides of any of the below parameters -if [ -f "$MONO_DIR/watod-config.sh" ]; then - source "$MONO_DIR/watod-config.sh" -fi - -# Change docker-compose override according to mode of operation -MODE_OF_OPERATION=${MODE_OF_OPERATION:-"deploy"} -if [ $MODE_OF_OPERATION == "deploy" ]; then - MODULES_DIR="$MONO_DIR/modules" -elif [ $MODE_OF_OPERATION == "develop" ]; then - MODULES_DIR="$MONO_DIR/modules/dev_overrides" -else - MODULES_DIR="$MONO_DIR/modules" -fi +MONO_DIR=${MONO_DIR:-"$(dirname "$(realpath "$0")")"} # Retrieve git branch if ! [ -x "$(command -v git)" ]; then From 546f074bd931239ab0ce040b6d08588bfba2d28a Mon Sep 17 00:00:00 2001 From: Eddy Zhou Date: Fri, 23 Feb 2024 17:05:47 +0000 Subject: [PATCH 03/14] do not change template --- watod-config.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/watod-config.sh b/watod-config.sh index 21ad8c6b..931bccda 100755 --- a/watod-config.sh +++ b/watod-config.sh @@ -10,7 +10,7 @@ ## - simulation : starts simulation ## - samples : starts sample ROS2 pubsub nodes -ACTIVE_MODULES="samples" +# ACTIVE_MODULES="" ################################# MODE OF OPERATION ################################# ## Possible modes of operation when running watod. @@ -18,7 +18,7 @@ ACTIVE_MODULES="samples" ## - deploy (default) : runs production-grade containers (non-editable) ## - develop : runs developer containers (editable) -MODE_OF_OPERATION="develop" +# MODE_OF_OPERATION="" ############################## ADVANCED CONFIGURATIONS ############################## ## Name to append to docker containers. DEFAULT = "" From 3d56ee65b60623d6f03115515b927957d86e3b20 Mon Sep 17 00:00:00 2001 From: Eddy Zhou Date: Fri, 23 Feb 2024 18:15:37 +0000 Subject: [PATCH 04/14] stuff --- modules/docker-compose.infrastructure.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/docker-compose.infrastructure.yaml b/modules/docker-compose.infrastructure.yaml index 32935fdb..63adceef 100644 --- a/modules/docker-compose.infrastructure.yaml +++ b/modules/docker-compose.infrastructure.yaml @@ -6,7 +6,7 @@ services: context: .. dockerfile: docker/infrastructure/foxglove/foxglove.Dockerfile cache_from: - - "${INFRASTRUCTURE_FOXGLOVE_IMAGE:?}:build_build_${TAG}" + - "${INFRASTRUCTURE_FOXGLOVE_IMAGE:?}:build_${TAG}" - "${INFRASTRUCTURE_FOXGLOVE_IMAGE:?}:build_main" target: deploy image: "${INFRASTRUCTURE_FOXGLOVE_IMAGE:?}:${TAG}" From dafcd078ece205ad78b25e132761a3f58f51b026 Mon Sep 17 00:00:00 2001 From: Eddy Zhou Date: Fri, 23 Feb 2024 18:21:41 +0000 Subject: [PATCH 05/14] debug --- .github/workflows/build_and_unitest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_unitest.yml b/.github/workflows/build_and_unitest.yml index 649e378a..26f96b5f 100644 --- a/.github/workflows/build_and_unitest.yml +++ b/.github/workflows/build_and_unitest.yml @@ -29,7 +29,7 @@ jobs: uses: "./.github/templates/check_src_changes" - name: Setup Watod Environment - run: ./watod_scripts/watod-setup-env.sh + run: MODULES_DIR="$(dirname "$(realpath "$0")")/modules" ./watod_scripts/watod-setup-env.sh shell: bash - name: Generate Docker Environment From 005d067156723abf8e80865f4f0adddd8a9a8fd1 Mon Sep 17 00:00:00 2001 From: Eddy Zhou Date: Fri, 23 Feb 2024 18:25:10 +0000 Subject: [PATCH 06/14] debug --- watod_scripts/watod-setup-env.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/watod_scripts/watod-setup-env.sh b/watod_scripts/watod-setup-env.sh index b704f83d..cd52a87d 100755 --- a/watod_scripts/watod-setup-env.sh +++ b/watod_scripts/watod-setup-env.sh @@ -12,6 +12,7 @@ if [ -f /.dockerenv ]; then fi MONO_DIR=${MONO_DIR:-"$(dirname "$(realpath "$0")")"} +MONO_DIR=${MONO_DIR%/*} # Retrieve git branch if ! [ -x "$(command -v git)" ]; then From cf66a921bcf29e4aa5d159172f7b24dc1a90bea0 Mon Sep 17 00:00:00 2001 From: Eddy Zhou Date: Fri, 23 Feb 2024 18:28:17 +0000 Subject: [PATCH 07/14] debugging tests --- .github/workflows/build_and_unitest.yml | 6 +++++- watod_scripts/watod-setup-env.sh | 3 --- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_and_unitest.yml b/.github/workflows/build_and_unitest.yml index 26f96b5f..e8ec2aed 100644 --- a/.github/workflows/build_and_unitest.yml +++ b/.github/workflows/build_and_unitest.yml @@ -29,7 +29,11 @@ jobs: uses: "./.github/templates/check_src_changes" - name: Setup Watod Environment - run: MODULES_DIR="$(dirname "$(realpath "$0")")/modules" ./watod_scripts/watod-setup-env.sh + run: | + MONO_DIR="$(dirname "$(realpath "$0")")"} + MONO_DIR=${MONO_DIR%/*} + MODULES_DIR="$MONO_DIR/modules" + ./watod_scripts/watod-setup-env.sh shell: bash - name: Generate Docker Environment diff --git a/watod_scripts/watod-setup-env.sh b/watod_scripts/watod-setup-env.sh index cd52a87d..4f7f1834 100755 --- a/watod_scripts/watod-setup-env.sh +++ b/watod_scripts/watod-setup-env.sh @@ -11,9 +11,6 @@ if [ -f /.dockerenv ]; then exit 1 fi -MONO_DIR=${MONO_DIR:-"$(dirname "$(realpath "$0")")"} -MONO_DIR=${MONO_DIR%/*} - # Retrieve git branch if ! [ -x "$(command -v git)" ]; then echo 'Error: git is not installed.' >&2 From e14e5a9c4decfd6238dbded77928521992d47acd Mon Sep 17 00:00:00 2001 From: Eddy Zhou Date: Fri, 23 Feb 2024 18:29:42 +0000 Subject: [PATCH 08/14] debugging tests --- .github/workflows/build_and_unitest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_unitest.yml b/.github/workflows/build_and_unitest.yml index e8ec2aed..33907f0a 100644 --- a/.github/workflows/build_and_unitest.yml +++ b/.github/workflows/build_and_unitest.yml @@ -30,7 +30,7 @@ jobs: - name: Setup Watod Environment run: | - MONO_DIR="$(dirname "$(realpath "$0")")"} + MONO_DIR="$(dirname "$(realpath "$0")")" MONO_DIR=${MONO_DIR%/*} MODULES_DIR="$MONO_DIR/modules" ./watod_scripts/watod-setup-env.sh From 0a9423458c77a46eb3d23273fe5d6c54c19a8940 Mon Sep 17 00:00:00 2001 From: Eddy Zhou Date: Fri, 23 Feb 2024 18:30:48 +0000 Subject: [PATCH 09/14] come one --- .github/workflows/build_and_unitest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_unitest.yml b/.github/workflows/build_and_unitest.yml index 33907f0a..0f2e9bba 100644 --- a/.github/workflows/build_and_unitest.yml +++ b/.github/workflows/build_and_unitest.yml @@ -33,7 +33,7 @@ jobs: MONO_DIR="$(dirname "$(realpath "$0")")" MONO_DIR=${MONO_DIR%/*} MODULES_DIR="$MONO_DIR/modules" - ./watod_scripts/watod-setup-env.sh + . ./watod_scripts/watod-setup-env.sh shell: bash - name: Generate Docker Environment From 8fba6851e74ccfd797712cb74be75bb6c4ebe45f Mon Sep 17 00:00:00 2001 From: Eddy Zhou Date: Fri, 1 Mar 2024 17:21:44 +0900 Subject: [PATCH 10/14] slightly hacky fix to get ci to work? --- .github/workflows/build_and_unitest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_unitest.yml b/.github/workflows/build_and_unitest.yml index 0f2e9bba..e2c102c7 100644 --- a/.github/workflows/build_and_unitest.yml +++ b/.github/workflows/build_and_unitest.yml @@ -32,7 +32,7 @@ jobs: run: | MONO_DIR="$(dirname "$(realpath "$0")")" MONO_DIR=${MONO_DIR%/*} - MODULES_DIR="$MONO_DIR/modules" + MODULES_DIR="$MONO_DIR/modules/wato_monorepo/wato_monorepo" . ./watod_scripts/watod-setup-env.sh shell: bash From 0e05e8aeb9f98cfcafa63550a2f3a31aba0cb63f Mon Sep 17 00:00:00 2001 From: Eddy Zhou Date: Fri, 1 Mar 2024 17:25:13 +0900 Subject: [PATCH 11/14] changing ci to run watod-setup-env directly --- .github/workflows/build_and_unitest.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build_and_unitest.yml b/.github/workflows/build_and_unitest.yml index e2c102c7..251d1527 100644 --- a/.github/workflows/build_and_unitest.yml +++ b/.github/workflows/build_and_unitest.yml @@ -30,9 +30,7 @@ jobs: - name: Setup Watod Environment run: | - MONO_DIR="$(dirname "$(realpath "$0")")" - MONO_DIR=${MONO_DIR%/*} - MODULES_DIR="$MONO_DIR/modules/wato_monorepo/wato_monorepo" + MODULES_DIR="$(dirname "$(realpath "$0")")/wato_monorepo/wato_monorepo/modules" . ./watod_scripts/watod-setup-env.sh shell: bash From 4bab9e0180c8967d7c4261b2c25a9d17c7b5339d Mon Sep 17 00:00:00 2001 From: Eddy Zhou Date: Fri, 1 Mar 2024 17:36:44 +0900 Subject: [PATCH 12/14] use GITHUB_WORKSPACE in runner to get the current directory --- .github/workflows/build_and_unitest.yml | 2 +- .gitignore | 2 ++ watod | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_and_unitest.yml b/.github/workflows/build_and_unitest.yml index 251d1527..d8176a09 100644 --- a/.github/workflows/build_and_unitest.yml +++ b/.github/workflows/build_and_unitest.yml @@ -30,7 +30,7 @@ jobs: - name: Setup Watod Environment run: | - MODULES_DIR="$(dirname "$(realpath "$0")")/wato_monorepo/wato_monorepo/modules" + MODULES_DIR="$GITHUB_WORKSPACE/modules" . ./watod_scripts/watod-setup-env.sh shell: bash diff --git a/.gitignore b/.gitignore index 9127d484..9be06ca7 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ code_server_config/*/start_code_server.sh .env .vscode/ ssh_config/ + +watod-config.local.sh \ No newline at end of file diff --git a/watod b/watod index 6a578b9f..0b5d1f87 100755 --- a/watod +++ b/watod @@ -75,8 +75,10 @@ if [[ $# -gt 0 ]]; then COMPOSE_CMD="${COMPOSE_CMD} $@" fi -# Allow for local overrides of any of the below parameters -if [ -f "$MONO_DIR/watod-config.sh" ]; then +# Allow for local overrides of any of the below parameters (prioritized your local config) +if [ -f "$MONO_DIR/watod-config.local.sh" ]; then + source "$MONO_DIR/watod-config.local.sh" +elif [ -f "$MONO_DIR/watod-config.sh" ]; then source "$MONO_DIR/watod-config.sh" fi From 1f280743a1ac69ba9f4511f8a565508018df3e36 Mon Sep 17 00:00:00 2001 From: Eddy Zhou Date: Fri, 1 Mar 2024 17:48:13 +0900 Subject: [PATCH 13/14] watod-config.local.sh functionality added --- watod-config.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/watod-config.sh b/watod-config.sh index 931bccda..3255dd40 100755 --- a/watod-config.sh +++ b/watod-config.sh @@ -1,5 +1,10 @@ ## ----------------------- watod Configuration File Override ---------------------------- +## +## HINT: You can copy the contents of this file to a watod-config.local.sh +## file that is untrackable by git and readable by watod. +## + ############################ ACTIVE MODULE CONFIGURATION ############################ ## List of active modules to run, defined in docker-compose.yaml. ## Possible values: From cdd52403a8434a1ba913936f58a91a247d9b8618 Mon Sep 17 00:00:00 2001 From: Eddy Zhou Date: Fri, 1 Mar 2024 17:52:56 +0900 Subject: [PATCH 14/14] changing job name to make things alot more readable in Github Actions --- .github/workflows/build_and_unitest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_unitest.yml b/.github/workflows/build_and_unitest.yml index d8176a09..214815b1 100644 --- a/.github/workflows/build_and_unitest.yml +++ b/.github/workflows/build_and_unitest.yml @@ -10,7 +10,7 @@ on: jobs: setup-environment: - name: Setup environment + name: Setup Environment runs-on: ubuntu-latest outputs: @@ -45,7 +45,7 @@ jobs: uses: "./.github/templates/github_context" build-and-unittest: - name: Build Image and Run Unit Testing Suite + name: Build/Test runs-on: ubuntu-latest needs: setup-environment