Skip to content
Merged
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
57 changes: 51 additions & 6 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ concurrency:
group: integration-${{ github.head_ref || github.ref }}
cancel-in-progress: true

env:
BINK_IMAGES: >-
ghcr.io/alicefr/bink/cluster:latest
ghcr.io/alicefr/bink/node:v1.35-fedora-44-disk
ghcr.io/alicefr/bink/dns:latest
EXTERNAL_IMAGES: >-
docker.io/library/registry:2
docker.io/library/haproxy:lts-alpine
quay.io/libpod/busybox:latest

jobs:
integration-tests:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -80,14 +90,49 @@ jobs:
df -h /
free -h

- name: Get image digests
id: digests
run: |
ALL_DIGESTS=""
for img in $BINK_IMAGES $EXTERNAL_IMAGES; do
digest=$(skopeo inspect --no-creds "docker://${img}" --format '{{.Digest}}')
echo "${img}: ${digest}"
ALL_DIGESTS="${ALL_DIGESTS}${digest}"
done
echo "hash=$(echo -n "${ALL_DIGESTS}" | sha256sum | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"

- name: Restore cached images
id: image-cache
uses: actions/cache/restore@v4
with:
path: /tmp/podman-image-cache
key: podman-images-v2-integration-${{ steps.digests.outputs.hash }}

- name: Load cached images
if: steps.image-cache.outputs.cache-hit == 'true'
run: |
for f in /tmp/podman-image-cache/*.tar; do
sudo podman load -i "$f"
done
sudo podman images --format "table {{.Repository}}:{{.Tag}}\t{{.Size}}"

- name: Pre-pull container images
if: steps.image-cache.outputs.cache-hit != 'true'
run: |
sudo podman pull ghcr.io/alicefr/bink/cluster:latest
sudo podman pull ghcr.io/alicefr/bink/node:v1.35-fedora-44-disk
sudo podman pull ghcr.io/alicefr/bink/dns:latest
sudo podman pull docker.io/library/registry:2
sudo podman pull docker.io/library/haproxy:lts-alpine
sudo podman pull quay.io/libpod/busybox:latest
mkdir -p /tmp/podman-image-cache
for img in $BINK_IMAGES $EXTERNAL_IMAGES; do
sudo podman pull "$img"
name=$(echo "$img" | sed 's|[/:]|_|g')
sudo podman save -o "/tmp/podman-image-cache/${name}.tar" "$img"
done
sudo chown -R $(id -u):$(id -g) /tmp/podman-image-cache

- name: Save image cache
if: steps.image-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: /tmp/podman-image-cache
key: podman-images-v2-integration-${{ steps.digests.outputs.hash }}

- name: Run integration tests
run: sudo make test-integration TEST_PROCS=3
Expand Down
54 changes: 53 additions & 1 deletion .github/workflows/test-container-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ concurrency:
group: container-image-test-${{ github.head_ref || github.ref }}
cancel-in-progress: true

env:
BINK_RUNTIME_IMAGES: >-
ghcr.io/alicefr/bink/cluster:latest
ghcr.io/alicefr/bink/node:v1.35-fedora-44-disk
ghcr.io/alicefr/bink/dns:latest

jobs:
test-container-image:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -52,12 +58,58 @@ jobs:
sudo systemctl start podman.socket
sudo podman info --format '{{.Store.GraphRoot}}'

- name: Get runtime image digests
id: digests
run: |
ALL_DIGESTS=""
for img in $BINK_RUNTIME_IMAGES; do
digest=$(skopeo inspect --no-creds "docker://${img}" --format '{{.Digest}}')
echo "${img}: ${digest}"
ALL_DIGESTS="${ALL_DIGESTS}${digest}"
done
echo "hash=$(echo -n "${ALL_DIGESTS}" | sha256sum | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"

- name: Restore cached images
id: image-cache
uses: actions/cache/restore@v4
with:
path: /tmp/podman-image-cache
key: podman-images-v2-container-test-${{ steps.digests.outputs.hash }}

- name: Load cached images
if: steps.image-cache.outputs.cache-hit == 'true'
run: |
for f in /tmp/podman-image-cache/*.tar; do
sudo podman load -i "$f"
done
sudo podman images --format "table {{.Repository}}:{{.Tag}}\t{{.Size}}"

- name: Pre-pull runtime images
if: steps.image-cache.outputs.cache-hit != 'true'
run: |
mkdir -p /tmp/podman-image-cache
for img in $BINK_RUNTIME_IMAGES; do
sudo podman pull "$img"
name=$(echo "$img" | sed 's|[/:]|_|g')
sudo podman save -o "/tmp/podman-image-cache/${name}.tar" "$img"
done
sudo chown -R $(id -u):$(id -g) /tmp/podman-image-cache

- name: Save image cache
if: steps.image-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: /tmp/podman-image-cache
key: podman-images-v2-container-test-${{ steps.digests.outputs.hash }}

- name: Build bink image
run: sudo make build-bink-image

- name: Test nested mode
run: sudo hack/test-container-image.sh nested
run: sudo -E hack/test-container-image.sh nested
timeout-minutes: 40
env:
IMAGE_CACHE_DIR: /tmp/podman-image-cache

- name: Test socket mode
run: sudo hack/test-container-image.sh socket
Expand Down
12 changes: 12 additions & 0 deletions hack/test-container-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
set -euo pipefail

BINK_IMAGE="${BINK_IMAGE:-ghcr.io/alicefr/bink/bink:latest}"
IMAGE_CACHE_DIR="${IMAGE_CACHE_DIR:-}"
if [ -n "${CONTAINER_HOST:-}" ]; then
PODMAN_SOCK="${CONTAINER_HOST#unix://}"
elif [ -S "/run/podman/podman.sock" ]; then
Expand Down Expand Up @@ -38,11 +39,16 @@ run_test() {
;;
nested)
nested_container="bink-nested-${cluster_name}"
cache_mount=()
if [ -n "${IMAGE_CACHE_DIR}" ] && [ -d "${IMAGE_CACHE_DIR}" ]; then
cache_mount=(-v "${IMAGE_CACHE_DIR}:/cache:ro")
fi
echo "Starting bink daemon container: ${nested_container}"
podman run -d --name "${nested_container}" --privileged \
--device /dev/kvm \
--ulimit core=-1:-1 \
-v "bink-test-storage:/var/lib/containers" \
"${cache_mount[@]}" \
-v "$(pwd):/output" \
"${BINK_IMAGE}"
echo "Waiting for podman service inside container..."
Expand All @@ -56,6 +62,12 @@ run_test() {
# unreachable from inside nested podman networks. Override it so inner aardvark-dns
# forwards queries to a public resolver instead.
podman exec "${nested_container}" bash -c 'echo "nameserver 8.8.8.8" > /etc/resolv.conf'
if podman exec "${nested_container}" test -d /cache; then
echo "Loading cached images into nested podman..."
podman exec "${nested_container}" bash -c 'for f in /cache/*.tar; do [ -f "$f" ] && podman load -i "$f"; done'
echo "Images available in nested podman:"
podman exec "${nested_container}" podman images --format "table {{.Repository}}:{{.Tag}}\t{{.Size}}"
fi
bink_args=(podman exec "${nested_container}" bink)
;;
*)
Expand Down
Loading