diff --git a/.github/workflows/task-publish-runtime.yml b/.github/workflows/task-publish-runtime.yml index e65ddc3c..7a8cc76c 100644 --- a/.github/workflows/task-publish-runtime.yml +++ b/.github/workflows/task-publish-runtime.yml @@ -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 diff --git a/operator/scripts/build-runtime-srtool.sh b/operator/scripts/build-runtime-srtool.sh index 8f2d9331..437647ca 100755 --- a/operator/scripts/build-runtime-srtool.sh +++ b/operator/scripts/build-runtime-srtool.sh @@ -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} \