fix: 🔧 Add Podman support to srtool runtime build script (#222)

## Summary

- Adds support for both Docker and Podman container engines in
`build-runtime-srtool.sh` via `IS_PODMAN` environment variable
- Uses `--userns=keep-id` for Podman (proper user namespace handling)
and `--user $(id -u):$(id -g)` for Docker
- Sets `IS_PODMAN=true` in `task-publish-runtime.yml` workflow to enable
Podman by default

## Changes

**`operator/scripts/build-runtime-srtool.sh`:**
- Added conditional logic to detect `IS_PODMAN` env var
- Dynamically selects between `podman` and `docker` as container engine
- Sets appropriate user/namespace flags based on container engine

**`.github/workflows/task-publish-runtime.yml`:**
- Added `IS_PODMAN: true` environment variable to the srtool build step
- Updated comment to use generic "container user" instead of "docker
user"

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Steve Degosserie 2025-10-10 22:57:34 +02:00 committed by GitHub
parent c978150582
commit 8c950af4a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 4 deletions

View file

@ -81,8 +81,9 @@ jobs:
GH_WORKFLOW_MATRIX_SRTOOL_IMAGE_TAG: ${{ matrix.srtool_image_tag }}
RUNTIME_BUILD_OPTS: "--features=on-chain-release-build"
RUNTIME_BUILD_PROFILE: "production"
IS_PODMAN: true
run: |
# Ensure we have permissions to write to the runtime folder target for the docker user
# Ensure we have permissions to write to the runtime folder target for the container user
mkdir -p operator/runtime/${GH_WORKFLOW_MATRIX_CHAIN}/target
chmod uog+rwX operator/runtime/${GH_WORKFLOW_MATRIX_CHAIN}/target

View file

@ -6,11 +6,20 @@
# self-hosted runner uses user `maintenance` to match srtool `builder` user 1001
# $(~/srtool/uid-gid-mapping.sh 1001 | xargs) is used to map the user and group
# Docker command to generate JSON blob of the runtime
CMD="docker run \
# Determine whether to use Podman or Docker
if [ "${IS_PODMAN}" = "true" ]; then
CONTAINER_ENGINE="podman"
USER_FLAG="--userns=keep-id"
else
CONTAINER_ENGINE="docker"
USER_FLAG="--user $(id -u):$(id -g)"
fi
# Container command to generate JSON blob of the runtime
CMD="${CONTAINER_ENGINE} run \
-i \
--rm \
--user $(id -u):$(id -g) \
${USER_FLAG} \
-e CARGO_NET_GIT_FETCH_WITH_CLI=true \
-e PACKAGE=datahaven-${GH_WORKFLOW_MATRIX_CHAIN}-runtime \
-e RUNTIME_DIR=operator/runtime/${GH_WORKFLOW_MATRIX_CHAIN} \