Skip to content

Commit 822e7c0

Browse files
committed
integration-tests: add buildkit autoscaling scale test
Burst 8 parallel buildctl builds per arch (each holds a maxconn=1 slot ~10m via sleep). With amd64_min=2 they serialize ~43m > timeout 30m and fail unless KEDA scales the pool up; one wave ~18m when it does. ghstack-source-id: e1a1a45 Pull-Request: #725
1 parent 9c88d15 commit 822e7c0

5 files changed

Lines changed: 96 additions & 13 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Holds one BuildKit slot (~10 min) so a burst of parallel builds exceeds the
2+
# warm baseline and forces KEDA scale-up. CACHEBUST differs per build so each
3+
# actually runs (no layer reuse).
4+
FROM alpine:3.21
5+
ARG CACHEBUST
6+
RUN echo "osdc buildkit scale-test ${CACHEBUST}" && sleep 600

osdc/integration-tests/scripts/python/phases.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -276,15 +276,17 @@ def prepare_pr(
276276
# Write integration test workflow
277277
(workflows_dir / "integration-test.yaml").write_text(workflow_content)
278278

279-
# Copy build-image reusable workflow
280-
build_wf_src = upstream_dir / "integration-tests" / "workflows" / "build-image.yaml"
281-
(workflows_dir / "build-image.yaml").write_text(build_wf_src.read_text())
282-
283-
# Copy test Dockerfile
284-
docker_dir = canary_path / "docker" / "test-buildkit"
285-
docker_dir.mkdir(parents=True, exist_ok=True)
286-
dockerfile_src = upstream_dir / "integration-tests" / "docker" / "test-buildkit" / "Dockerfile"
287-
(docker_dir / "Dockerfile").write_text(dockerfile_src.read_text())
279+
# Copy reusable BuildKit workflows
280+
wf_root = upstream_dir / "integration-tests" / "workflows"
281+
for wf in ("build-image.yaml", "build-image-scale.yaml"):
282+
(workflows_dir / wf).write_text((wf_root / wf).read_text())
283+
284+
# Copy test Dockerfiles (connectivity + autoscaling scale test)
285+
docker_root = upstream_dir / "integration-tests" / "docker"
286+
for name in ("test-buildkit", "test-buildkit-scale"):
287+
dst = canary_path / "docker" / name
288+
dst.mkdir(parents=True, exist_ok=True)
289+
(dst / "Dockerfile").write_text((docker_root / name / "Dockerfile").read_text())
288290

289291
# Commit
290292
run_cmd(["git", "add", "-A"], cwd=canary_path)

osdc/integration-tests/scripts/python/test_run.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,13 @@ def workflow_template(tmp_path):
112112
)
113113
(wf_dir / "integration-test.yaml.tpl").write_text(template)
114114

115-
# Also create build-image.yaml and Dockerfile for prepare_pr
115+
# Also create reusable workflows and Dockerfiles for prepare_pr
116116
(wf_dir / "build-image.yaml").write_text("name: build-image\n")
117-
docker_dir = upstream / "integration-tests" / "docker" / "test-buildkit"
118-
docker_dir.mkdir(parents=True)
119-
(docker_dir / "Dockerfile").write_text("FROM alpine\n")
117+
(wf_dir / "build-image-scale.yaml").write_text("name: build-image-scale\n")
118+
for name in ("test-buildkit", "test-buildkit-scale"):
119+
docker_dir = upstream / "integration-tests" / "docker" / name
120+
docker_dir.mkdir(parents=True)
121+
(docker_dir / "Dockerfile").write_text("FROM alpine\n")
120122

121123
return upstream
122124

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Reusable workflow: BuildKit autoscaling scale test.
2+
# Launches a burst of 8 parallel builds against one arch's remote BuildKit, each
3+
# holding a slot (server maxconn=1) for ~10 min via a sleep. The warm baseline
4+
# (amd64_min / arm64_min) is below the burst, so the builds finish within
5+
# timeout-minutes only if KEDA scales the pool up. Without scale-up they
6+
# serialize through the baseline pods and the back of the queue times out — i.e.
7+
# this job FAILS when autoscaling does not happen.
8+
name: BuildKit Scale Test
9+
10+
on:
11+
workflow_call:
12+
inputs:
13+
arch:
14+
description: "Target architecture (amd64 or arm64)"
15+
required: true
16+
type: string
17+
runner_label:
18+
description: "Runner label to use (includes cluster prefix)"
19+
required: false
20+
type: string
21+
default: "l-x86iavx512-2-4"
22+
23+
jobs:
24+
scale:
25+
# Runs on x86 — BuildKit is a *remote* builder; arch selects the endpoint.
26+
# timeout-minutes is the gate: scaled-up ~18 min, serialized ~43 min.
27+
runs-on: ${{ inputs.runner_label }}
28+
timeout-minutes: 30
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
replica: [1, 2, 3, 4, 5, 6, 7, 8]
33+
container:
34+
image: ghcr.io/actions/actions-runner:latest
35+
steps:
36+
- name: Install buildctl
37+
run: |
38+
BUILDKIT_VERSION="v0.29.0"
39+
mkdir -p "$HOME/.local/bin"
40+
curl -sSL "https://github.com/moby/buildkit/releases/download/${BUILDKIT_VERSION}/buildkit-${BUILDKIT_VERSION}.linux-amd64.tar.gz" \
41+
| tar xz --strip-components=1 -C "$HOME/.local/bin" bin/buildctl
42+
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
43+
"$HOME/.local/bin/buildctl" --version
44+
45+
- name: Checkout
46+
uses: actions/checkout@v4
47+
48+
- name: Occupy a BuildKit slot (~10 min) to drive autoscaling
49+
run: |
50+
ENDPOINT="tcp://buildkitd-${{ inputs.arch }}.buildkit:1234"
51+
echo "Build ${{ matrix.replica }} -> $ENDPOINT"
52+
buildctl --addr "$ENDPOINT" build \
53+
--frontend dockerfile.v0 \
54+
--local context=docker/test-buildkit-scale \
55+
--local dockerfile=docker/test-buildkit-scale \
56+
--opt build-arg:CACHEBUST=${{ inputs.arch }}-${{ matrix.replica }}-${{ github.run_id }} \
57+
--no-cache \
58+
--output type=cacheonly
59+
echo "PASS: build ${{ matrix.replica }} finished within timeout"

osdc/integration-tests/workflows/integration-test.yaml.tpl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,6 +1514,20 @@ jobs:
15141514
arch: arm64
15151515
runner_label: {{PREFIX}}l-x86iamx-8-32
15161516

1517+
# ── BuildKit Autoscaling Scale Test ───────────────────────────────────
1518+
# Bursts 8 parallel builds per arch; fails if KEDA does not scale the pool up.
1519+
buildkit-scale-amd64:
1520+
uses: ./.github/workflows/build-image-scale.yaml
1521+
with:
1522+
arch: amd64
1523+
runner_label: {{PREFIX}}l-x86iamx-8-32
1524+
1525+
buildkit-scale-arm64:
1526+
uses: ./.github/workflows/build-image-scale.yaml
1527+
with:
1528+
arch: arm64
1529+
runner_label: {{PREFIX}}l-x86iamx-8-32
1530+
15171531
# ── Harbor Cache Test ─────────────────────────────────────────────────
15181532
test-harbor:
15191533
runs-on: {{PREFIX}}l-x86iamx-8-32

0 commit comments

Comments
 (0)