From 4848708a35f870b4ee42ad269202af1bc6ca0dc3 Mon Sep 17 00:00:00 2001 From: Andrew Jong Date: Tue, 8 Oct 2024 19:38:28 -0400 Subject: [PATCH 01/15] Add an automatic check to see if the docker image version is updated when the dockerfile changes (#83) * Rename dockerfiles * First attempt at github action for docker version check --- .../workflows/dockerfile_version_check.yaml | 81 +++++++++++++++++++ ...dev.dockerfile => Dockerfile.airstack-dev} | 2 - .../Dockerfile => Dockerfile.isaac-ros} | 0 docker/docker-compose.yaml | 12 +-- 4 files changed, 87 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/dockerfile_version_check.yaml rename docker/{airstack-dev.dockerfile => Dockerfile.airstack-dev} (98%) rename docker/{isaac-sim/Dockerfile => Dockerfile.isaac-ros} (100%) diff --git a/.github/workflows/dockerfile_version_check.yaml b/.github/workflows/dockerfile_version_check.yaml new file mode 100644 index 00000000..97f7a9cc --- /dev/null +++ b/.github/workflows/dockerfile_version_check.yaml @@ -0,0 +1,81 @@ +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@v3 + + # 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 service + - name: Check Dockerfile changes and version increment for each service + run: | + # List the services and their corresponding Dockerfiles + cd docker/ + declare -A services + services=( + ["isaac-sim"]="Dockerfile.isaac-ros" + ["robot"]="Dockerfile.airstack-dev" + # Add more mappings here for other services + ) + + # Compare the current branch with the base branch + changes=$(git diff --name-only origin/${{ github.base_ref }}...HEAD) + + # Loop through each service and its Dockerfile + for service in "${!services[@]}"; do + dockerfile="${services[$service]}" + + # If the Dockerfile for this service has been changed + if echo "$changes" | grep -q "$dockerfile"; then + echo "Dockerfile for $service has changed." + + # Check if the docker-compose.yaml contains an image version for this service (vX.Y.Z) + if grep -qE "image: .*/$service:.*v[0-9]+\.[0-9]+\.[0-9]+" docker-compose.yaml; then + # Extract the full version (vX.Y.Z) + current_version=$(grep -oP "image: .*/$service:v\K[0-9]+\.[0-9]+\.[0-9]+" docker-compose.yaml) + + # Split current version into major, minor, patch + IFS='.' read -r current_major current_minor current_patch <<< "$current_version" + + # Check if the image version for this service has been incremented in this PR + new_version=$(git diff origin/${{ github.base_ref }}...HEAD -- docker-compose.yaml | grep -oP "image: .*/$service:v\K[0-9]+\.[0-9]+\.[0-9]+") + + if [ -z "$new_version" ]; then + echo "::error::Dockerfile for $service was modified but image version in docker-compose.yaml was not updated." + exit 1 + fi + + # Split new version into major, minor, patch + IFS='.' read -r new_major new_minor new_patch <<< "$new_version" + + # 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 $service has been incremented in docker-compose.yaml." + else + echo "::error::Dockerfile for $service 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 $service." + exit 1 + fi + else + echo "No changes to Dockerfile for $service." + fi + done diff --git a/docker/airstack-dev.dockerfile b/docker/Dockerfile.airstack-dev similarity index 98% rename from docker/airstack-dev.dockerfile rename to docker/Dockerfile.airstack-dev index f3e6eff0..c3b2bb12 100644 --- a/docker/airstack-dev.dockerfile +++ b/docker/Dockerfile.airstack-dev @@ -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 diff --git a/docker/isaac-sim/Dockerfile b/docker/Dockerfile.isaac-ros similarity index 100% rename from docker/isaac-sim/Dockerfile rename to docker/Dockerfile.isaac-ros diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index f7b83cf8..ad5042d0 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -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-4.1.0_ros-humble:v1.0.0 + image: airlab-storage.andrew.cmu.edu:5001/shared/isaac-sim-4.1.0_ros-humble:v1.0.0 container_name: isaac-sim entrypoint: bash # Interactive shell @@ -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.0 + image: airlab-storage.andrew.cmu.edu:5001/shared/airstack-dev:v0.5.0 # container_name: robot-1 entrypoint: bash -c "service ssh restart && bash" # Interactive shell From bf35a008ffb464a484ccf3b3085d13e63ab887cd Mon Sep 17 00:00:00 2001 From: Andrew Jong Date: Tue, 8 Oct 2024 19:43:37 -0400 Subject: [PATCH 02/15] Add greater fetch depth (#85) --- .github/workflows/dockerfile_version_check.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dockerfile_version_check.yaml b/.github/workflows/dockerfile_version_check.yaml index 97f7a9cc..1c35f9a0 100644 --- a/.github/workflows/dockerfile_version_check.yaml +++ b/.github/workflows/dockerfile_version_check.yaml @@ -14,6 +14,8 @@ jobs: # Checkout the code - name: Checkout code uses: actions/checkout@v3 + with: + fetch-depth: 0 # Fetch base branch (e.g., 'main') for comparison - name: Fetch base branch for comparison From c68c7d33b440cc618f6133347357fa36d8dabb7b Mon Sep 17 00:00:00 2001 From: Andrew Jong Date: Tue, 8 Oct 2024 19:58:01 -0400 Subject: [PATCH 03/15] Fix checking (#87) --- .../workflows/dockerfile_version_check.yaml | 46 +++++++++---------- docker/docker-compose.yaml | 4 +- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/workflows/dockerfile_version_check.yaml b/.github/workflows/dockerfile_version_check.yaml index 1c35f9a0..8866c8aa 100644 --- a/.github/workflows/dockerfile_version_check.yaml +++ b/.github/workflows/dockerfile_version_check.yaml @@ -22,42 +22,42 @@ jobs: 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 service - - name: Check Dockerfile changes and version increment for each service + # 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 services and their corresponding Dockerfiles + # List the image_names and their corresponding Dockerfiles cd docker/ - declare -A services - services=( - ["isaac-sim"]="Dockerfile.isaac-ros" - ["robot"]="Dockerfile.airstack-dev" - # Add more mappings here for other services + 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 service and its Dockerfile - for service in "${!services[@]}"; do - dockerfile="${services[$service]}" + # 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 service has been changed + # If the Dockerfile for this image_name has been changed if echo "$changes" | grep -q "$dockerfile"; then - echo "Dockerfile for $service has changed." + echo "Dockerfile for $image_name has changed." - # Check if the docker-compose.yaml contains an image version for this service (vX.Y.Z) - if grep -qE "image: .*/$service:.*v[0-9]+\.[0-9]+\.[0-9]+" docker-compose.yaml; then + # 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) - current_version=$(grep -oP "image: .*/$service:v\K[0-9]+\.[0-9]+\.[0-9]+" docker-compose.yaml) + current_version=$(grep -oP "image: .*/$image_name:v\K[0-9]+\.[0-9]+\.[0-9]+" docker-compose.yaml) # Split current version into major, minor, patch IFS='.' read -r current_major current_minor current_patch <<< "$current_version" - # Check if the image version for this service has been incremented in this PR - new_version=$(git diff origin/${{ github.base_ref }}...HEAD -- docker-compose.yaml | grep -oP "image: .*/$service:v\K[0-9]+\.[0-9]+\.[0-9]+") + # Check if the image version for this image_name has been incremented in this PR + new_version=$(git diff origin/${{ github.base_ref }}...HEAD -- docker-compose.yaml | grep -oP "image: .*/$image_name:v\K[0-9]+\.[0-9]+\.[0-9]+") if [ -z "$new_version" ]; then - echo "::error::Dockerfile for $service was modified but image version in docker-compose.yaml was not updated." + echo "::error::Dockerfile for $image_name was modified but image version in docker-compose.yaml was not updated." exit 1 fi @@ -68,16 +68,16 @@ jobs: 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 $service has been incremented in docker-compose.yaml." + echo "Image version for $image_name has been incremented in docker-compose.yaml." else - echo "::error::Dockerfile for $service was modified but the image version in docker-compose.yaml was not correctly incremented." + 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 $service." + 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 $service." + echo "No changes to Dockerfile for $image_name." fi done diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index ad5042d0..96fe9e0c 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -6,8 +6,8 @@ services: context: ../ dockerfile: docker/Dockerfile.isaac-ros tags: - - airlab-storage.andrew.cmu.edu:5001/shared/isaac-sim-4.1.0_ros-humble:v1.0.0 - image: airlab-storage.andrew.cmu.edu:5001/shared/isaac-sim-4.1.0_ros-humble:v1.0.0 + - airlab-storage.andrew.cmu.edu:5001/shared/isaac-sim_ros-humble:v1.0.0 + image: airlab-storage.andrew.cmu.edu:5001/shared/isaac-sim_ros-humble:v1.0.0 container_name: isaac-sim entrypoint: bash # Interactive shell From f40382b36e6742edafbc89d45ebe137693442bfa Mon Sep 17 00:00:00 2001 From: Andrew Jong Date: Tue, 8 Oct 2024 20:03:16 -0400 Subject: [PATCH 04/15] Add debug echo --- .github/workflows/dockerfile_version_check.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dockerfile_version_check.yaml b/.github/workflows/dockerfile_version_check.yaml index 8866c8aa..2a22027a 100644 --- a/.github/workflows/dockerfile_version_check.yaml +++ b/.github/workflows/dockerfile_version_check.yaml @@ -49,12 +49,14 @@ jobs: if grep -qE "image: .*/$image_name:.*v[0-9]+\.[0-9]+\.[0-9]+" docker-compose.yaml; then # Extract the full version (vX.Y.Z) current_version=$(grep -oP "image: .*/$image_name:v\K[0-9]+\.[0-9]+\.[0-9]+" docker-compose.yaml) + echo "current_version=$current_version" # Split current version into major, minor, patch IFS='.' read -r current_major current_minor current_patch <<< "$current_version" # Check if the image version for this image_name has been incremented in this PR new_version=$(git diff origin/${{ github.base_ref }}...HEAD -- docker-compose.yaml | grep -oP "image: .*/$image_name:v\K[0-9]+\.[0-9]+\.[0-9]+") + echo "new_version=$new_version" if [ -z "$new_version" ]; then echo "::error::Dockerfile for $image_name was modified but image version in docker-compose.yaml was not updated." From 41860aefcc8d8e2faa172646b443be7cf680d35f Mon Sep 17 00:00:00 2001 From: Andrew Jong Date: Tue, 8 Oct 2024 20:12:36 -0400 Subject: [PATCH 05/15] Fix early exit --- .github/workflows/dockerfile_version_check.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dockerfile_version_check.yaml b/.github/workflows/dockerfile_version_check.yaml index 2a22027a..2f716186 100644 --- a/.github/workflows/dockerfile_version_check.yaml +++ b/.github/workflows/dockerfile_version_check.yaml @@ -55,14 +55,15 @@ jobs: IFS='.' read -r current_major current_minor current_patch <<< "$current_version" # Check if the image version for this image_name has been incremented in this PR - new_version=$(git diff origin/${{ github.base_ref }}...HEAD -- docker-compose.yaml | grep -oP "image: .*/$image_name:v\K[0-9]+\.[0-9]+\.[0-9]+") - echo "new_version=$new_version" + new_version=$(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 new version found." if [ -z "$new_version" ]; then echo "::error::Dockerfile for $image_name was modified but image version in docker-compose.yaml was not updated." exit 1 fi + echo "new_version=$new_version" + # Split new version into major, minor, patch IFS='.' read -r new_major new_minor new_patch <<< "$new_version" From 5ceef15a597b486fda4c9ea86210a9c1de500351 Mon Sep 17 00:00:00 2001 From: Andrew Jong Date: Tue, 8 Oct 2024 20:23:54 -0400 Subject: [PATCH 06/15] More tuning --- .../workflows/dockerfile_version_check.yaml | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/dockerfile_version_check.yaml b/.github/workflows/dockerfile_version_check.yaml index 2f716186..012f2fdf 100644 --- a/.github/workflows/dockerfile_version_check.yaml +++ b/.github/workflows/dockerfile_version_check.yaml @@ -48,24 +48,24 @@ jobs: # 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) - current_version=$(grep -oP "image: .*/$image_name:v\K[0-9]+\.[0-9]+\.[0-9]+" docker-compose.yaml) - echo "current_version=$current_version" + version_on_main=$(git show main: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 <<< "$current_version" + IFS='.' read -r current_major current_minor current_patch <<< "$version_on_main" # Check if the image version for this image_name has been incremented in this PR - new_version=$(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 new version found." + version_this_branch=$(grep -oP "image: .*/$image_name:v\K[0-9]+\.[0-9]+\.[0-9]+" docker-compose.yaml) - if [ -z "$new_version" ]; then - echo "::error::Dockerfile for $image_name was modified but image version in docker-compose.yaml was not updated." - exit 1 - fi + # 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 "new_version=$new_version" + echo "version_this_branch=$new_version" # Split new version into major, minor, patch - IFS='.' read -r new_major new_minor new_patch <<< "$new_version" + 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" ] || \ From 4bac603bf0b5a1e25e77382f3664d41ab6708e69 Mon Sep 17 00:00:00 2001 From: Andrew Jong Date: Tue, 8 Oct 2024 20:25:48 -0400 Subject: [PATCH 07/15] Fix thing --- .github/workflows/dockerfile_version_check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dockerfile_version_check.yaml b/.github/workflows/dockerfile_version_check.yaml index 012f2fdf..20b60f10 100644 --- a/.github/workflows/dockerfile_version_check.yaml +++ b/.github/workflows/dockerfile_version_check.yaml @@ -48,7 +48,7 @@ jobs: # 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 main:docker/docker-compose.yaml | grep -oP "image: .*/$image_name:v\K[0-9]+\.[0-9]+\.[0-9]+") + 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 From 36d08497a4a2a19ad916c054f6eaea16ebd07f13 Mon Sep 17 00:00:00 2001 From: Andrew Jong Date: Tue, 8 Oct 2024 20:33:25 -0400 Subject: [PATCH 08/15] Tune again --- .github/workflows/dockerfile_version_check.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dockerfile_version_check.yaml b/.github/workflows/dockerfile_version_check.yaml index 20b60f10..ff4f1b01 100644 --- a/.github/workflows/dockerfile_version_check.yaml +++ b/.github/workflows/dockerfile_version_check.yaml @@ -55,12 +55,12 @@ jobs: IFS='.' read -r current_major current_minor current_patch <<< "$version_on_main" # Check if the image version for this image_name has been incremented in this PR - version_this_branch=$(grep -oP "image: .*/$image_name:v\K[0-9]+\.[0-9]+\.[0-9]+" docker-compose.yaml) + 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]+") - # 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 + 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=$new_version" From a17ee4545902e1c265baa14575bc4f5e3899c8b9 Mon Sep 17 00:00:00 2001 From: Andrew Jong Date: Tue, 8 Oct 2024 20:34:56 -0400 Subject: [PATCH 09/15] Tune again --- .github/workflows/dockerfile_version_check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dockerfile_version_check.yaml b/.github/workflows/dockerfile_version_check.yaml index ff4f1b01..ea472b79 100644 --- a/.github/workflows/dockerfile_version_check.yaml +++ b/.github/workflows/dockerfile_version_check.yaml @@ -55,7 +55,7 @@ jobs: IFS='.' read -r current_major current_minor current_patch <<< "$version_on_main" # 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]+") + 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." if [ -z "$version_this_branch" ]; then echo "::error::Dockerfile for $image_name was modified but image version in docker-compose.yaml was not updated." From 1ce6c3e582824318559714661508ec0d1d54f3f7 Mon Sep 17 00:00:00 2001 From: Andrew Jong Date: Tue, 8 Oct 2024 20:39:40 -0400 Subject: [PATCH 10/15] Try again --- .github/workflows/dockerfile_version_check.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dockerfile_version_check.yaml b/.github/workflows/dockerfile_version_check.yaml index ea472b79..2ba1c55a 100644 --- a/.github/workflows/dockerfile_version_check.yaml +++ b/.github/workflows/dockerfile_version_check.yaml @@ -13,9 +13,10 @@ jobs: steps: # Checkout the code - name: Checkout code - uses: actions/checkout@v3 + 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 @@ -55,7 +56,8 @@ jobs: IFS='.' read -r current_major current_minor current_patch <<< "$version_on_main" # 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=$(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." From 9c2982c3ee7fc2e075fbbedebb0de9c7b29f3886 Mon Sep 17 00:00:00 2001 From: Andrew Jong Date: Tue, 8 Oct 2024 20:41:16 -0400 Subject: [PATCH 11/15] Debug --- .github/workflows/dockerfile_version_check.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dockerfile_version_check.yaml b/.github/workflows/dockerfile_version_check.yaml index 2ba1c55a..9e044ca0 100644 --- a/.github/workflows/dockerfile_version_check.yaml +++ b/.github/workflows/dockerfile_version_check.yaml @@ -55,6 +55,7 @@ jobs: # 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) From 277090e1fd7852e074839e8f732ff7370a0e9c0f Mon Sep 17 00:00:00 2001 From: Andrew Jong Date: Tue, 8 Oct 2024 20:45:13 -0400 Subject: [PATCH 12/15] Fix debug message --- .github/workflows/dockerfile_version_check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dockerfile_version_check.yaml b/.github/workflows/dockerfile_version_check.yaml index 9e044ca0..40c7c370 100644 --- a/.github/workflows/dockerfile_version_check.yaml +++ b/.github/workflows/dockerfile_version_check.yaml @@ -65,7 +65,7 @@ jobs: exit 1 fi - echo "version_this_branch=$new_version" + 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" From b3c8b161b850484d1cfc99b3107650486d9de7ee Mon Sep 17 00:00:00 2001 From: Andrew Jong Date: Tue, 8 Oct 2024 20:45:35 -0400 Subject: [PATCH 13/15] Delete stuff --- docker/Dockerfile.airstack-dev | 25 ------------------------- docker/Dockerfile.isaac-ros | 17 ----------------- 2 files changed, 42 deletions(-) diff --git a/docker/Dockerfile.airstack-dev b/docker/Dockerfile.airstack-dev index c3b2bb12..2185597c 100644 --- a/docker/Dockerfile.airstack-dev +++ b/docker/Dockerfile.airstack-dev @@ -25,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*; \ diff --git a/docker/Dockerfile.isaac-ros b/docker/Dockerfile.isaac-ros index 8a6a733e..067afab7 100644 --- a/docker/Dockerfile.isaac-ros +++ b/docker/Dockerfile.isaac-ros @@ -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 From 874dc3bf64b49c0f33569c49e912739b645de9fe Mon Sep 17 00:00:00 2001 From: Andrew Jong Date: Tue, 8 Oct 2024 20:46:33 -0400 Subject: [PATCH 14/15] Try increment and decrement --- docker/docker-compose.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index 96fe9e0c..f6176f79 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -6,8 +6,8 @@ services: context: ../ dockerfile: docker/Dockerfile.isaac-ros tags: - - airlab-storage.andrew.cmu.edu:5001/shared/isaac-sim_ros-humble:v1.0.0 - image: airlab-storage.andrew.cmu.edu:5001/shared/isaac-sim_ros-humble:v1.0.0 + - 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 @@ -96,8 +96,8 @@ services: 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:v0.5.0 - image: airlab-storage.andrew.cmu.edu:5001/shared/airstack-dev:v0.5.0 + - airlab-storage.andrew.cmu.edu:5001/shared/airstack-dev:v0.4.0 + image: airlab-storage.andrew.cmu.edu:5001/shared/airstack-dev:v0.4.0 # container_name: robot-1 entrypoint: bash -c "service ssh restart && bash" # Interactive shell From 455918f2da8a14dfc45fe56c50a61c8b3c199411 Mon Sep 17 00:00:00 2001 From: Andrew Jong Date: Tue, 8 Oct 2024 20:47:13 -0400 Subject: [PATCH 15/15] Try proper increment --- docker/docker-compose.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index f6176f79..3fd42aae 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -96,8 +96,8 @@ services: 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:v0.4.0 - image: airlab-storage.andrew.cmu.edu:5001/shared/airstack-dev:v0.4.0 + - 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