Skip to content

Commit e610bf9

Browse files
committed
Use setup-bink action for integration tests
Replace duplicated setup steps with the composite action. Add integration-tests-k8s-versions job for testing non-default K8s versions. Assisted-by: Claude Opus 4.6 (1M context) Signed-off-by: Alice Frosi <afrosi@redhat.com>
1 parent 73754fb commit e610bf9

2 files changed

Lines changed: 66 additions & 102 deletions

File tree

.github/actions/setup-bink/action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ runs:
2525
cat /sys/kernel/mm/ksm/run
2626
2727
- name: Set up Go
28-
uses: actions/setup-go@v5
28+
uses: actions/setup-go@v6
2929
with:
3030
go-version-file: go.mod
3131
cache: true
@@ -85,7 +85,7 @@ runs:
8585
8686
- name: Restore cached images
8787
id: image-cache
88-
uses: actions/cache/restore@v4
88+
uses: actions/cache/restore@v6
8989
with:
9090
path: /tmp/podman-image-cache
9191
key: podman-images-v2-${{ inputs.cache-key-prefix }}-${{ steps.digests.outputs.hash }}
@@ -113,7 +113,7 @@ runs:
113113
114114
- name: Save image cache
115115
if: steps.image-cache.outputs.cache-hit != 'true'
116-
uses: actions/cache/save@v4
116+
uses: actions/cache/save@v6
117117
with:
118118
path: /tmp/podman-image-cache
119119
key: podman-images-v2-${{ inputs.cache-key-prefix }}-${{ steps.digests.outputs.hash }}

.github/workflows/integration-tests.yml

Lines changed: 63 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@ env:
2121
quay.io/libpod/busybox:latest
2222
2323
jobs:
24+
supported-versions:
25+
runs-on: ubuntu-latest
26+
outputs:
27+
matrix: ${{ steps.set-matrix.outputs.matrix }}
28+
steps:
29+
- name: Get supported Kubernetes versions
30+
id: set-matrix
31+
run: |
32+
DEFAULT="1.35"
33+
# Exclude the default version — the integration-tests job already runs the full suite for it
34+
MATRIX=$(curl -s https://endoflife.date/api/kubernetes.json | \
35+
jq -c --arg default "$DEFAULT" \
36+
'[.[] | select(.eol > (now | strftime("%Y-%m-%d"))) | .cycle][:3] | map(select(. != $default))')
37+
echo "matrix=${MATRIX}" >> "$GITHUB_OUTPUT"
38+
2439
integration-tests:
2540
runs-on: ubuntu-latest
2641
timeout-minutes: 120
@@ -29,117 +44,66 @@ jobs:
2944
- name: Checkout code
3045
uses: actions/checkout@v7
3146

32-
- name: Configure kernel for nested containers
33-
run: |
34-
# Unload all AppArmor profiles from the kernel.
35-
# Stopping the service alone doesn't unload them - the passt profile
36-
# blocks remount operations needed for passt's self-sandboxing.
37-
sudo aa-teardown 2>/dev/null || true
38-
# Allow unprivileged user namespace creation (needed by passt inside containers)
39-
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
40-
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
41-
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
42-
43-
- name: Enable KSM (Kernel Same-page Merging)
44-
run: |
45-
sudo sh -c 'echo 1 > /sys/kernel/mm/ksm/run'
46-
sudo sh -c 'echo 5000 > /sys/kernel/mm/ksm/pages_to_scan'
47-
cat /sys/kernel/mm/ksm/run
48-
49-
- name: Set up Go
50-
uses: actions/setup-go@v6
47+
- name: Setup bink
48+
uses: ./.github/actions/setup-bink
5149
with:
52-
go-version-file: go.mod
53-
cache: true
50+
cache-key-prefix: integration
5451

55-
- name: Install system dependencies
56-
run: |
57-
sudo apt-get update
58-
sudo apt-get install -y \
59-
podman \
60-
libgpgme-dev \
61-
libbtrfs-dev \
62-
libdevmapper-dev \
63-
pkg-config
64-
65-
- name: Set up KVM
66-
run: |
67-
# Re-apply after apt-get which may upgrade udev and reset device permissions
68-
sudo chmod 666 /dev/kvm
69-
ls -la /dev/kvm
52+
- name: Run integration tests
53+
run: sudo make test-integration TEST_PROCS=2
54+
timeout-minutes: 90
55+
env:
56+
CONTAINER_HOST: unix:///run/podman/podman.sock
7057

71-
- name: Configure Podman
72-
run: |
73-
podman --version
74-
# Configure containers.conf BEFORE starting the podman socket
75-
sudo mkdir -p /etc/containers
76-
echo '{"defaultAction":"SCMP_ACT_ALLOW"}' | sudo tee /etc/containers/seccomp.json
77-
printf '[containers]\napparmor_profile = "unconfined"\nseccomp_profile = "/etc/containers/seccomp.json"\n' | sudo tee /etc/containers/containers.conf
78-
# Ensure subuid/subgid for root (needed for userns=auto)
79-
grep -q '^root:' /etc/subuid || echo 'root:100000:65536' | sudo tee -a /etc/subuid
80-
grep -q '^root:' /etc/subgid || echo 'root:100000:65536' | sudo tee -a /etc/subgid
81-
sudo systemctl start podman.socket
82-
sudo podman info --format '{{.Store.GraphRoot}}'
83-
84-
- name: Build bink binary
85-
run: sudo make build-bink
86-
87-
- name: Verify prerequisites
88-
run: |
89-
test -f ./bink
90-
sudo podman images --format "table {{.Repository}}:{{.Tag}}\t{{.Size}}"
91-
df -h /
92-
free -h
58+
- name: Collect logs
59+
if: failure()
60+
run: .github/collect-logs.sh
9361

94-
- name: Get image digests
95-
id: digests
96-
run: |
97-
ALL_DIGESTS=""
98-
for img in $BINK_IMAGES $EXTERNAL_IMAGES; do
99-
digest=$(skopeo inspect --no-creds "docker://${img}" --format '{{.Digest}}')
100-
echo "${img}: ${digest}"
101-
ALL_DIGESTS="${ALL_DIGESTS}${digest}"
102-
done
103-
echo "hash=$(echo -n "${ALL_DIGESTS}" | sha256sum | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
104-
105-
- name: Restore cached images
106-
id: image-cache
107-
uses: actions/cache/restore@v6
62+
- name: Upload logs
63+
if: failure()
64+
uses: actions/upload-artifact@v7
10865
with:
109-
path: /tmp/podman-image-cache
110-
key: podman-images-v2-integration-${{ steps.digests.outputs.hash }}
66+
name: test-logs
67+
path: /tmp/bink-logs/
11168

112-
- name: Load cached images
113-
if: steps.image-cache.outputs.cache-hit == 'true'
69+
- name: Cleanup test clusters
70+
if: always()
11471
run: |
115-
for f in /tmp/podman-image-cache/*.tar; do
116-
sudo podman load -i "$f"
117-
done
118-
sudo podman images --format "table {{.Repository}}:{{.Tag}}\t{{.Size}}"
72+
sudo podman ps -a --filter "name=k8s-test-bink" --format '{{.Names}}' | \
73+
xargs -r sudo podman rm -f 2>/dev/null || true
74+
sudo podman volume prune -f 2>/dev/null || true
11975
120-
- name: Pre-pull container images
121-
if: steps.image-cache.outputs.cache-hit != 'true'
122-
run: |
123-
mkdir -p /tmp/podman-image-cache
124-
for img in $BINK_IMAGES $EXTERNAL_IMAGES; do
125-
sudo podman pull "$img"
126-
name=$(echo "$img" | sed 's|[/:]|_|g')
127-
sudo podman save -o "/tmp/podman-image-cache/${name}.tar" "$img"
128-
done
129-
sudo chown -R $(id -u):$(id -g) /tmp/podman-image-cache
130-
131-
- name: Save image cache
132-
if: steps.image-cache.outputs.cache-hit != 'true'
133-
uses: actions/cache/save@v6
76+
integration-tests-k8s-versions:
77+
needs: supported-versions
78+
runs-on: ubuntu-latest
79+
timeout-minutes: 120
80+
strategy:
81+
fail-fast: false
82+
matrix:
83+
kube-minor: ${{ fromJson(needs.supported-versions.outputs.matrix) }}
84+
85+
env:
86+
BINK_NODE_IMAGE: ghcr.io/bootc-dev/bink/node:v${{ matrix.kube-minor }}-fedora-44-disk
87+
BINK_IMAGES: >-
88+
ghcr.io/bootc-dev/bink/cluster:latest
89+
ghcr.io/bootc-dev/bink/node:v${{ matrix.kube-minor }}-fedora-44-disk
90+
ghcr.io/bootc-dev/bink/dns:latest
91+
92+
steps:
93+
- name: Checkout code
94+
uses: actions/checkout@v7
95+
96+
- name: Setup bink
97+
uses: ./.github/actions/setup-bink
13498
with:
135-
path: /tmp/podman-image-cache
136-
key: podman-images-v2-integration-${{ steps.digests.outputs.hash }}
99+
cache-key-prefix: k8s-${{ matrix.kube-minor }}
137100

138-
- name: Run integration tests
139-
run: sudo make test-integration TEST_PROCS=2
101+
- name: Run integration tests (K8s ${{ matrix.kube-minor }})
102+
run: sudo make test-integration GINKGO_FOCUS="should create and initialize a complete Kubernetes cluster"
140103
timeout-minutes: 90
141104
env:
142105
CONTAINER_HOST: unix:///run/podman/podman.sock
106+
BINK_NODE_IMAGE: ${{ env.BINK_NODE_IMAGE }}
143107

144108
- name: Collect logs
145109
if: failure()
@@ -149,7 +113,7 @@ jobs:
149113
if: failure()
150114
uses: actions/upload-artifact@v7
151115
with:
152-
name: test-logs
116+
name: test-logs-k8s-${{ matrix.kube-minor }}
153117
path: /tmp/bink-logs/
154118

155119
- name: Cleanup test clusters

0 commit comments

Comments
 (0)