From 23289e028f9ba0a063f10646bb0ee543cb8dab2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Po=C5=82om?= Date: Tue, 29 Apr 2025 13:36:58 +0200 Subject: [PATCH 1/3] Run local ingest test instead of wikipedia --- scripts/docker-smoke-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/docker-smoke-test.sh b/scripts/docker-smoke-test.sh index 1d0950e923..0e66e05ae4 100755 --- a/scripts/docker-smoke-test.sh +++ b/scripts/docker-smoke-test.sh @@ -41,7 +41,7 @@ await_container docker cp test_unstructured_ingest $CONTAINER_NAME:/app docker cp requirements/ingest $CONTAINER_NAME:/app/requirements/ingest docker exec -u root "$CONTAINER_NAME" /bin/bash -c "chown -R notebook-user:notebook-user /app/test_unstructured_ingest" -docker exec "$CONTAINER_NAME" /bin/bash -c "/app/test_unstructured_ingest/src/wikipedia.sh" +docker exec "$CONTAINER_NAME" /bin/bash -c "/app/test_unstructured_ingest/src/local.sh" result=$? exit $result From 85b628083c0c7ba027865302c88fbd32c2f431e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Po=C5=82om?= Date: Tue, 29 Apr 2025 13:37:26 +0200 Subject: [PATCH 2/3] Test image build --- .github/workflows/docker-publish.yml | 91 ++++++++++++++-------------- 1 file changed, 47 insertions(+), 44 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 8705bb39b8..ebe097e711 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -2,8 +2,11 @@ name: Build And Push Docker Image on: push: - branches: - - main + branches: [ main ] + pull_request: + branches: [ main ] + merge_group: + branches: [ main ] env: DOCKER_REPOSITORY: quay.io/unstructured-io/unstructured @@ -70,45 +73,45 @@ jobs: make docker-test CI=true TEST_FILE=test_unstructured/partition/test_text.py fi DOCKER_IMAGE=$DOCKER_BUILD_REPOSITORY:$ARCH-$SHORT_SHA make docker-smoke-test - - name: Push images - run: | - # write to the build repository to cache for the publish-images job - ARCH=$(cut -d "/" -f2 <<< ${{ matrix.docker-platform }}) - docker push "$DOCKER_BUILD_REPOSITORY:$ARCH-$SHORT_SHA" - publish-images: - runs-on: ubuntu-latest-m - needs: [set-short-sha, build-images] - env: - SHORT_SHA: ${{ needs.set-short-sha.outputs.short_sha }} - steps: - - uses: docker/setup-buildx-action@v1 - - name: Checkout code - uses: actions/checkout@v3 - - name: Login to Quay.io - uses: docker/login-action@v1 - with: - registry: quay.io - username: ${{ secrets.QUAY_IO_ROBOT_USERNAME }} - password: ${{ secrets.QUAY_IO_ROBOT_TOKEN }} - - name: Pull AMD image - run: | - docker pull $DOCKER_BUILD_REPOSITORY:amd64-$SHORT_SHA - - name: Pull ARM image - run: | - docker pull $DOCKER_BUILD_REPOSITORY:arm64-$SHORT_SHA - - name: Push latest build tags for AMD and ARM - run: | - # these are used to construct the final manifest but also cache-from in subsequent runs - docker tag $DOCKER_BUILD_REPOSITORY:amd64-$SHORT_SHA $DOCKER_BUILD_REPOSITORY:amd64 - docker push $DOCKER_BUILD_REPOSITORY:amd64 - docker tag $DOCKER_BUILD_REPOSITORY:arm64-$SHORT_SHA $DOCKER_BUILD_REPOSITORY:arm64 - docker push $DOCKER_BUILD_REPOSITORY:arm64 - - name: Push multiarch manifest - run: | - docker manifest create ${DOCKER_REPOSITORY}:latest $DOCKER_BUILD_REPOSITORY:amd64 $DOCKER_BUILD_REPOSITORY:arm64 - docker manifest push $DOCKER_REPOSITORY:latest - docker manifest create ${DOCKER_REPOSITORY}:$SHORT_SHA $DOCKER_BUILD_REPOSITORY:amd64 $DOCKER_BUILD_REPOSITORY:arm64 - docker manifest push $DOCKER_REPOSITORY:$SHORT_SHA - VERSION=$(grep -Po '(?<=__version__ = ")[^"]*' unstructured/__version__.py) - docker manifest create ${DOCKER_REPOSITORY}:$VERSION $DOCKER_BUILD_REPOSITORY:amd64 $DOCKER_BUILD_REPOSITORY:arm64 - docker manifest push $DOCKER_REPOSITORY:$VERSION + # - name: Push images + # run: | + # # write to the build repository to cache for the publish-images job + # ARCH=$(cut -d "/" -f2 <<< ${{ matrix.docker-platform }}) + # docker push "$DOCKER_BUILD_REPOSITORY:$ARCH-$SHORT_SHA" + # publish-images: + # runs-on: ubuntu-latest-m + # needs: [set-short-sha, build-images] + # env: + # SHORT_SHA: ${{ needs.set-short-sha.outputs.short_sha }} + # steps: + # - uses: docker/setup-buildx-action@v1 + # - name: Checkout code + # uses: actions/checkout@v3 + # - name: Login to Quay.io + # uses: docker/login-action@v1 + # with: + # registry: quay.io + # username: ${{ secrets.QUAY_IO_ROBOT_USERNAME }} + # password: ${{ secrets.QUAY_IO_ROBOT_TOKEN }} + # - name: Pull AMD image + # run: | + # docker pull $DOCKER_BUILD_REPOSITORY:amd64-$SHORT_SHA + # - name: Pull ARM image + # run: | + # docker pull $DOCKER_BUILD_REPOSITORY:arm64-$SHORT_SHA + # - name: Push latest build tags for AMD and ARM + # run: | + # # these are used to construct the final manifest but also cache-from in subsequent runs + # docker tag $DOCKER_BUILD_REPOSITORY:amd64-$SHORT_SHA $DOCKER_BUILD_REPOSITORY:amd64 + # docker push $DOCKER_BUILD_REPOSITORY:amd64 + # docker tag $DOCKER_BUILD_REPOSITORY:arm64-$SHORT_SHA $DOCKER_BUILD_REPOSITORY:arm64 + # docker push $DOCKER_BUILD_REPOSITORY:arm64 + # - name: Push multiarch manifest + # run: | + # docker manifest create ${DOCKER_REPOSITORY}:latest $DOCKER_BUILD_REPOSITORY:amd64 $DOCKER_BUILD_REPOSITORY:arm64 + # docker manifest push $DOCKER_REPOSITORY:latest + # docker manifest create ${DOCKER_REPOSITORY}:$SHORT_SHA $DOCKER_BUILD_REPOSITORY:amd64 $DOCKER_BUILD_REPOSITORY:arm64 + # docker manifest push $DOCKER_REPOSITORY:$SHORT_SHA + # VERSION=$(grep -Po '(?<=__version__ = ")[^"]*' unstructured/__version__.py) + # docker manifest create ${DOCKER_REPOSITORY}:$VERSION $DOCKER_BUILD_REPOSITORY:amd64 $DOCKER_BUILD_REPOSITORY:arm64 + # docker manifest push $DOCKER_REPOSITORY:$VERSION From 67a54fd5d52a84a450d187aa82063c2bbecd1083 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Po=C5=82om?= Date: Tue, 29 Apr 2025 14:41:36 +0200 Subject: [PATCH 3/3] Revert "Test image build" This reverts commit 85b628083c0c7ba027865302c88fbd32c2f431e7. --- .github/workflows/docker-publish.yml | 91 ++++++++++++++-------------- 1 file changed, 44 insertions(+), 47 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index ebe097e711..8705bb39b8 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -2,11 +2,8 @@ name: Build And Push Docker Image on: push: - branches: [ main ] - pull_request: - branches: [ main ] - merge_group: - branches: [ main ] + branches: + - main env: DOCKER_REPOSITORY: quay.io/unstructured-io/unstructured @@ -73,45 +70,45 @@ jobs: make docker-test CI=true TEST_FILE=test_unstructured/partition/test_text.py fi DOCKER_IMAGE=$DOCKER_BUILD_REPOSITORY:$ARCH-$SHORT_SHA make docker-smoke-test - # - name: Push images - # run: | - # # write to the build repository to cache for the publish-images job - # ARCH=$(cut -d "/" -f2 <<< ${{ matrix.docker-platform }}) - # docker push "$DOCKER_BUILD_REPOSITORY:$ARCH-$SHORT_SHA" - # publish-images: - # runs-on: ubuntu-latest-m - # needs: [set-short-sha, build-images] - # env: - # SHORT_SHA: ${{ needs.set-short-sha.outputs.short_sha }} - # steps: - # - uses: docker/setup-buildx-action@v1 - # - name: Checkout code - # uses: actions/checkout@v3 - # - name: Login to Quay.io - # uses: docker/login-action@v1 - # with: - # registry: quay.io - # username: ${{ secrets.QUAY_IO_ROBOT_USERNAME }} - # password: ${{ secrets.QUAY_IO_ROBOT_TOKEN }} - # - name: Pull AMD image - # run: | - # docker pull $DOCKER_BUILD_REPOSITORY:amd64-$SHORT_SHA - # - name: Pull ARM image - # run: | - # docker pull $DOCKER_BUILD_REPOSITORY:arm64-$SHORT_SHA - # - name: Push latest build tags for AMD and ARM - # run: | - # # these are used to construct the final manifest but also cache-from in subsequent runs - # docker tag $DOCKER_BUILD_REPOSITORY:amd64-$SHORT_SHA $DOCKER_BUILD_REPOSITORY:amd64 - # docker push $DOCKER_BUILD_REPOSITORY:amd64 - # docker tag $DOCKER_BUILD_REPOSITORY:arm64-$SHORT_SHA $DOCKER_BUILD_REPOSITORY:arm64 - # docker push $DOCKER_BUILD_REPOSITORY:arm64 - # - name: Push multiarch manifest - # run: | - # docker manifest create ${DOCKER_REPOSITORY}:latest $DOCKER_BUILD_REPOSITORY:amd64 $DOCKER_BUILD_REPOSITORY:arm64 - # docker manifest push $DOCKER_REPOSITORY:latest - # docker manifest create ${DOCKER_REPOSITORY}:$SHORT_SHA $DOCKER_BUILD_REPOSITORY:amd64 $DOCKER_BUILD_REPOSITORY:arm64 - # docker manifest push $DOCKER_REPOSITORY:$SHORT_SHA - # VERSION=$(grep -Po '(?<=__version__ = ")[^"]*' unstructured/__version__.py) - # docker manifest create ${DOCKER_REPOSITORY}:$VERSION $DOCKER_BUILD_REPOSITORY:amd64 $DOCKER_BUILD_REPOSITORY:arm64 - # docker manifest push $DOCKER_REPOSITORY:$VERSION + - name: Push images + run: | + # write to the build repository to cache for the publish-images job + ARCH=$(cut -d "/" -f2 <<< ${{ matrix.docker-platform }}) + docker push "$DOCKER_BUILD_REPOSITORY:$ARCH-$SHORT_SHA" + publish-images: + runs-on: ubuntu-latest-m + needs: [set-short-sha, build-images] + env: + SHORT_SHA: ${{ needs.set-short-sha.outputs.short_sha }} + steps: + - uses: docker/setup-buildx-action@v1 + - name: Checkout code + uses: actions/checkout@v3 + - name: Login to Quay.io + uses: docker/login-action@v1 + with: + registry: quay.io + username: ${{ secrets.QUAY_IO_ROBOT_USERNAME }} + password: ${{ secrets.QUAY_IO_ROBOT_TOKEN }} + - name: Pull AMD image + run: | + docker pull $DOCKER_BUILD_REPOSITORY:amd64-$SHORT_SHA + - name: Pull ARM image + run: | + docker pull $DOCKER_BUILD_REPOSITORY:arm64-$SHORT_SHA + - name: Push latest build tags for AMD and ARM + run: | + # these are used to construct the final manifest but also cache-from in subsequent runs + docker tag $DOCKER_BUILD_REPOSITORY:amd64-$SHORT_SHA $DOCKER_BUILD_REPOSITORY:amd64 + docker push $DOCKER_BUILD_REPOSITORY:amd64 + docker tag $DOCKER_BUILD_REPOSITORY:arm64-$SHORT_SHA $DOCKER_BUILD_REPOSITORY:arm64 + docker push $DOCKER_BUILD_REPOSITORY:arm64 + - name: Push multiarch manifest + run: | + docker manifest create ${DOCKER_REPOSITORY}:latest $DOCKER_BUILD_REPOSITORY:amd64 $DOCKER_BUILD_REPOSITORY:arm64 + docker manifest push $DOCKER_REPOSITORY:latest + docker manifest create ${DOCKER_REPOSITORY}:$SHORT_SHA $DOCKER_BUILD_REPOSITORY:amd64 $DOCKER_BUILD_REPOSITORY:arm64 + docker manifest push $DOCKER_REPOSITORY:$SHORT_SHA + VERSION=$(grep -Po '(?<=__version__ = ")[^"]*' unstructured/__version__.py) + docker manifest create ${DOCKER_REPOSITORY}:$VERSION $DOCKER_BUILD_REPOSITORY:amd64 $DOCKER_BUILD_REPOSITORY:arm64 + docker manifest push $DOCKER_REPOSITORY:$VERSION