Ver Fonte

Fix Docker tagging issue with upper case (#2512)

* Fix Docker tagging issue with upper case

* Update containers/build.sh

Co-authored-by: மனோஜ்குமார் பழனிச்சாமி <smartmanoj42857@gmail.com>

* Use tr command which is available on both zsh and bash

* Lower image name

* Lower image name

* Update .github/workflows/ghcr.yml

Co-authored-by: மனோஜ்குமார் பழனிச்சாமி <smartmanoj42857@gmail.com>

* Fix shell syntax

---------

Co-authored-by: மனோஜ்குமார் பழனிச்சாமி <smartmanoj42857@gmail.com>
Boxuan Li há 1 ano atrás
pai
commit
89cae8d6b8
2 ficheiros alterados com 11 adições e 10 exclusões
  1. 9 5
      .github/workflows/ghcr.yml
  2. 2 5
      containers/build.sh

+ 9 - 5
.github/workflows/ghcr.yml

@@ -214,10 +214,12 @@ jobs:
           mv /tmp/${{ matrix.platform }}/${{ matrix.image }}_image_${{ matrix.platform }}.tar .
           mv /tmp/${{ matrix.platform }}/${{ matrix.image }}_image_${{ matrix.platform }}.tar .
           loaded_image=$(docker load -i ${{ matrix.image }}_image_${{ matrix.platform }}.tar | grep "Loaded image:" | awk '{print $3}')
           loaded_image=$(docker load -i ${{ matrix.image }}_image_${{ matrix.platform }}.tar | grep "Loaded image:" | awk '{print $3}')
           tags=$(echo ${tags} | tr ' ' '\n')
           tags=$(echo ${tags} | tr ' ' '\n')
+          image_name=$(echo "ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}" | tr '[:upper:]' '[:lower:]')
+          echo "image name = $image_name"
           for tag in $tags; do
           for tag in $tags; do
             echo "tag = $tag"
             echo "tag = $tag"
-            docker tag $loaded_image ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}:${tag}_${{ matrix.platform }}
-            docker push ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}:${tag}_${{ matrix.platform }}
+            docker tag $loaded_image $image_name:${tag}_${{ matrix.platform }}
+            docker push $image_name:${tag}_${{ matrix.platform }}
           done
           done
 
 
   create_manifest:
   create_manifest:
@@ -249,12 +251,14 @@ jobs:
 
 
       - name: Create and push multi-platform manifest
       - name: Create and push multi-platform manifest
         run: |
         run: |
+          image_name=$(echo "ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}" | tr '[:upper:]' '[:lower:]')
+          echo "image name = $image_name"
           tags=$(echo ${tags} | tr ' ' '\n')
           tags=$(echo ${tags} | tr ' ' '\n')
           for tag in $tags; do
           for tag in $tags; do
             echo 'tag = $tag'
             echo 'tag = $tag'
-            docker buildx imagetools create --tag ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}:$tag \
-              ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}:${tag}_amd64 \
-              ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}:${tag}_arm64
+            docker buildx imagetools create --tag $image_name:$tag \
+              $image_name:${tag}_amd64 \
+              $image_name:${tag}_arm64
           done
           done
 
 
   # FIXME: an admin needs to mark this as non-mandatory, and then we can remove it
   # FIXME: an admin needs to mark this as non-mandatory, and then we can remove it

+ 2 - 5
containers/build.sh

@@ -10,9 +10,6 @@ tags=()
 
 
 OPEN_DEVIN_BUILD_VERSION="dev"
 OPEN_DEVIN_BUILD_VERSION="dev"
 
 
-cache_tag_base="buildcache"
-cache_tag="$cache_tag_base"
-
 if [[ -n $GITHUB_REF_NAME ]]; then
 if [[ -n $GITHUB_REF_NAME ]]; then
   # check if ref name is a version number
   # check if ref name is a version number
   if [[ $GITHUB_REF_NAME =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
   if [[ $GITHUB_REF_NAME =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
@@ -22,8 +19,8 @@ if [[ -n $GITHUB_REF_NAME ]]; then
   fi
   fi
   sanitized=$(echo "$GITHUB_REF_NAME" | sed 's/[^a-zA-Z0-9.-]\+/-/g')
   sanitized=$(echo "$GITHUB_REF_NAME" | sed 's/[^a-zA-Z0-9.-]\+/-/g')
   OPEN_DEVIN_BUILD_VERSION=$sanitized
   OPEN_DEVIN_BUILD_VERSION=$sanitized
-  cache_tag+="-${sanitized}"
-  tags+=("$sanitized")
+  tag=$(echo "$sanitized" | tr '[:upper:]' '[:lower:]') # lower case is required in tagging
+  tags+=("$tag")
 fi
 fi
 echo "Tags: ${tags[@]}"
 echo "Tags: ${tags[@]}"