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

Delete stuff #97

Closed
wants to merge 15 commits into from
89 changes: 89 additions & 0 deletions .github/workflows/dockerfile_version_check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Dockerfile Version Check

on:
pull_request:
paths:
- "docker/Dockerfile.*"
- "docker/docker-compose.yaml"

jobs:
check-docker-version:
runs-on: ubuntu-latest

steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
sparse-checkout: docker/

# Fetch base branch (e.g., 'main') for comparison
- name: Fetch base branch for comparison
run: |
git fetch origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}

# Define a function to check version increment for a given image_name
- name: Check Dockerfile changes and version increment for each image_name
run: |
# List the image_names and their corresponding Dockerfiles
cd docker/
declare -A image_name_to_dockerfile
image_name_to_dockerfile=(
["isaac-sim_ros-humble"]="Dockerfile.isaac-ros"
["airstack-dev"]="Dockerfile.airstack-dev"
# Add more mappings here
)

# Compare the current branch with the base branch
changes=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)

# Loop through each image_name and its Dockerfile
for image_name in "${!image_name_to_dockerfile[@]}"; do
dockerfile="${image_name_to_dockerfile[$image_name]}"

# If the Dockerfile for this image_name has been changed
if echo "$changes" | grep -q "$dockerfile"; then
echo "Dockerfile for $image_name has changed."

# Check if the docker-compose.yaml contains an image version for this image_name (vX.Y.Z)
if grep -qE "image: .*/$image_name:.*v[0-9]+\.[0-9]+\.[0-9]+" docker-compose.yaml; then
# Extract the full version (vX.Y.Z)
version_on_main=$(git show origin/${{ github.base_ref }}:docker/docker-compose.yaml | grep -oP "image: .*/$image_name:v\K[0-9]+\.[0-9]+\.[0-9]+")
echo "version_on_main=$version_on_main"

# Split current version into major, minor, patch
IFS='.' read -r current_major current_minor current_patch <<< "$version_on_main"

echo $(ls -l)
# Check if the image version for this image_name has been incremented in this PR
# version_this_branch=$(git diff origin/${{ github.base_ref }}...HEAD -- docker-compose.yaml | grep -oP "image: .*/$image_name:v\K[0-9]+\.[0-9]+\.[0-9]+") || echo "No version increment found."
version_this_branch=$(grep -oP "image: .*/$image_name:v\K[0-9]+\.[0-9]+\.[0-9]+" docker-compose.yaml)

if [ -z "$version_this_branch" ]; then
echo "::error::Dockerfile for $image_name was modified but image version in docker-compose.yaml was not updated."
exit 1
fi

echo "version_this_branch=$version_this_branch"

# Split new version into major, minor, patch
IFS='.' read -r new_major new_minor new_patch <<< "$version_this_branch"

# Check if the new version is higher than the current one
if [ "$new_major" -gt "$current_major" ] || \
([ "$new_major" -eq "$current_major" ] && [ "$new_minor" -gt "$current_minor" ]) || \
([ "$new_major" -eq "$current_major" ] && [ "$new_minor" -eq "$current_minor" ] && [ "$new_patch" -gt "$current_patch" ]); then
echo "Image version for $image_name has been incremented in docker-compose.yaml."
else
echo "::error::Dockerfile for $image_name was modified but the image version in docker-compose.yaml was not correctly incremented."
exit 1
fi
else
echo "::error::No valid image version (vX.Y.Z) found in docker-compose.yaml for $image_name."
exit 1
fi
else
echo "No changes to Dockerfile for $image_name."
fi
done
27 changes: 0 additions & 27 deletions docker/airstack-dev.dockerfile → docker/Dockerfile.airstack-dev
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ RUN apt install -y \
less htop jq \
python3-pip

# Install ROS2 packages

# Package dependencies
# perform ROS dependency installation for our workspace.
COPY ros_ws/src /tmp/ros_ws/src
Expand All @@ -27,31 +25,6 @@ RUN apt update -y && apt install -y \
ros-humble-tf2* \
ros-humble-stereo-image-proc \
ros-humble-image-view \
ros-humble-topic-tools \
ros-humble-grid-map

RUN /opt/ros/humble/lib/mavros/install_geographiclib_datasets.sh


# Install Python dependencies
RUN pip3 install \
empy \
future \
lxml \
matplotlib \
numpy \
pkgconfig \
psutil \
pygments \
wheel \
pymavlink \
pyyaml \
requests \
setuptools \
six \
toml \
scipy


# Override install newer openvdb 8.2.0 for compatibility with Ubuntu 22.04 https://bugs.launchpad.net/bugs/1970108
RUN apt remove -y libopenvdb*; \
Expand Down
17 changes: 0 additions & 17 deletions docker/isaac-sim/Dockerfile → docker/Dockerfile.isaac-ros
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,6 @@ RUN echo 'Etc/UTC' > /etc/timezone && \
apt-get install -q -y --no-install-recommends tzdata && \
rm -rf /var/lib/apt/lists/*

# install packages
RUN apt-get update && apt-get install -q -y --no-install-recommends \
dirmngr \
gnupg2 \
unzip \
&& rm -rf /var/lib/apt/lists/*

# setup keys
RUN set -eux; \
key='C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654'; \
export GNUPGHOME="$(mktemp -d)"; \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \
mkdir -p /usr/share/keyrings; \
gpg --batch --export "$key" > /usr/share/keyrings/ros2-latest-archive-keyring.gpg; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME"

# setup sources.list
RUN echo "deb [ signed-by=/usr/share/keyrings/ros2-latest-archive-keyring.gpg ] http://packages.ros.org/ros2/ubuntu jammy main" > /etc/apt/sources.list.d/ros2-latest.list

Expand Down
12 changes: 6 additions & 6 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ services:
isaac-sim:
build:
context: ../
dockerfile: docker/isaac-sim/Dockerfile
dockerfile: docker/Dockerfile.isaac-ros
tags:
- airlab-storage.andrew.cmu.edu:5001/shared/isaac-sim-4.1.0_ros-humble:latest
image: airlab-storage.andrew.cmu.edu:5001/shared/isaac-sim-4.1.0_ros-humble:latest
- airlab-storage.andrew.cmu.edu:5001/shared/isaac-sim_ros-humble:v1.1.0
image: airlab-storage.andrew.cmu.edu:5001/shared/isaac-sim_ros-humble:v1.1.0
container_name: isaac-sim
entrypoint: bash
# Interactive shell
Expand Down Expand Up @@ -93,11 +93,11 @@ services:
robot:
build:
context: ../
dockerfile: docker/airstack-dev.dockerfile
dockerfile: docker/Dockerfile.airstack-dev
tags:
- airlab-storage.andrew.cmu.edu:5001/shared/airstack-dev:latest
- airlab-storage.andrew.cmu.edu:5001/shared/airstack-dev:0.3.0
image: airlab-storage.andrew.cmu.edu:5001/shared/airstack-dev:latest
- airlab-storage.andrew.cmu.edu:5001/shared/airstack-dev:v0.5.1
image: airlab-storage.andrew.cmu.edu:5001/shared/airstack-dev:v0.5.1
# container_name: robot-1
entrypoint: bash -c "service ssh restart && bash"
# Interactive shell
Expand Down