A base image that has to match the tree it came from
Three images build out of one repository, and for a year the two that mattered were built on whatever base happened to be published at the time.
The STP repository holds three Docker images. base/ compiles the Osmocom SIGTRAN stack (libosmocore, libosmo-netif, libosmo-sigtran) and is where all the build time goes (nine minutes of it, measured below). The two variants on top of it, one per roaming partner, copy in a config template and a test directory; neither compiles anything. Partner A's variant ships three environment files (one per point-code branch), Partner B's one, and both run the same osmo-stp.
The stale base
A variant's Dockerfile takes BASE_STP_IMAGE as a build argument, and that argument used to resolve to the last base image anyone had pushed. So a change under base/ was never built together with the variants that depend on it. On a pull request the variant builds used main's base — the change under review was not in the image being tested. On the push to main they raced the base workflow and could publish a variant built on the previous base.
The fix is a label. Every base image records the git tree hash of the base/ directory it was built from:
# base/Makefile
DOCKER_BUILD_ARGS=--label base-tree=$(shell git rev-parse HEAD:./)
and ensure-base-image.sh uses a published base only when that label matches the checkout:
want=$(git -C "$here" rev-parse HEAD:base)
...
if [ "$(label "$image")" = "$want" ]; then
docker tag "$image" "$local_tag"; exit 0
fi
echo "base image: none published for base-tree $want, building base"
make -C "$here/base" build
Two published tags are tried, in order: main, then red off main. Published tags also changed meaning — main for main builds, red for every other ref — so a manually dispatched branch build can no longer replace the base that main builds use. BASE_IMAGE_TAG=<tag> pins a published base and skips the check entirely.
A variant job may now have to build base itself, which is why the variant workflows moved to the extra-large runner group and gained base/** in their path filters (alongside common.mk and the two base scripts).
Runner sizing, and a concurrency group nobody noticed
Base compiles with make -j$(nproc). On the default runner (1 vCPU) that step took around nine minutes, so base was moved to a larger runner group. The variants only copy a template and stayed where they were.
The second half of that commit was less obvious. All three workflows called the shared build workflow without setting workflow_name, so all three inherited its default (docker-image) and shared one concurrency group. A pull request touching base/ and a variant started two runs that cancelled each other.
A test that could fail
make test in the base image ran a placeholder, and a variant's build passed whether or not the config it shipped could load. It now renders the template with envtpl and starts osmo-stp on the result, once per env file in <variant>/tests/ (the variables production passes, nothing invented for the test). A config osmo-stp rejects fails the build instead of being pushed.
Getting that check to behave on CI took two more commits, both about the runner itself:
- One runner group's kernel has no SCTP (
socket()fails withEPROTONOSUPPORT) and the other's does, and a job lands on either. There, libosmocore'ssocket_sctptest failed andosmo-stpcould not bind its M3UA listeners, failing every config check. The check now probes SCTP in the image and, without it, still requires the config to load but does not check listener binding — and says so in its output. osmo-stptook up to 90 seconds to exit aftertimeout's SIGTERM, so Partner A's three checks took three minutes instead of fifteen seconds. SIGKILL two seconds later, and exit 137 counts as a pass alongside 124.
The regex that forgot its anchors
The shared metadata check tests promote_to_dev.branch_pattern with an unanchored JavaScript RegExp. So main|deploy-dev/.* matched any branch whose name merely contains main — fix/domain-routing and maintenance both qualify — and a manual dispatch from either would push and promote its images. Anchoring the pattern to main and deploy-dev/<name> was a one-line change to metadata (unchanged since the Jenkins migration) that had looked correct for months.
A related gap closed later. Both variants' make test run the repository-root test-stp-config.sh, but neither workflow's path filter listed it (the other three root files were listed), so a change to only that script ran no variant build and could merge untested.