Преглед изворни кода

Remove concurrency and cleanup workflows (#3524)

mamoodi пре 1 година
родитељ
комит
b7b4556433
2 измењених фајлова са 11 додато и 81 уклоњено
  1. 3 37
      .github/workflows/ghcr_app.yml
  2. 8 44
      .github/workflows/ghcr_runtime.yml

+ 3 - 37
.github/workflows/ghcr_app.yml

@@ -1,7 +1,6 @@
 # Workflow that builds, tests and then pushes the app docker images to the ghcr.io repository
 name: Build and Publish App Image
 
-
 # Always run on "main"
 # Always run on tags
 # Always run on PRs
@@ -79,12 +78,12 @@ jobs:
           path: /tmp/${{ matrix.image }}_${{ steps.capture-last-tag.outputs.last_tag }}_${{ matrix.platform }}.tar
           retention-days: 14
 
-  # Push the OpenHands and sandbox Docker images to the ghcr.io repository
+  # Push the OpenHands 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')
+    if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
     env:
       tags: ${{ needs.ghcr_build.outputs.tags }}
     permissions:
@@ -121,38 +120,5 @@ jobs:
             echo "tag = $tag"
             docker tag $loaded_image $image_name:${tag}_${{ matrix.platform }}
             docker push $image_name:${tag}_${{ matrix.platform }}
-          done
-  # 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')
-    env:
-      tags: ${{ needs.ghcr_build.outputs.tags }}
-    strategy:
-      matrix:
-        image: ['openhands']
-    permissions:
-      contents: read
-      packages: write
-    steps:
-      - name: Checkout code
-        uses: actions/checkout@v4
-      - name: Login to GHCR
-        uses: docker/login-action@v3
-        with:
-          registry: ghcr.io
-          username: ${{ github.repository_owner }}
-          password: ${{ secrets.GITHUB_TOKEN }}
-      - name: Create and push multi-platform manifest
-        run: |
-          image_name=$(echo "ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}" | tr '[:upper:]' '[:lower:]')
-          echo "image name = $image_name"
-          tags=$(echo ${tags} | tr ' ' '\n')
-          for tag in $tags; do
-            echo 'tag = $tag'
-            docker buildx imagetools create --tag $image_name:$tag \
-              $image_name:${tag}_amd64 \
-              $image_name:${tag}_arm64
+            docker buildx imagetools create --tag $image_name:$tag $image_name:${tag}_${{ matrix.platform }}
           done

+ 8 - 44
.github/workflows/ghcr_runtime.yml

@@ -1,12 +1,10 @@
 # Workflow that builds, tests and then pushes the runtime docker images to the ghcr.io repository
 name: Build, Test and Publish Runtime Image
 
-# Only run one workflow of the same group at a time.
-# There can be at most one running and one pending job in a concurrency group at any time.
-concurrency:
-  group: ${{ github.workflow }}-${{ github.ref }}
-  cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
-
+# Always run on "main"
+# Always run on tags
+# Always run on PRs
+# Can also be triggered manually
 on:
   push:
     branches:
@@ -132,7 +130,7 @@ jobs:
           echo "test_image_tags=$matrix" >> $GITHUB_OUTPUT
           echo "Generated test_image_tags: $matrix"
 
-  # Run unit tests with the EventStream and Server runtime Docker images
+  # Run unit tests with the EventStream runtime Docker images
   test_runtime:
     name: Test Runtime
     runs-on: ubuntu-latest
@@ -249,7 +247,7 @@ jobs:
         env:
           CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
 
-  # New job to indicate all runtime tests have passed
+  # Checks that all runtime tests have passed
   all_runtime_tests_passed:
     name: All Runtime Tests Passed
     runs-on: ubuntu-latest
@@ -263,7 +261,7 @@ jobs:
     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')
+    if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
     env:
       RUNTIME_TAGS: ${{ needs.ghcr_build_runtime.outputs.tags }}
     permissions:
@@ -320,42 +318,8 @@ jobs:
             if [ -n "$image_name" ] && [ -n "$tag" ]; then
               docker tag $loaded_image $image_name:${tag}_${{ matrix.platform }}
               docker push $image_name:${tag}_${{ matrix.platform }}
+              docker buildx imagetools create --tag $image_name:$tag $image_name:${tag}_${{ matrix.platform }}
             else
               echo "Skipping tag and push due to empty image_name or tag"
             fi
           done
-
-  # 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')
-    env:
-      tags: ${{ needs.ghcr_build_runtime.outputs.tags }}
-    strategy:
-      matrix:
-        image: ['runtime']
-    permissions:
-      contents: read
-      packages: write
-    steps:
-      - name: Checkout code
-        uses: actions/checkout@v4
-      - name: Login to GHCR
-        uses: docker/login-action@v3
-        with:
-          registry: ghcr.io
-          username: ${{ github.repository_owner }}
-          password: ${{ secrets.GITHUB_TOKEN }}
-      - name: Create and push multi-platform manifest
-        run: |
-          image_name=$(echo "ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}" | tr '[:upper:]' '[:lower:]')
-          echo "image name = $image_name"
-          tags=$(echo ${tags} | tr ' ' '\n')
-          for tag in $tags; do
-            echo 'tag = $tag'
-            docker buildx imagetools create --tag $image_name:$tag \
-              $image_name:${tag}_amd64 \
-              $image_name:${tag}_arm64
-          done