Skip to content

Commit 62a5710

Browse files
mvillmowclaude
andcommitted
fix(ci): harden Podman dev-container bring-up per #568 review
Addresses remaining self-review threads on the CI-migration action: - Verify the cache-restored image carries the projectkeystone-dev:latest tag after `podman load`; rebuild if a stale/mistagged tarball loaded (so it can no longer silently fail at `podman-compose up`). - Drop the broad `restore-keys: podman-` so a partial cache hit can no longer load a tarball built from a different Containerfile/conanfile; exact hashFiles key only, rebuild on any input change. - Set vm.mmap_rnd_bits=28 on the runner host so in-container ASan/TSan/LSan do not abort with shadow-memory mapping errors on the noble kernel. - Assert `podman info` reports rootless=true instead of merely printing it, so a rootful runner fails the step. - Defensively run `conan profile detect --exist-ok` in `make deps` before `conan install` (the dev image already detects a profile at build time). Refs #568 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: mvillmow <4211002+mvillmow@users.noreply.github.com>
1 parent cf5972e commit 62a5710

2 files changed

Lines changed: 32 additions & 6 deletions

File tree

.github/actions/install-build-deps/action.yml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,15 @@ runs:
107107
echo "DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock" >> "$GITHUB_ENV"
108108
shell: bash
109109

110+
- name: Configure host for in-container sanitizers
111+
run: |
112+
# ASan/TSan/LSan abort with "Shadow memory range interleaves with an
113+
# existing memory mapping" on the ubuntu-24.04 noble kernel unless the
114+
# ASLR entropy is lowered. The sanitizer runs inside the dev container
115+
# but shares the host kernel, so this must be set on the runner host.
116+
sudo sysctl -w vm.mmap_rnd_bits=28
117+
shell: bash
118+
110119
- name: Set container build environment
111120
run: |
112121
echo "GIT_COMMIT=${{ github.sha }}" >> "$GITHUB_ENV"
@@ -123,15 +132,26 @@ runs:
123132
uses: actions/cache@v5
124133
with:
125134
path: /tmp/dev-image.tar
135+
# Exact-match only: a partial restore-key (e.g. `podman-`) would load a
136+
# stale tarball built from a different Containerfile/conanfile, so omit
137+
# restore-keys and rebuild on any input change.
126138
key: podman-${{ hashFiles('Containerfile', 'docker-compose.yml', 'conanfile.py') }}
127-
restore-keys: |
128-
podman-
129139

130140
- name: Load or build dev container image
131141
run: |
142+
loaded=false
132143
if [ "${{ steps.image_cache.outputs.cache-hit }}" = "true" ] && podman load -i /tmp/dev-image.tar 2>/dev/null; then
133-
echo "Loaded dev image from cache"
134-
else
144+
# Verify the tarball actually contained the tag compose resolves;
145+
# a stale/mistagged tarball would otherwise pass here and fail at
146+
# `podman-compose up`.
147+
if podman image exists projectkeystone-dev:latest; then
148+
echo "Loaded dev image from cache"
149+
loaded=true
150+
else
151+
echo "Cached tarball missing projectkeystone-dev:latest tag; rebuilding" >&2
152+
fi
153+
fi
154+
if [ "$loaded" != "true" ]; then
135155
DOCKER_HOST="$DOCKER_HOST" podman-compose build dev
136156
podman save -o /tmp/dev-image.tar projectkeystone-dev:latest
137157
fi
@@ -157,9 +177,14 @@ runs:
157177
exit 1
158178
shell: bash
159179

160-
- name: Verify Podman works
180+
- name: Verify Podman works (rootless)
161181
run: |
162-
podman info --format '{{.Host.Security.Rootless}}'
182+
rootless="$(podman info --format '{{.Host.Security.Rootless}}')"
183+
echo "Podman rootless: ${rootless}"
184+
if [ "${rootless}" != "true" ]; then
185+
echo "Expected rootless Podman but got '${rootless}'" >&2
186+
exit 1
187+
fi
163188
shell: bash
164189

165190
- name: Verify installation

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ endif
6060
deps:
6161
@echo "Installing Conan dependencies (Debug + Release)..."
6262
$(CONTAINER_CHECK)
63+
$(CONTAINER_PREFIX) conan profile detect --exist-ok
6364
$(CONTAINER_PREFIX) conan install . --output-folder=$(CONAN_OUTPUT_DIR) --build=missing -s build_type=Debug -s compiler.cppstd=20
6465
$(CONTAINER_PREFIX) conan install . --output-folder=$(CONAN_OUTPUT_DIR) --build=missing -s build_type=Release -s compiler.cppstd=20
6566

0 commit comments

Comments
 (0)