-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.csi-sanity
77 lines (70 loc) · 4.26 KB
/
Dockerfile.csi-sanity
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
ARG BASE_IMAGE
ARG BUILD_IMAGE
# csi-sanity build container
FROM $BUILD_IMAGE as builder-csi-sanity
WORKDIR /go/src/github.com/kubernetes-csi/
# csi-sanity versions: https://github.com/kubernetes-csi/csi-test/releases
ARG CSI_SANITY_VERSION_TAG
ENV CSI_SANITY_VERSION_TAG=$CSI_SANITY_VERSION_TAG
RUN apk add --no-cache make git
RUN git clone https://github.com/kubernetes-csi/csi-test.git &&\
cd csi-test &&\
git checkout -b ${CSI_SANITY_VERSION_TAG} ${CSI_SANITY_VERSION_TAG} &&\
cd cmd/csi-sanity &&\
make linux_amd64_dist &&\
cp ./csi-sanity /csi-sanity
# driver build container
FROM $BUILD_IMAGE as builder-driver
WORKDIR /go/src/github.com/Nexenta/nexentastor-csi-driver-block/
COPY . ./
RUN apk add --no-cache make git
RUN make build &&\
cp ./bin/nexentastor-csi-driver-block /nexentastor-csi-driver-block
# run driver and csi-sanity tests
FROM $BASE_IMAGE
WORKDIR /
# driver UNIX socket
ENV SOCK="unix:///csi.sock"
# install dependencies
RUN apk update || true && \
apk add coreutils util-linux blkid \
e2fsprogs bash kmod curl jq ca-certificates
# copy csi-sanity from build container
COPY --from=builder-csi-sanity /csi-sanity /
# copy driver from build container
RUN mkdir /nexentastor-csi-driver-block
COPY --from=builder-driver /nexentastor-csi-driver-block /nexentastor-csi-driver-block/
RUN mkdir /lib64 &&\
ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
ADD chroot-host-wrapper.sh /nexentastor-csi-driver-block
RUN chmod 777 /nexentastor-csi-driver-block/chroot-host-wrapper.sh
RUN ln -s /nexentastor-csi-driver-block/chroot-host-wrapper.sh /nexentastor-csi-driver-block/blkid \
&& ln -s /nexentastor-csi-driver-block/chroot-host-wrapper.sh /nexentastor-csi-driver-block/ln \
&& ln -s /nexentastor-csi-driver-block/chroot-host-wrapper.sh /nexentastor-csi-driver-block/iscsiadm \
&& ln -s /nexentastor-csi-driver-block/chroot-host-wrapper.sh /nexentastor-csi-driver-block/resize2fs \
&& ln -s /nexentastor-csi-driver-block/chroot-host-wrapper.sh /nexentastor-csi-driver-block/blockdev \
&& ln -s /nexentastor-csi-driver-block/chroot-host-wrapper.sh /nexentastor-csi-driver-block/e2fsck \
&& ln -s /nexentastor-csi-driver-block/chroot-host-wrapper.sh /nexentastor-csi-driver-block/findmnt \
&& ln -s /nexentastor-csi-driver-block/chroot-host-wrapper.sh /nexentastor-csi-driver-block/lsscsi \
&& ln -s /nexentastor-csi-driver-block/chroot-host-wrapper.sh /nexentastor-csi-driver-block/mkfs.ext3 \
&& ln -s /nexentastor-csi-driver-block/chroot-host-wrapper.sh /nexentastor-csi-driver-block/mkfs.ext4 \
&& ln -s /nexentastor-csi-driver-block/chroot-host-wrapper.sh /nexentastor-csi-driver-block/mkfs.xfs \
&& ln -s /nexentastor-csi-driver-block/chroot-host-wrapper.sh /nexentastor-csi-driver-block/multipath \
&& ln -s /nexentastor-csi-driver-block/chroot-host-wrapper.sh /nexentastor-csi-driver-block/rm \
&& ln -s /nexentastor-csi-driver-block/chroot-host-wrapper.sh /nexentastor-csi-driver-block/multipathd \
&& ln -s /nexentastor-csi-driver-block/chroot-host-wrapper.sh /nexentastor-csi-driver-block/mount
ENV PATH="/nexentastor-csi-driver-block/:${PATH}"
# copy driver config file
COPY ./tests/csi-sanity/driver-config-csi-sanity.yaml /config/driver-config-csi-sanity.yaml
# create mount direactory for tests
# driver run script
RUN echo '/nexentastor-csi-driver-block/nexentastor-csi-driver-block --config-dir=/config --endpoint=${SOCK} --nodeid=local &' > /run-driver &&\
chmod +x /run-driver
# details: https://stackoverflow.com/questions/34729748/installed-go-binary-not-found-in-path-on-alpine-linux-docker
# versions
RUN /csi-sanity -version &&\
/nexentastor-csi-driver-block/nexentastor-csi-driver-block --version
# other csi-sanity options: --ginkgo.v -ginkgo.noColor
#TODO remove "--ginkgo.skip" option after fixing volume paginatin by token:
ENTRYPOINT ["/bin/sh", "-c", "/run-driver && /csi-sanity --csi.endpoint=${SOCK} --csi.createpathcmdtimeout=180s --csi.removepathcmdtimeout=180s --ginkgo.skip 'pagination should detect volumes added between pages and accept tokens when the last volume from a page is deleted' --ginkgo.skip 'should fail when volume is not found'"]
#ENTRYPOINT ["/bin/sh", "-c", "/run-driver && /csi-sanity --csi.endpoint=${SOCK} --csi.createpathcmdtimeout=180 --csi.removepathcmdtimeout=180]