test-containerd: move git clone into mirror

`${CONTAINERD_COMMIT}` is only defined in the `FROM linuxkit/alpine` section
and not the in `FROM scratch` section.

This means we were always checking out the current master at the time of build
rather than the expected commit because `git checkout $CONTAINERD_COMMIT` was
expanding to `git checkout `.

Signed-off-by: Ian Campbell <ijc@docker.com>
This commit is contained in:
Ian Campbell 2017-08-07 15:14:03 +01:00
parent 0635ef9569
commit b194a96584

View File

@ -19,15 +19,19 @@ RUN apk add --no-cache --initdb -p /out \
RUN rm -rf /out/etc/apk /out/lib/apk /out/var/cache
RUN cp /out/usr/share/zoneinfo/UTC /out/etc/localtime
FROM scratch
COPY --from=mirror /out/ /
ENV GOPATH=/go
RUN apk add git
ENV GOPATH=/out/go
RUN mkdir -p $GOPATH/src/github.com/containerd && \
cd $GOPATH/src/github.com/containerd && \
git clone https://github.com/containerd/containerd.git
WORKDIR $GOPATH/src/github.com/containerd/containerd
# CONTAINERD_COMMIT is defined in linuxkit/alpine
RUN git checkout $CONTAINERD_COMMIT
FROM scratch
COPY --from=mirror /out/ /
ENV GOPATH=/go
WORKDIR $GOPATH/src/github.com/containerd/containerd
ADD run.sh ./run.sh
ENTRYPOINT ["/bin/sh", "run.sh"]