mirror of https://github.com/docker/buildx.git
test: use trap to remove cache volume
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
ecf8dd0a26
commit
b9cf46785b
|
@ -36,10 +36,9 @@ cacheVolume="buildx-test-cache"
|
||||||
if ! docker container inspect "$cacheVolume" >/dev/null 2>/dev/null; then
|
if ! docker container inspect "$cacheVolume" >/dev/null 2>/dev/null; then
|
||||||
docker create -v /root/.cache -v /root/.cache/registry -v /go/pkg/mod --name "$cacheVolume" alpine
|
docker create -v /root/.cache -v /root/.cache/registry -v /go/pkg/mod --name "$cacheVolume" alpine
|
||||||
fi
|
fi
|
||||||
|
if [ "$TEST_KEEP_CACHE" != "1" ]; then
|
||||||
|
trap 'docker rm -v $cacheVolume' EXIT
|
||||||
|
fi
|
||||||
|
|
||||||
cid=$(docker create --rm -v /tmp $testReportsVol --volumes-from=$cacheVolume -e GITHUB_REF -e TEST_DOCKERD -e TEST_BUILDKIT_IMAGE -e SKIP_INTEGRATION_TESTS -e GOTESTSUM_FORMAT ${BUILDKIT_INTEGRATION_SNAPSHOTTER:+"-eBUILDKIT_INTEGRATION_SNAPSHOTTER"} -e BUILDKIT_REGISTRY_MIRROR_DIR=/root/.cache/registry --privileged $iid gotestsum $gotestsumArgs --packages="${TESTPKGS:-./...}" -- $gotestArgs ${TESTFLAGS:--v})
|
cid=$(docker create --rm -v /tmp $testReportsVol --volumes-from=$cacheVolume -e GITHUB_REF -e TEST_DOCKERD -e TEST_BUILDKIT_IMAGE -e SKIP_INTEGRATION_TESTS -e GOTESTSUM_FORMAT ${BUILDKIT_INTEGRATION_SNAPSHOTTER:+"-eBUILDKIT_INTEGRATION_SNAPSHOTTER"} -e BUILDKIT_REGISTRY_MIRROR_DIR=/root/.cache/registry --privileged $iid gotestsum $gotestsumArgs --packages="${TESTPKGS:-./...}" -- $gotestArgs ${TESTFLAGS:--v})
|
||||||
docker start -a -i $cid
|
docker start -a -i $cid
|
||||||
|
|
||||||
if [ "$TEST_KEEP_CACHE" != "1" ]; then
|
|
||||||
docker rm -v $cacheVolume
|
|
||||||
fi
|
|
||||||
|
|
Loading…
Reference in New Issue