CI: use docker cp instead of bind mounts (sibling-container path trap)
CI / build-and-smoke (push) Successful in 5s
CI / build-and-smoke (push) Successful in 5s
Under act_runner, inner 'docker run' hits the host daemon via the mounted socket, so -v "$PWD/test:/work" mounts a nonexistent host path (empty). Stream files in/out with docker cp instead. Same pattern will drive the GlueXML release workflow.
This commit is contained in:
+21
-11
@@ -24,27 +24,37 @@ jobs:
|
||||
- name: Build image
|
||||
run: docker build -t mpq-packager:ci .
|
||||
|
||||
# NOTE: act_runner runs these `docker` commands against the HOST daemon via
|
||||
# the mounted socket, so bind-mounting the job's files (-v "$PWD:/work")
|
||||
# doesn't work — the source path isn't on the host. Use `docker cp` to
|
||||
# stream files in/out of a created container instead. The GlueXML release
|
||||
# workflow uses this same pattern.
|
||||
- name: Package the fixture
|
||||
run: |
|
||||
set -euo pipefail
|
||||
docker run --rm \
|
||||
cid=$(docker create \
|
||||
-e INPUT_MANIFEST=mpq.yaml \
|
||||
-e INPUT_VERSION=v0.0.0-ci \
|
||||
-e INPUT_OUT_DIR=/work/dist \
|
||||
-e GITHUB_WORKSPACE=/work \
|
||||
-v "$PWD/test:/work" \
|
||||
mpq-packager:ci
|
||||
mpq-packager:ci)
|
||||
docker cp test/. "$cid:/work"
|
||||
docker start -a "$cid"
|
||||
docker cp "$cid:/work/dist/patch-Z.mpq" ./patch-Z.mpq
|
||||
docker rm "$cid" >/dev/null
|
||||
|
||||
- name: Assert archive is valid and contains the expected file
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test -s test/dist/patch-Z.mpq
|
||||
echo "size: $(stat -c%s test/dist/patch-Z.mpq) bytes"
|
||||
# Read the archive back with StormLib (mpqpack --list/--cat).
|
||||
docker run --rm --entrypoint mpqpack -v "$PWD/test:/work" mpq-packager:ci \
|
||||
--list /work/dist/patch-Z.mpq | tee /tmp/list.txt
|
||||
grep -q 'Interface\\AddOns\\Fixture\\Hello.lua' /tmp/list.txt
|
||||
docker run --rm --entrypoint mpqpack -v "$PWD/test:/work" mpq-packager:ci \
|
||||
--cat /work/dist/patch-Z.mpq 'Interface\AddOns\Fixture\Hello.lua' \
|
||||
test -s patch-Z.mpq
|
||||
echo "size: $(stat -c%s patch-Z.mpq) bytes"
|
||||
# Read the archive back with StormLib (mpqpack --list/--cat) inside a
|
||||
# sleeping container we exec into.
|
||||
cid=$(docker run -d --entrypoint sleep mpq-packager:ci 120)
|
||||
docker cp patch-Z.mpq "$cid:/patch-Z.mpq"
|
||||
docker exec "$cid" mpqpack --list /patch-Z.mpq | tee list.txt
|
||||
grep -q 'Interface\\AddOns\\Fixture\\Hello.lua' list.txt
|
||||
docker exec "$cid" mpqpack --cat /patch-Z.mpq 'Interface\AddOns\Fixture\Hello.lua' \
|
||||
| grep -q 'VERSION = "v0.0.0-ci"'
|
||||
docker rm -f "$cid" >/dev/null
|
||||
echo "OK: archive valid, path + substitution confirmed"
|
||||
|
||||
Reference in New Issue
Block a user