Update volume-copy-up
Add new test cases for volumes on both Linux and Windows. These new volumes will be used to test that we don't accidentally mangle volume paths on Linux and that non-C volume mounts work properly when defined in an image on Windows. Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
8c21759d7c
commit
f8907ab872
@ -16,4 +16,19 @@ ARG BASE
|
|||||||
|
|
||||||
FROM $BASE
|
FROM $BASE
|
||||||
RUN sh -c "mkdir /test_dir; echo test_content > /test_dir/test_file"
|
RUN sh -c "mkdir /test_dir; echo test_content > /test_dir/test_file"
|
||||||
VOLUME "/test_dir"
|
RUN sh -c "mkdir -p /C:/weird_test_dir; echo test_content > /C:/weird_test_dir/weird_test_file"
|
||||||
|
RUN sh -c "mkdir /:colon_prefixed; echo test_content > /:colon_prefixed/colon_prefixed_file"
|
||||||
|
|
||||||
|
# We add a Windows style path here to ensure that for Linux, we don't mangle it in any way.
|
||||||
|
# The C: drive letter gets special treatment on Windows and is stripped by WithVolumes(). The remaining
|
||||||
|
# path is used to join with the volume mount point on the host. Colons are not allowed
|
||||||
|
# in Windows paths except when delimiting the drive letter, but on Linux such paths are
|
||||||
|
# perfectly valid and we must ensure we don't mutate them by accident.
|
||||||
|
#
|
||||||
|
# The C:/weird_test_dir volume is considered relative to "/" and will result in a mount point
|
||||||
|
# situated at /C:/weird_test_dir.
|
||||||
|
#
|
||||||
|
# The "/:colon_prefixed" volume is meant to test that we don't ignore copying existing contents
|
||||||
|
# to a volume containing a colon as the second character in the path on Linux, considering that
|
||||||
|
# on Windows, we skip this operation for any non-C volume defined here.
|
||||||
|
VOLUME ["/test_dir", "C:/weird_test_dir", "/:colon_prefixed"]
|
||||||
|
@ -34,4 +34,10 @@ RUN mkdir C:\test_dir && \
|
|||||||
/bin/sh.exe -c "echo test_content > /test_dir/test_file"
|
/bin/sh.exe -c "echo test_content > /test_dir/test_file"
|
||||||
|
|
||||||
ENV PATH="C:\bin;C:\Windows\System32;C:\Windows;"
|
ENV PATH="C:\bin;C:\Windows\System32;C:\Windows;"
|
||||||
VOLUME "C:/test_dir"
|
|
||||||
|
# Add an extra volume under D: to test that WithVoumes() doesn't err out when dealing with
|
||||||
|
# a non-C volume in WCOW.
|
||||||
|
#
|
||||||
|
# See:
|
||||||
|
# https://github.com/containerd/containerd/issues/8171
|
||||||
|
VOLUME ["C:/test_dir", "D:"]
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
all: build
|
all: build
|
||||||
|
|
||||||
PROJ=ghcr.io/containerd
|
PROJ=ghcr.io/containerd
|
||||||
VERSION=2.1
|
VERSION=2.2
|
||||||
IMAGE=$(PROJ)/volume-copy-up:$(VERSION)
|
IMAGE=$(PROJ)/volume-copy-up:$(VERSION)
|
||||||
DOCKER_CERT_PATH ?= "$(HOME)/.docker"
|
DOCKER_CERT_PATH ?= "$(HOME)/.docker"
|
||||||
REMOTE_DOCKER_URL ?=
|
REMOTE_DOCKER_URL ?=
|
||||||
|
Loading…
Reference in New Issue
Block a user