Add a release pipeline including tests for Bird2 and VPP

This commit is contained in:
2026-04-05 17:34:30 +02:00
parent a7fb7db978
commit 9fc41679fd
20 changed files with 806 additions and 160 deletions

131
Makefile Normal file
View File

@@ -0,0 +1,131 @@
IMG := git.ipng.ch/ipng/vpp-containerlab
BUILDHOST := jessica-orb
BUILDDIR := ~/src/.vpp-containerlab-build
VPPDEBS := $(HOME)/src/vpp/build-root
TEST ?= tests/
.PHONY: all help preflight build build-amd64 build-arm64 sync-arm64 test test-amd64 test-arm64 \
push push-amd64 push-arm64 release stable venv
help:
@echo "vpp-containerlab build, test and release"
@echo ""
@echo "Typical workflow:"
@echo " 1. make venv Set up local Robot Framework venv (once, or after requirements change)"
@echo " 2. make preflight Verify VPP debs in VPPDEBS= on summer and jessica-orb"
@echo " 3. make build-amd64 Build image locally for amd64 (sideloading VPPDEBS)"
@echo " 4. make test-amd64 Run e2e tests locally against the amd64 image"
@echo " 5. make sync-arm64 Rsync working tree to jessica-orb and set up venv there"
@echo " 6. make build-arm64 Build image on jessica-orb for arm64 (sideloading VPPDEBS)"
@echo " 7. make test-arm64 Run e2e tests on jessica-orb against the arm64 image"
@echo " 8. make push-amd64 Tag and push :latest-amd64 to the registry"
@echo " 9. make push-arm64 Tag and push :latest-arm64 to the registry (runs on jessica-orb)"
@echo " 10. make release Combine into a single :latest multi-arch manifest"
@echo ""
@echo " make all Run steps 2-10 in one go (venv must already exist)"
@echo " make build Run steps 3+5+6 (sync-arm64 + both builds)"
@echo " make test Run steps 4+7 (both test suites)"
@echo " make push Run steps 8+9 (both pushes)"
@echo " make release Run step 10 (publish into a multi-arch manifest)"
@echo " make stable When all tests pass on amd64+arm64, push this ':latest' as :stable'"
@echo ""
@echo "Variables (override on command line):"
@echo " VPPDEBS=~/src/vpp/build-root Directory of locally-built VPP .deb packages"
@echo " TEST=tests/02-vpp-frr Run only a specific test suite (default: all)"
# Build both platforms, test both, push both, then combine into :latest.
all: preflight build test push release
build: build-amd64 sync-arm64 build-arm64
test: test-amd64 test-arm64
push: push-amd64 push-arm64
# -------------------------------------------------------------------------
# Preflight — validate VPP debs on summer and jessica-orb
# -------------------------------------------------------------------------
# Check locally, then pipe the same script to jessica-orb over SSH,
# passing the local version so jessica-orb can assert both machines match.
preflight:
python3 scripts/check-vppdebs.py $(VPPDEBS)
$(eval VPP_VERSION := $(shell python3 scripts/check-vppdebs.py --print-version $(VPPDEBS)))
ssh $(BUILDHOST) python3 - --assert-version $(VPP_VERSION) $(VPPDEBS) < scripts/check-vppdebs.py
# -------------------------------------------------------------------------
# Local venv (summer)
# -------------------------------------------------------------------------
tests/.venv: tests/requirements.txt
python3 -m venv tests/.venv
tests/.venv/bin/pip install -q -r tests/requirements.txt
venv: tests/.venv
# -------------------------------------------------------------------------
# amd64 — runs locally on summer
# -------------------------------------------------------------------------
build-amd64:
docker buildx build --no-cache --load --platform linux/amd64 \
--build-context vppdebs=$(VPPDEBS) \
--tag $(IMG):latest-amd64-test \
-f docker/Dockerfile docker/
test-amd64: tests/.venv
IMAGE=$(IMG):latest-amd64-test tests/rf-run.sh docker $(TEST)
push-amd64:
docker tag $(IMG):latest-amd64-test $(IMG):latest-amd64
docker push $(IMG):latest-amd64
# -------------------------------------------------------------------------
# arm64 — runs on jessica-orb via rsync + SSH
# -------------------------------------------------------------------------
# Wipe and re-sync summer's working tree to a stable directory on jessica-orb,
# then set up the robot venv there.
sync-arm64:
@case "$(BUILDDIR)" in \
.*|/*) echo "ERROR: BUILDDIR '$(BUILDDIR)' must not start with '.' or '/'" >&2; exit 1;; \
esac
ssh $(BUILDHOST) "rm -rf $(BUILDDIR) && mkdir -p $(BUILDDIR)"
rsync -a --exclude='.git' --exclude='tests/.venv' --exclude='tests/out' \
./ $(BUILDHOST):$(BUILDDIR)/
ssh $(BUILDHOST) "cd $(BUILDDIR) && \
python3 -m venv tests/.venv && \
tests/.venv/bin/pip install -q -r tests/requirements.txt"
build-arm64:
ssh $(BUILDHOST) "cd $(BUILDDIR) && \
docker buildx build --no-cache --load --platform linux/arm64 \
--build-context vppdebs=$(VPPDEBS) \
--tag $(IMG):latest-arm64-test \
-f docker/Dockerfile docker/"
test-arm64:
ssh $(BUILDHOST) "cd $(BUILDDIR) && \
IMAGE=$(IMG):latest-arm64-test \
tests/rf-run.sh docker $(TEST)"
push-arm64:
ssh $(BUILDHOST) "docker tag $(IMG):latest-arm64-test $(IMG):latest-arm64 && \
docker push $(IMG):latest-arm64"
# -------------------------------------------------------------------------
# Release — combine amd64 + arm64 into a single :latest manifest
# -------------------------------------------------------------------------
release:
docker buildx imagetools create \
--tag $(IMG):latest \
$(IMG):latest-amd64 \
$(IMG):latest-arm64
# -------------------------------------------------------------------------
# Stable — mark latest release as stable. Only do this if all tests pass
# -------------------------------------------------------------------------
stable:
docker buildx imagetools create \
--tag $(IMG):stable \
$(IMG):latest-amd64 \
$(IMG):latest-arm64