Skip to content

Commit

Permalink
clone only if doessn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
MishkaMN committed Sep 9, 2024
1 parent a1ae684 commit f4f00e3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright (C) 2018-2022 LEIDOS.
#
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
Expand All @@ -26,13 +26,13 @@ ARG SECRET_KEY="NULL"
RUN mkdir -p ~/workspace_ros1/src ~/workspace_ros2/src
COPY --chown=carma . /home/carma/workspace_ros1/src/
RUN chmod -R u+x ~/workspace_ros1/src/docker/
RUN ~/workspace_ros1/src/docker/checkout.bash -ros1
RUN ~/workspace_ros1/src/docker/checkout.bash -ros1 workspace_ros1

# ROS2 checkout deps
COPY --chown=carma . /home/carma/workspace_ros2/src/
COPY --chown=carma . /home/carma/workspace_ros2/src/
RUN chmod -R u+x ~/workspace_ros2/src/docker/
RUN ~/workspace_ros2/src/docker/checkout.bash -ros2 -b ${GIT_BRANCH}
RUN ~/workspace_ros2/src/docker/checkout.bash -ros2 workspace_ros2 -b ${GIT_BRANCH}

# Install ssc_pm_lexus
RUN ~/workspace_ros1/src/docker/install.sh ${ACCESS_ID} ${SECRET_KEY}
Expand Down
20 changes: 13 additions & 7 deletions docker/checkout.bash
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,32 @@ while [[ $# -gt 0 ]]; do
shift
;;
-ros1|--ros1_build)
dir_ros1=$dir/ros1_workspace
echo "Checkout ros1 dependencies"
dir_ros1=$dir/$2
echo "Checkout ros1 dependencies to specified folder"
build_ros1_pkgs="$true"
shift
;;
-ros2|--ros2_build)
dir_ros2=$dir/ros2_workspace
echo "Checkout ros2 dependencies"
dir_ros2=$dir/$2
echo "Checkout ros2 dependencies to specified folder"
build_ros2_pkgs="$true"
shift
;;

esac
done

# Shared dependency among ROS1 and ROS2

cd ${dir}
git clone https://github.com/usdot-fhwa-stol/carma-msgs.git ${dir}/shared_deps/CARMAMsgs --branch $BRANCH
git clone https://github.com/usdot-fhwa-stol/carma-utils.git ${dir}/shared_deps/CARMAUtils --branch arc-146-remove-ros1

# Clone the shared dependency only if it's not already present
if [ ! -d "${dir}/shared_deps/CARMAMsgs" ]; then
git clone https://github.com/usdot-fhwa-stol/carma-msgs.git ${dir}/shared_deps/CARMAMsgs --branch $BRANCH
fi

if [ ! -d "${dir}/shared_deps/CARMAUtils" ]; then
git clone https://github.com/usdot-fhwa-stol/carma-utils.git ${dir}/shared_deps/CARMAMsgs --branch arc-146-remove-ros1
fi

if [ $build_ros1_pkgs -eq 1 ]; then
mkdir -p ${dir_ros1}/src/
Expand Down

0 comments on commit f4f00e3

Please sign in to comment.