Skip to content

Commit

Permalink
Remove concurrency and cleanup workflows (All-Hands-AI#3524)
Browse files Browse the repository at this point in the history
  • Loading branch information
mamoodi committed Aug 21, 2024
1 parent 9dcad78 commit b7b4556
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 81 deletions.
40 changes: 3 additions & 37 deletions .github/workflows/ghcr_app.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
52 changes: 8 additions & 44 deletions .github/workflows/ghcr_runtime.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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

0 comments on commit b7b4556

Please sign in to comment.