Skip to content

Commit 3fea064

Browse files
committed
e2e: build and install trust plugin
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 2f52186 commit 3fea064

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ RUN --mount=type=bind,target=.,ro \
7474
TARGET=/out ./scripts/build/binary && \
7575
xx-verify $([ "$GO_LINKMODE" = "static" ] && echo "--static") /out/docker
7676

77+
FROM build-${BASE_VARIANT} AS build-trust-plugin
78+
ARG GO_LINKMODE=static
79+
ARG GO_BUILDTAGS
80+
ARG GO_STRIP
81+
ARG CGO_ENABLED
82+
ARG VERSION
83+
RUN --mount=ro --mount=type=cache,target=/root/.cache \
84+
xx-go --wrap && \
85+
TARGET=/out ./scripts/build/trust-plugin
86+
7787
FROM build-${BASE_VARIANT} AS test
7888
COPY --link --from=gotestsum /out/gotestsum /usr/bin/gotestsum
7989
ENV GO111MODULE=auto
@@ -111,6 +121,7 @@ COPY --link e2e/testdata/notary/root-ca.cert /usr/share/ca-certificates/notary.c
111121
RUN echo 'notary.cert' >> /etc/ca-certificates.conf && update-ca-certificates
112122
COPY --link --from=gotestsum /out/gotestsum /usr/bin/gotestsum
113123
COPY --link --from=build /out ./build/
124+
COPY --link --from=build-trust-plugin /out ./build/
114125
COPY --link --from=build-plugins /out ./build/
115126
COPY --link --from=buildx /buildx /usr/libexec/docker/cli-plugins/docker-buildx
116127
COPY --link --from=compose /docker-compose /usr/libexec/docker/cli-plugins/docker-compose

scripts/build/trust-plugin

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Build plugins examples for the host OS/ARCH
4+
#
5+
6+
set -eu -o pipefail
7+
8+
# Disable CGO - we don't need it for these plugins.
9+
#
10+
# Important: this must be done before sourcing "./scripts/build/.variables",
11+
# because some other variables are conditionally set whether CGO is enabled.
12+
export CGO_ENABLED=0
13+
14+
source ./scripts/build/.variables
15+
16+
TARGET_PLUGIN="$(dirname "${TARGET}")/plugins-${GOOS}-${GOARCH}/docker-trust"
17+
mkdir -p "$(dirname "${TARGET_PLUGIN}")"
18+
19+
echo "Building $GO_LINKMODE $(basename "${TARGET_PLUGIN}")"
20+
(set -x ; GO111MODULE=auto go build -o "${TARGET_PLUGIN}" -tags "${GO_BUILDTAGS}" -ldflags "${GO_LDFLAGS}" ${GO_BUILDMODE} "github.com/docker/cli/cmd/docker-trust")

0 commit comments

Comments
 (0)