fix: CI push image (#3485)

* fix comment

* remove extra ls

* update title

* fix app docker
This commit is contained in:
Xingyao Wang
2024-08-20 09:17:22 +08:00
committed by GitHub
parent d4ba7f53f9
commit 3d9a38d755
2 changed files with 7 additions and 5 deletions

View File

@@ -70,6 +70,7 @@ jobs:
id: capture-last-tag
run: |
last_tag=$(cat tags.txt | awk '{print $NF}')
echo "last_tag=$last_tag"
echo "last_tag=$last_tag" >> $GITHUB_OUTPUT
- name: Upload Docker image as artifact
uses: actions/upload-artifact@v4
@@ -80,6 +81,7 @@ jobs:
# Push the OpenHands and sandbox Docker images to the ghcr.io repository
ghcr_push:
name: Push App Image
runs-on: ubuntu-latest
needs: [ghcr_build]
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') || (github.event_name == 'pull_request' && github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main')
@@ -109,7 +111,7 @@ jobs:
path: /tmp
- name: Load images and push to registry
run: |
mv /tmp/${{ matrix.platform }}/${{ matrix.image }}_${{ matrix.last_tag }}_${{ matrix.platform }}.tar .
mv /tmp/${{ matrix.image }}_${{ matrix.last_tag }}_${{ matrix.platform }}.tar .
loaded_image=$(docker load -i ${{ matrix.image }}_${{ matrix.last_tag }}_${{ matrix.platform }}.tar | grep "Loaded image:" | head -n 1 | awk '{print $3}')
echo "loaded image = $loaded_image"
tags=$(echo ${tags} | tr ' ' '\n')
@@ -120,8 +122,9 @@ jobs:
docker tag $loaded_image $image_name:${tag}_${{ matrix.platform }}
docker push $image_name:${tag}_${{ matrix.platform }}
done
# Creates and pushes the OpenHands and sandbox Docker image manifests
# Creates and pushes the OpenHands Docker image manifests
create_manifest:
name: Create Manifest
runs-on: ubuntu-latest
needs: [ghcr_build, ghcr_push]
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') || (github.event_name == 'pull_request' && github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main')

View File

@@ -260,6 +260,7 @@ jobs:
# Push the runtime Docker images to the ghcr.io repository
ghcr_push_runtime:
name: Push Image
runs-on: ubuntu-latest
needs: [ghcr_build_runtime, prepare_test_image_tags, all_runtime_tests_passed]
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') || (github.event_name == 'pull_request' && github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main')
@@ -298,9 +299,6 @@ jobs:
with:
name: ${{ matrix.image }}_${{ matrix.last_tag }}_${{ matrix.platform }}
path: /tmp/
- name: List downloaded files
run: |
ls -la /tmp/${{ matrix.platform }}
- name: Load images and push to registry
run: |
image_file=$(find /tmp -name "${{ matrix.image }}_${{ matrix.last_tag }}_${{ matrix.platform }}.tar" | head -n 1)
@@ -329,6 +327,7 @@ jobs:
# Creates and pushes the runtime Docker image manifest
create_manifest_runtime:
name: Create Manifest
runs-on: ubuntu-latest
needs: [ghcr_build_runtime, prepare_test_image_tags, ghcr_push_runtime]
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') || (github.event_name == 'pull_request' && github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main')