Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 58 additions & 49 deletions .github/workflows/reusable-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,18 @@ jobs:
uses: actions/download-artifact@v4
with:
name: bf_questions
- name: Set up docker-ce
uses: docker/setup-docker-action@v4
- name: Start bf
run: |
docker load --input bf.tar
ls -la bf.tar
tar tvf bf.tar
dpkg -l |grep docker
docker --version
docker image load --help
cat /etc/lsb-release
docker image load --input bf.tar --platform linux/amd64
docker images
docker run -d --net=host batfish/batfish:test-${{ inputs.bf_version }}
- uses: actions/setup-python@v5
with:
Expand All @@ -199,51 +208,51 @@ jobs:
popd
- name: Stop bf
run: docker stop $(docker ps -q)
allinone_image_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download allinone image
uses: actions/download-artifact@v4
with:
name: allinone_image
- name: Download pybf whl
uses: actions/download-artifact@v4
with:
name: pybf_whl
- name: Download pybf notebooks
uses: actions/download-artifact@v4
with:
name: pybf_notebooks
- name: Download pybf tests
uses: actions/download-artifact@v4
with:
name: pybf_tests
- name: Download questions
uses: actions/download-artifact@v4
with:
name: bf_questions
- uses: actions/setup-python@v5
with:
python-version: 3.9
- 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:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Download allinone image
# uses: actions/download-artifact@v4
# with:
# name: allinone_image
# - name: Download pybf whl
# uses: actions/download-artifact@v4
# with:
# name: pybf_whl
# - name: Download pybf notebooks
# uses: actions/download-artifact@v4
# with:
# name: pybf_notebooks
# - name: Download pybf tests
# uses: actions/download-artifact@v4
# with:
# name: pybf_tests
# - name: Download questions
# uses: actions/download-artifact@v4
# with:
# name: bf_questions
# - uses: actions/setup-python@v5
# with:
# python-version: 3.9
# - 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
78 changes: 40 additions & 38 deletions .github/workflows/reusable-precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ jobs:
cp allinone-bundle.jar assets
cp log4j2.yaml assets
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Build Batfish image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
push: false
file: batfish.dockerfile
Expand All @@ -214,45 +214,47 @@ jobs:
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
outputs: type=oci,dest=/tmp/bf.tar
context: .
platforms: linux/amd64, linux/arm64
- name: Upload docker image
uses: actions/upload-artifact@v4
with:
name: bf_image
path: /tmp/bf.tar
- name: Download pybf whl
uses: actions/download-artifact@v4
with:
name: pybf_whl
- name: Download pybf notebooks
uses: actions/download-artifact@v4
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
uses: docker/build-push-action@v3
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 docker image
uses: actions/upload-artifact@v4
with:
name: allinone_image
path: /tmp/allinone.tar
# - name: Download pybf whl
# uses: actions/download-artifact@v4
# with:
# name: pybf_whl
# - name: Download pybf notebooks
# uses: actions/download-artifact@v4
# 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
# uses: docker/build-push-action@v6
# 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=oci,dest=/tmp/allinone.tar
# context: .
# platforms: linux/amd64, linux/arm64
# - name: Upload docker image
# uses: actions/upload-artifact@v4
# with:
# name: allinone_image
# path: /tmp/allinone.tar
12 changes: 11 additions & 1 deletion allinone.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@ FROM ubuntu:24.04
# and questions/ directory (containing question templates to be loaded by Batfish)
ARG ASSETS

# multi-platform pre-defined args
ARG BUILDPLATFORM
ARG BUILDOS
ARG BUILDARCH
ARG BUILDVARIANT
ARG TARGETPLATFORM
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT

# Make /data dir available to any user, so this container can be run by any user
RUN mkdir -p /data
RUN chmod a+rw /data
COPY ${ASSETS} ./
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64/
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-$TARGETARCH/
ENV JAVA_LIBRARY_PATH=/usr/lib
ENV HOME=/data

Expand Down
12 changes: 11 additions & 1 deletion batfish.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@ FROM ubuntu:24.04
# and questions/ directory (containing question templates to be loaded by Batfish)
ARG ASSETS

# multi-platform pre-defined args
ARG BUILDPLATFORM
ARG BUILDOS
ARG BUILDARCH
ARG BUILDVARIANT
ARG TARGETPLATFORM
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT

# Make /data dir available to any user, so this container can be run by any user
RUN mkdir -p /data
RUN chmod a+rw /data
COPY ${ASSETS} ./
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64/
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-$TARGETARCH/
ENV JAVA_LIBRARY_PATH=/usr/lib
ENV HOME=/data

Expand Down
Loading