From 775ce64963434b88f3cd23e5640c411ae7f1e8f7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Mar 2026 04:10:23 +0000 Subject: [PATCH 1/6] Initial plan From d738473d31494fc80f778487572254b1ac6571f8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Mar 2026 04:16:17 +0000 Subject: [PATCH 2/6] Add ARM (linux/arm64) multi-platform Docker image support Co-authored-by: dhalperi <526415+dhalperi@users.noreply.github.com> --- .github/workflows/reusable-precommit.yml | 2 + .github/workflows/reusable-upload.yml | 142 +++++++++++++++++------ allinone.dockerfile | 3 +- batfish.dockerfile | 3 +- 4 files changed, 110 insertions(+), 40 deletions(-) diff --git a/.github/workflows/reusable-precommit.yml b/.github/workflows/reusable-precommit.yml index b0c520d..0cdcf12 100644 --- a/.github/workflows/reusable-precommit.yml +++ b/.github/workflows/reusable-precommit.yml @@ -202,6 +202,8 @@ jobs: tar xzf questions.tgz -C assets cp allinone-bundle.jar assets cp log4j2.yaml assets + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 - name: Build Batfish image diff --git a/.github/workflows/reusable-upload.yml b/.github/workflows/reusable-upload.yml index 73644a8..76e66a8 100644 --- a/.github/workflows/reusable-upload.yml +++ b/.github/workflows/reusable-upload.yml @@ -56,27 +56,64 @@ jobs: if: inputs.BATFISH_GITHUB_BATFISH_REPO == 'batfish/batfish' && inputs.BATFISH_GITHUB_PYBATFISH_REPO == 'batfish/pybatfish' runs-on: ubuntu-latest steps: - - name: Download bf image + - name: Checkout + uses: actions/checkout@v6 + - name: Download jar + uses: actions/download-artifact@v8 + with: + name: bf_jar + - name: Download questions uses: actions/download-artifact@v8 with: - name: bf_image - - name: Download allinone image + name: bf_questions + - name: Download pybf whl + uses: actions/download-artifact@v8 + with: + name: pybf_whl + - name: Download pybf notebooks uses: actions/download-artifact@v8 with: - name: allinone_image + name: pybf_notebooks + - name: Setup Batfish image assets + run: | + mkdir assets + tar xzf questions.tgz -C assets + cp allinone-bundle.jar assets + cp log4j2.yaml assets + - name: Setup Allinone image assets + run: | + cp pybatfish-*.whl assets + TEMP_DIR=$(mktemp -d) + tar xzf pybatfish-notebooks.tgz -C ${TEMP_DIR} + cp -r ${TEMP_DIR}/jupyter_notebooks/ assets/notebooks/ + cp wrapper.sh assets + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v4 - name: DockerHub Login uses: docker/login-action@v4 with: username: ${{ env.BATFISH_DOCKER_LOGIN_USERNAME }} password: ${{ secrets.BATFISH_DOCKER_LOGIN_TOKEN }} - - name: Upload Batfish image - run: | - docker load < bf.tar - docker push batfish/batfish:${{ inputs.test_tag }} - - name: Upload Allinone image - run: | - docker load < allinone.tar - docker push batfish/allinone:${{ inputs.test_tag }} + - name: Build and push Batfish image (multi-platform) + uses: docker/build-push-action@v7 + with: + push: true + file: batfish.dockerfile + platforms: linux/amd64,linux/arm64 + build-args: ASSETS=./assets + tags: batfish/batfish:${{ inputs.test_tag }} + context: . + - name: Build and push Allinone image (multi-platform) + uses: docker/build-push-action@v7 + with: + push: true + file: allinone.dockerfile + platforms: linux/amd64,linux/arm64 + build-args: ASSETS=./assets + tags: batfish/allinone:${{ inputs.test_tag }} + context: . dev_whl_upload: if: inputs.BATFISH_GITHUB_BATFISH_REPO == 'batfish/batfish' && inputs.BATFISH_GITHUB_PYBATFISH_REPO == 'batfish/pybatfish' runs-on: ubuntu-latest @@ -118,41 +155,70 @@ jobs: environment: Release Containers runs-on: ubuntu-latest steps: - - name: Download bf image + - name: Checkout + uses: actions/checkout@v6 + - name: Download jar + uses: actions/download-artifact@v8 + with: + name: bf_jar + - name: Download questions uses: actions/download-artifact@v8 with: - name: bf_image - - name: Download allinone image + name: bf_questions + - name: Download pybf whl + uses: actions/download-artifact@v8 + with: + name: pybf_whl + - name: Download pybf notebooks uses: actions/download-artifact@v8 with: - name: allinone_image + name: pybf_notebooks + - name: Setup Batfish image assets + run: | + mkdir assets + tar xzf questions.tgz -C assets + cp allinone-bundle.jar assets + cp log4j2.yaml assets + - name: Setup Allinone image assets + run: | + cp pybatfish-*.whl assets + TEMP_DIR=$(mktemp -d) + tar xzf pybatfish-notebooks.tgz -C ${TEMP_DIR} + cp -r ${TEMP_DIR}/jupyter_notebooks/ assets/notebooks/ + cp wrapper.sh assets + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v4 - name: DockerHub Login uses: docker/login-action@v4 with: username: ${{ env.BATFISH_DOCKER_LOGIN_USERNAME }} password: ${{ secrets.BATFISH_DOCKER_LOGIN_TOKEN }} - - name: Upload Batfish image - run: | - TEST_TAG="${{ inputs.test_tag }}" - RELEASE_TAG="${{ inputs.release_tag }}" - docker load < bf.tar - # Re-tag with release tag and latest tag - docker tag "batfish/batfish:${TEST_TAG}" "batfish/batfish:${RELEASE_TAG}" - docker tag "batfish/batfish:${TEST_TAG}" "batfish/batfish:latest" - echo placeholder for pushing "batfish/batfish:${RELEASE_TAG}" and "batfish/batfish:latest" - docker push "batfish/batfish:${RELEASE_TAG}" - docker push "batfish/batfish:latest" - - name: Upload Allinone image - run: | - TEST_TAG="${{ inputs.test_tag }}" - RELEASE_TAG="${{ inputs.release_tag }}" - docker load < allinone.tar - # Re-tag with release tag and latest tag - docker tag "batfish/allinone:${TEST_TAG}" "batfish/allinone:${RELEASE_TAG}" - docker tag "batfish/allinone:${TEST_TAG}" "batfish/allinone:latest" - echo placeholder for pushing "batfish/allinone:${RELEASE_TAG}" and "batfish/allinone:latest" - docker push "batfish/allinone:${RELEASE_TAG}" - docker push "batfish/allinone:latest" + - name: Build and push Batfish image (multi-platform) + uses: docker/build-push-action@v7 + with: + push: true + file: batfish.dockerfile + platforms: linux/amd64,linux/arm64 + build-args: ASSETS=./assets + tags: | + batfish/batfish:${{ inputs.test_tag }} + batfish/batfish:${{ inputs.release_tag }} + batfish/batfish:latest + context: . + - name: Build and push Allinone image (multi-platform) + uses: docker/build-push-action@v7 + with: + push: true + file: allinone.dockerfile + platforms: linux/amd64,linux/arm64 + build-args: ASSETS=./assets + tags: | + batfish/allinone:${{ inputs.test_tag }} + batfish/allinone:${{ inputs.release_tag }} + batfish/allinone:latest + context: . prod_whl_upload: if: inputs.queue_prod_release && inputs.BATFISH_GITHUB_BATFISH_REPO == 'batfish/batfish' && inputs.BATFISH_GITHUB_PYBATFISH_REPO == 'batfish/pybatfish' environment: Release Pybatfish diff --git a/allinone.dockerfile b/allinone.dockerfile index d8c78d7..de313db 100644 --- a/allinone.dockerfile +++ b/allinone.dockerfile @@ -8,7 +8,8 @@ ARG ASSETS RUN mkdir -p /data RUN chmod a+rw /data COPY ${ASSETS} ./ -ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64/ +ARG TARGETARCH +ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-${TARGETARCH} ENV JAVA_LIBRARY_PATH=/usr/lib ENV HOME=/data diff --git a/batfish.dockerfile b/batfish.dockerfile index 5dccbe8..c89bc1c 100644 --- a/batfish.dockerfile +++ b/batfish.dockerfile @@ -8,7 +8,8 @@ ARG ASSETS RUN mkdir -p /data RUN chmod a+rw /data COPY ${ASSETS} ./ -ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64/ +ARG TARGETARCH +ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-${TARGETARCH} ENV JAVA_LIBRARY_PATH=/usr/lib ENV HOME=/data From 795735d18c33f34ad9f2cd31359c4c9ec7c8eba1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Mar 2026 04:45:55 +0000 Subject: [PATCH 3/6] Add ARM build verification steps to precommit image_build job Co-authored-by: dhalperi <526415+dhalperi@users.noreply.github.com> --- .github/workflows/reusable-precommit.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/reusable-precommit.yml b/.github/workflows/reusable-precommit.yml index 0cdcf12..8b97471 100644 --- a/.github/workflows/reusable-precommit.yml +++ b/.github/workflows/reusable-precommit.yml @@ -223,6 +223,15 @@ jobs: with: name: bf_image path: /tmp/bf.tar + - name: Build Batfish image (linux/arm64) + uses: docker/build-push-action@v7 + with: + push: false + file: batfish.dockerfile + platforms: linux/arm64 + build-args: ASSETS=./assets + tags: batfish/batfish:test-${{ needs.bf_version.outputs.bf_version }} + context: . - name: Download pybf whl uses: actions/download-artifact@v8 with: @@ -258,3 +267,12 @@ jobs: with: name: allinone_image path: /tmp/allinone.tar + - name: Build allinone image (linux/arm64) + uses: docker/build-push-action@v7 + with: + push: false + file: allinone.dockerfile + platforms: linux/arm64 + build-args: ASSETS=./assets + tags: batfish/allinone:test-${{ needs.bf_version.outputs.bf_version }} + context: . From 103fa247c609bbd954eabc93f4cce7ebc396d949 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Mar 2026 04:54:09 +0000 Subject: [PATCH 4/6] Use native ubuntu-24.04-arm runners for ARM64 image build and testing Co-authored-by: dhalperi <526415+dhalperi@users.noreply.github.com> --- .../workflows/reusable-integration-tests.yml | 93 +++++++++++++++++++ .github/workflows/reusable-precommit.yml | 83 ++++++++++++++--- 2 files changed, 163 insertions(+), 13 deletions(-) diff --git a/.github/workflows/reusable-integration-tests.yml b/.github/workflows/reusable-integration-tests.yml index cb046aa..e5eb951 100644 --- a/.github/workflows/reusable-integration-tests.yml +++ b/.github/workflows/reusable-integration-tests.yml @@ -199,6 +199,51 @@ jobs: popd - name: Stop bf run: docker stop $(docker ps -q) + bf_image_test_arm64: + runs-on: ubuntu-24.04-arm + steps: + - uses: actions/checkout@v6 + - name: Download bf image + uses: actions/download-artifact@v8 + with: + name: bf_image_arm64 + - name: Download pybf whl + uses: actions/download-artifact@v8 + with: + name: pybf_whl + - name: Download pybf notebooks + uses: actions/download-artifact@v8 + with: + name: pybf_notebooks + - name: Download pybf tests + uses: actions/download-artifact@v8 + with: + name: pybf_tests + - name: Download questions + uses: actions/download-artifact@v8 + with: + name: bf_questions + - name: Start bf + run: | + docker load --input bf.tar + docker run -d --net=host batfish/batfish:test-${{ inputs.bf_version }} + - uses: actions/setup-python@v6 + with: + python-version: "3.10" + - name: Setup pybf + run: pip install "$(ls pybatfish-*.whl)"[dev] + - name: Wait for bf + run: tests/wait_for_bf.sh + - name: Run tests + run: | + TEMP_DIR=$(mktemp -d) + tar xzf pybatfish-tests.tgz -C ${TEMP_DIR} + tar xzf pybatfish-notebooks.tgz -C ${TEMP_DIR} + pushd ${TEMP_DIR} + pytest "${TEMP_DIR}/tests/integration" + popd + - name: Stop bf + run: docker stop $(docker ps -q) allinone_image_test: runs-on: ubuntu-latest steps: @@ -247,3 +292,51 @@ jobs: --entrypoint /bin/bash \ batfish/allinone:test-${{ inputs.bf_version }} \ test.sh + allinone_image_test_arm64: + runs-on: ubuntu-24.04-arm + steps: + - uses: actions/checkout@v6 + - name: Download allinone image + uses: actions/download-artifact@v8 + with: + name: allinone_image_arm64 + - name: Download pybf whl + uses: actions/download-artifact@v8 + with: + name: pybf_whl + - name: Download pybf notebooks + uses: actions/download-artifact@v8 + with: + name: pybf_notebooks + - name: Download pybf tests + uses: actions/download-artifact@v8 + with: + name: pybf_tests + - name: Download questions + uses: actions/download-artifact@v8 + with: + name: bf_questions + - uses: actions/setup-python@v6 + with: + python-version: "3.10" + - name: Setup pybf + run: pip install "$(ls pybatfish-*.whl)"[dev] + - name: Run tests inside allinone container + run: | + ABS_SOURCE_DIR="$(realpath .)" + TEMP_DIR=$(mktemp -d) + tar xzf pybatfish-tests.tgz -C ${TEMP_DIR} + tar xzf pybatfish-notebooks.tgz -C ${TEMP_DIR} + tar xzf questions.tgz -C ${TEMP_DIR} + PYBF_WHEEL="$(ls pybatfish-*.whl)" + cp ${PYBF_WHEEL} ${TEMP_DIR} + docker load --input allinone.tar + docker run \ + -v ${ABS_SOURCE_DIR}/tests/test.sh:/test.sh:ro \ + -v ${TEMP_DIR}/tests/:/pybatfish/tests/ \ + -v ${TEMP_DIR}/jupyter_notebooks/:/pybatfish/jupyter_notebooks/ \ + -v ${TEMP_DIR}/questions/:/pybatfish/questions/ \ + -v ${TEMP_DIR}/${PYBF_WHEEL}:/pybatfish/dist/${PYBF_WHEEL} \ + --entrypoint /bin/bash \ + batfish/allinone:test-${{ inputs.bf_version }} \ + test.sh diff --git a/.github/workflows/reusable-precommit.yml b/.github/workflows/reusable-precommit.yml index 8b97471..dd2cdd5 100644 --- a/.github/workflows/reusable-precommit.yml +++ b/.github/workflows/reusable-precommit.yml @@ -202,8 +202,6 @@ jobs: tar xzf questions.tgz -C assets cp allinone-bundle.jar assets cp log4j2.yaml assets - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 - name: Build Batfish image @@ -223,15 +221,6 @@ jobs: with: name: bf_image path: /tmp/bf.tar - - name: Build Batfish image (linux/arm64) - uses: docker/build-push-action@v7 - with: - push: false - file: batfish.dockerfile - platforms: linux/arm64 - build-args: ASSETS=./assets - tags: batfish/batfish:test-${{ needs.bf_version.outputs.bf_version }} - context: . - name: Download pybf whl uses: actions/download-artifact@v8 with: @@ -267,12 +256,80 @@ jobs: with: name: allinone_image path: /tmp/allinone.tar - - name: Build allinone image (linux/arm64) + image_build_arm64: + runs-on: ubuntu-24.04-arm + needs: + - bf_build + - pybf_build + - bf_version + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Download jar + uses: actions/download-artifact@v8 + with: + name: bf_jar + - name: Download questions + uses: actions/download-artifact@v8 + with: + name: bf_questions + - name: Setup Batfish image assets + run: | + mkdir assets + tar xzf questions.tgz -C assets + cp allinone-bundle.jar assets + cp log4j2.yaml assets + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v4 + - name: Build Batfish image (arm64) + uses: docker/build-push-action@v7 + with: + push: false + file: batfish.dockerfile + build-args: ASSETS=./assets + tags: batfish/batfish:test-${{ needs.bf_version.outputs.bf_version }} + labels: | + org.batfish.batfish-tag=${{ needs.bf_version.outputs.bf_sha }} + org.batfish.batfish-version=${{ needs.bf_version.outputs.bf_version }} + outputs: type=docker,dest=/tmp/bf.tar + context: . + - name: Upload Batfish arm64 image + uses: actions/upload-artifact@v7 + with: + name: bf_image_arm64 + path: /tmp/bf.tar + - name: Download pybf whl + uses: actions/download-artifact@v8 + with: + name: pybf_whl + - name: Download pybf notebooks + uses: actions/download-artifact@v8 + with: + name: pybf_notebooks + - name: Setup Allinone image assets + run: | + cp pybatfish-*.whl assets + TEMP_DIR=$(mktemp -d) + tar xzf pybatfish-notebooks.tgz -C ${TEMP_DIR} + cp -r ${TEMP_DIR}/jupyter_notebooks/ assets/notebooks/ + # Script that starts Batfish + Jupyter server + cp wrapper.sh assets + - name: Build allinone image (arm64) uses: docker/build-push-action@v7 with: push: false file: allinone.dockerfile - platforms: linux/arm64 build-args: ASSETS=./assets tags: batfish/allinone:test-${{ needs.bf_version.outputs.bf_version }} + labels: | + org.batfish.allinone-tag=${{ needs.bf_version.outputs.bf_sha }}_${{ needs.bf_version.outputs.pybf_sha }} + org.batfish.batfish-tag=${{ needs.bf_version.outputs.bf_sha }} + org.batfish.pybatfish-tag=${{ needs.bf_version.outputs.pybf_sha }} + org.batfish.batfish-version=${{ needs.bf_version.outputs.bf_version }} + outputs: type=docker,dest=/tmp/allinone.tar context: . + - name: Upload allinone arm64 image + uses: actions/upload-artifact@v7 + with: + name: allinone_image_arm64 + path: /tmp/allinone.tar From 2ddeb1c8c728164549fc2316190e556bed32093d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Mar 2026 16:03:01 +0000 Subject: [PATCH 5/6] Add pybf_cross_version_tests_arm64 job on native ubuntu-24.04-arm runner Co-authored-by: dhalperi <526415+dhalperi@users.noreply.github.com> --- .../workflows/reusable-integration-tests.yml | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/.github/workflows/reusable-integration-tests.yml b/.github/workflows/reusable-integration-tests.yml index e5eb951..f1a53f7 100644 --- a/.github/workflows/reusable-integration-tests.yml +++ b/.github/workflows/reusable-integration-tests.yml @@ -154,6 +154,53 @@ jobs: popd - name: Stop bf run: docker stop $(docker ps -q) + pybf_cross_version_tests_arm64: + runs-on: ubuntu-24.04-arm + if: inputs.run_cross_version_tests + needs: + - get_pybf_versions + strategy: + matrix: + pybf_version: ${{ fromJson(needs.get_pybf_versions.outputs.versions) }} + steps: + - uses: actions/checkout@v6 + - name: Download bf image + uses: actions/download-artifact@v8 + with: + name: bf_image_arm64 + - name: Download pybf tests + uses: actions/download-artifact@v8 + with: + name: pybf_tests + - name: Download pybf notebooks + uses: actions/download-artifact@v8 + with: + name: pybf_notebooks + - name: Download questions + uses: actions/download-artifact@v8 + with: + name: bf_questions + - name: Start bf + run: | + docker load --input bf.tar + docker run -d --net=host batfish/batfish:test-${{ inputs.bf_version }} + - uses: actions/setup-python@v6 + with: + python-version: "3.10" + - name: Setup pybf + run: pip install "pybatfish[dev]==${{ matrix.pybf_version }}" "urllib3<2" + - name: Wait for bf + run: tests/wait_for_bf.sh + - name: Run tests + run: | + TEMP_DIR=$(mktemp -d) + tar xzf pybatfish-tests.tgz -C ${TEMP_DIR} + tar xzf pybatfish-notebooks.tgz -C ${TEMP_DIR} + pushd ${TEMP_DIR} + pytest -k "not test_notebook_output" "${TEMP_DIR}/tests/integration" + popd + - name: Stop bf + run: docker stop $(docker ps -q) bf_image_test: runs-on: ubuntu-latest steps: From 779ff6b90d1a4951c8e98025da09fbcfbefc0a4b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Mar 2026 18:51:09 +0000 Subject: [PATCH 6/6] Use matrix strategy to collapse duplicate amd64/arm64 jobs Co-authored-by: dhalperi <526415+dhalperi@users.noreply.github.com> --- .../workflows/reusable-integration-tests.yml | 169 +++--------------- .github/workflows/reusable-precommit.yml | 96 ++-------- 2 files changed, 38 insertions(+), 227 deletions(-) diff --git a/.github/workflows/reusable-integration-tests.yml b/.github/workflows/reusable-integration-tests.yml index f1a53f7..9b092b3 100644 --- a/.github/workflows/reusable-integration-tests.yml +++ b/.github/workflows/reusable-integration-tests.yml @@ -108,19 +108,24 @@ jobs: pytest -k "not test_notebook_output" "${TEMP_DIR}/tests/integration" popd pybf_cross_version_tests: - runs-on: ubuntu-latest + runs-on: ${{ matrix.platform.runner }} if: inputs.run_cross_version_tests needs: - get_pybf_versions strategy: matrix: + platform: + - runner: ubuntu-latest + bf_artifact: bf_image + - runner: ubuntu-24.04-arm + bf_artifact: bf_image_arm64 pybf_version: ${{ fromJson(needs.get_pybf_versions.outputs.versions) }} steps: - uses: actions/checkout@v6 - name: Download bf image uses: actions/download-artifact@v8 with: - name: bf_image + name: ${{ matrix.platform.bf_artifact }} - name: Download pybf tests uses: actions/download-artifact@v8 with: @@ -154,106 +159,21 @@ jobs: popd - name: Stop bf run: docker stop $(docker ps -q) - pybf_cross_version_tests_arm64: - runs-on: ubuntu-24.04-arm - if: inputs.run_cross_version_tests - needs: - - get_pybf_versions + bf_image_test: + runs-on: ${{ matrix.runner }} strategy: matrix: - pybf_version: ${{ fromJson(needs.get_pybf_versions.outputs.versions) }} - steps: - - uses: actions/checkout@v6 - - name: Download bf image - uses: actions/download-artifact@v8 - with: - name: bf_image_arm64 - - name: Download pybf tests - uses: actions/download-artifact@v8 - with: - name: pybf_tests - - name: Download pybf notebooks - uses: actions/download-artifact@v8 - with: - name: pybf_notebooks - - name: Download questions - uses: actions/download-artifact@v8 - with: - name: bf_questions - - name: Start bf - run: | - docker load --input bf.tar - docker run -d --net=host batfish/batfish:test-${{ inputs.bf_version }} - - uses: actions/setup-python@v6 - with: - python-version: "3.10" - - name: Setup pybf - run: pip install "pybatfish[dev]==${{ matrix.pybf_version }}" "urllib3<2" - - name: Wait for bf - run: tests/wait_for_bf.sh - - name: Run tests - run: | - TEMP_DIR=$(mktemp -d) - tar xzf pybatfish-tests.tgz -C ${TEMP_DIR} - tar xzf pybatfish-notebooks.tgz -C ${TEMP_DIR} - pushd ${TEMP_DIR} - pytest -k "not test_notebook_output" "${TEMP_DIR}/tests/integration" - popd - - name: Stop bf - run: docker stop $(docker ps -q) - bf_image_test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - name: Download bf image - uses: actions/download-artifact@v8 - with: - name: bf_image - - name: Download pybf whl - uses: actions/download-artifact@v8 - with: - name: pybf_whl - - name: Download pybf notebooks - uses: actions/download-artifact@v8 - with: - name: pybf_notebooks - - name: Download pybf tests - uses: actions/download-artifact@v8 - with: - name: pybf_tests - - name: Download questions - uses: actions/download-artifact@v8 - with: - name: bf_questions - - name: Start bf - run: | - docker load --input bf.tar - docker run -d --net=host batfish/batfish:test-${{ inputs.bf_version }} - - uses: actions/setup-python@v6 - with: - python-version: "3.10" - - name: Setup pybf - run: pip install "$(ls pybatfish-*.whl)"[dev] - - name: Wait for bf - run: tests/wait_for_bf.sh - - name: Run tests - run: | - TEMP_DIR=$(mktemp -d) - tar xzf pybatfish-tests.tgz -C ${TEMP_DIR} - tar xzf pybatfish-notebooks.tgz -C ${TEMP_DIR} - pushd ${TEMP_DIR} - pytest "${TEMP_DIR}/tests/integration" - popd - - name: Stop bf - run: docker stop $(docker ps -q) - bf_image_test_arm64: - runs-on: ubuntu-24.04-arm + include: + - runner: ubuntu-latest + bf_artifact: bf_image + - runner: ubuntu-24.04-arm + bf_artifact: bf_image_arm64 steps: - uses: actions/checkout@v6 - name: Download bf image uses: actions/download-artifact@v8 with: - name: bf_image_arm64 + name: ${{ matrix.bf_artifact }} - name: Download pybf whl uses: actions/download-artifact@v8 with: @@ -292,61 +212,20 @@ jobs: - name: Stop bf run: docker stop $(docker ps -q) allinone_image_test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - name: Download allinone image - uses: actions/download-artifact@v8 - with: - name: allinone_image - - name: Download pybf whl - uses: actions/download-artifact@v8 - with: - name: pybf_whl - - name: Download pybf notebooks - uses: actions/download-artifact@v8 - with: - name: pybf_notebooks - - name: Download pybf tests - uses: actions/download-artifact@v8 - with: - name: pybf_tests - - name: Download questions - uses: actions/download-artifact@v8 - with: - name: bf_questions - - uses: actions/setup-python@v6 - with: - python-version: "3.10" - - name: Setup pybf - run: pip install "$(ls pybatfish-*.whl)"[dev] - - name: Run tests inside allinone container - run: | - ABS_SOURCE_DIR="$(realpath .)" - TEMP_DIR=$(mktemp -d) - tar xzf pybatfish-tests.tgz -C ${TEMP_DIR} - tar xzf pybatfish-notebooks.tgz -C ${TEMP_DIR} - tar xzf questions.tgz -C ${TEMP_DIR} - PYBF_WHEEL="$(ls pybatfish-*.whl)" - cp ${PYBF_WHEEL} ${TEMP_DIR} - docker load --input allinone.tar - docker run \ - -v ${ABS_SOURCE_DIR}/tests/test.sh:/test.sh:ro \ - -v ${TEMP_DIR}/tests/:/pybatfish/tests/ \ - -v ${TEMP_DIR}/jupyter_notebooks/:/pybatfish/jupyter_notebooks/ \ - -v ${TEMP_DIR}/questions/:/pybatfish/questions/ \ - -v ${TEMP_DIR}/${PYBF_WHEEL}:/pybatfish/dist/${PYBF_WHEEL} \ - --entrypoint /bin/bash \ - batfish/allinone:test-${{ inputs.bf_version }} \ - test.sh - allinone_image_test_arm64: - runs-on: ubuntu-24.04-arm + runs-on: ${{ matrix.runner }} + strategy: + matrix: + include: + - runner: ubuntu-latest + image_artifact: allinone_image + - runner: ubuntu-24.04-arm + image_artifact: allinone_image_arm64 steps: - uses: actions/checkout@v6 - name: Download allinone image uses: actions/download-artifact@v8 with: - name: allinone_image_arm64 + name: ${{ matrix.image_artifact }} - name: Download pybf whl uses: actions/download-artifact@v8 with: diff --git a/.github/workflows/reusable-precommit.yml b/.github/workflows/reusable-precommit.yml index dd2cdd5..46bee20 100644 --- a/.github/workflows/reusable-precommit.yml +++ b/.github/workflows/reusable-precommit.yml @@ -180,11 +180,20 @@ jobs: name: pybf_notebooks path: pybatfish-notebooks.tgz image_build: - runs-on: ubuntu-latest + runs-on: ${{ matrix.runner }} needs: - bf_build - pybf_build - bf_version + strategy: + matrix: + include: + - runner: ubuntu-latest + bf_artifact: bf_image + allinone_artifact: allinone_image + - runner: ubuntu-24.04-arm + bf_artifact: bf_image_arm64 + allinone_artifact: allinone_image_arm64 steps: - name: Checkout uses: actions/checkout@v6 @@ -216,10 +225,10 @@ jobs: org.batfish.batfish-version=${{ needs.bf_version.outputs.bf_version }} outputs: type=docker,dest=/tmp/bf.tar context: . - - name: Upload docker image + - name: Upload Batfish image uses: actions/upload-artifact@v7 with: - name: bf_image + name: ${{ matrix.bf_artifact }} path: /tmp/bf.tar - name: Download pybf whl uses: actions/download-artifact@v8 @@ -251,85 +260,8 @@ jobs: org.batfish.batfish-version=${{ needs.bf_version.outputs.bf_version }} outputs: type=docker,dest=/tmp/allinone.tar context: . - - name: Upload docker image - uses: actions/upload-artifact@v7 - with: - name: allinone_image - path: /tmp/allinone.tar - image_build_arm64: - runs-on: ubuntu-24.04-arm - needs: - - bf_build - - pybf_build - - bf_version - steps: - - name: Checkout - uses: actions/checkout@v6 - - name: Download jar - uses: actions/download-artifact@v8 - with: - name: bf_jar - - name: Download questions - uses: actions/download-artifact@v8 - with: - name: bf_questions - - name: Setup Batfish image assets - run: | - mkdir assets - tar xzf questions.tgz -C assets - cp allinone-bundle.jar assets - cp log4j2.yaml assets - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v4 - - name: Build Batfish image (arm64) - uses: docker/build-push-action@v7 - with: - push: false - file: batfish.dockerfile - build-args: ASSETS=./assets - tags: batfish/batfish:test-${{ needs.bf_version.outputs.bf_version }} - labels: | - org.batfish.batfish-tag=${{ needs.bf_version.outputs.bf_sha }} - org.batfish.batfish-version=${{ needs.bf_version.outputs.bf_version }} - outputs: type=docker,dest=/tmp/bf.tar - context: . - - name: Upload Batfish arm64 image - uses: actions/upload-artifact@v7 - with: - name: bf_image_arm64 - path: /tmp/bf.tar - - name: Download pybf whl - uses: actions/download-artifact@v8 - with: - name: pybf_whl - - name: Download pybf notebooks - uses: actions/download-artifact@v8 - with: - name: pybf_notebooks - - name: Setup Allinone image assets - run: | - cp pybatfish-*.whl assets - TEMP_DIR=$(mktemp -d) - tar xzf pybatfish-notebooks.tgz -C ${TEMP_DIR} - cp -r ${TEMP_DIR}/jupyter_notebooks/ assets/notebooks/ - # Script that starts Batfish + Jupyter server - cp wrapper.sh assets - - name: Build allinone image (arm64) - uses: docker/build-push-action@v7 - with: - push: false - file: allinone.dockerfile - build-args: ASSETS=./assets - tags: batfish/allinone:test-${{ needs.bf_version.outputs.bf_version }} - labels: | - org.batfish.allinone-tag=${{ needs.bf_version.outputs.bf_sha }}_${{ needs.bf_version.outputs.pybf_sha }} - org.batfish.batfish-tag=${{ needs.bf_version.outputs.bf_sha }} - org.batfish.pybatfish-tag=${{ needs.bf_version.outputs.pybf_sha }} - org.batfish.batfish-version=${{ needs.bf_version.outputs.bf_version }} - outputs: type=docker,dest=/tmp/allinone.tar - context: . - - name: Upload allinone arm64 image + - name: Upload allinone image uses: actions/upload-artifact@v7 with: - name: allinone_image_arm64 + name: ${{ matrix.allinone_artifact }} path: /tmp/allinone.tar