diff --git a/Dockerfile b/Dockerfile index f5ec77836b..83a5bb04c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -151,12 +151,12 @@ RUN --mount=type=cache,sharing=locked,id=moby-cross-true-aptlib,target=/var/lib/ FROM runtime-dev-cross-${CROSS} AS runtime-dev -FROM base AS tomlv -ARG TOMLV_COMMIT +FROM base AS tomll +ARG GOTOML_VERSION RUN --mount=type=cache,target=/root/.cache/go-build \ --mount=type=cache,target=/go/pkg/mod \ - --mount=type=bind,src=hack/dockerfile/install,target=/tmp/install \ - PREFIX=/build /tmp/install/install.sh tomlv + --mount=type=bind,src=hack/dockerfile/install/tomll.installer,target=/tmp/install/tomll.installer \ + . /tmp/install/tomll.installer && PREFIX=/build install_tomll FROM base AS vndr ARG VNDR_COMMIT @@ -305,7 +305,7 @@ RUN pip3 install yamllint==1.16.0 COPY --from=dockercli /build/ /usr/local/cli COPY --from=frozen-images /build/ /docker-frozen-images COPY --from=swagger /build/ /usr/local/bin/ -COPY --from=tomlv /build/ /usr/local/bin/ +COPY --from=tomll /build/ /usr/local/bin/ COPY --from=tini /build/ /usr/local/bin/ COPY --from=registry /build/ /usr/local/bin/ COPY --from=criu /build/ /usr/local/ diff --git a/hack/dockerfile/install/tomll.installer b/hack/dockerfile/install/tomll.installer new file mode 100755 index 0000000000..066b9ccdd0 --- /dev/null +++ b/hack/dockerfile/install/tomll.installer @@ -0,0 +1,9 @@ +#!/bin/sh + +: "${GOTOML_VERSION:=v1.8.1}" + +install_tomll() { + echo "Install go-toml version ${GOTOML_VERSION}" + # TODO remove GO111MODULE=on and change to 'go install -mod=mod ...' once we're at go 1.16+ + GO111MODULE=on GOBIN="${PREFIX}" go get -v "github.com/pelletier/go-toml/cmd/tomll@${GOTOML_VERSION}" +} diff --git a/hack/dockerfile/install/tomlv.installer b/hack/dockerfile/install/tomlv.installer deleted file mode 100755 index 6ef795700c..0000000000 --- a/hack/dockerfile/install/tomlv.installer +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -# When updating TOMLV_COMMIT, consider updating github.com/BurntSushi/toml -# in vendor.conf accordingly -: ${TOMLV_COMMIT:=3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005} # v0.3.1 - -install_tomlv() { - echo "Install tomlv version $TOMLV_COMMIT" - git clone https://github.com/BurntSushi/toml.git "$GOPATH/src/github.com/BurntSushi/toml" - cd "$GOPATH/src/github.com/BurntSushi/toml" && git checkout -q "$TOMLV_COMMIT" - go build -v ${GO_BUILDMODE} -o "${PREFIX}/tomlv" "github.com/BurntSushi/toml/cmd/tomlv" -} diff --git a/hack/validate/toml b/hack/validate/toml index 3d22619b1a..7f1739ab84 100755 --- a/hack/validate/toml +++ b/hack/validate/toml @@ -10,7 +10,7 @@ unset IFS badFiles=() for f in "${files[@]}"; do # we use "git show" here to validate that what's committed has valid TOML syntax - if ! git show "$VALIDATE_HEAD:$f" | tomlv /proc/self/fd/0; then + if ! git show "$VALIDATE_HEAD:$f" | tomll /proc/self/fd/0; then badFiles+=("$f") fi done diff --git a/vendor.conf b/vendor.conf index abedda4ee8..965b46f8bc 100644 --- a/vendor.conf +++ b/vendor.conf @@ -63,7 +63,6 @@ github.com/vishvananda/netns db3c7e526aae966c4ccfa6c8189b github.com/vishvananda/netlink f049be6f391489d3f374498fe0c8df8449258372 # v1.1.0 github.com/moby/ipvs 4566ccea0e08d68e9614c3e7a64a23b850c4bb35 # v1.0.1 -# When updating, consider updating TOMLV_COMMIT in hack/dockerfile/install/tomlv.installer accordingly github.com/BurntSushi/toml 3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005 # v0.3.1 github.com/samuel/go-zookeeper d0e0d8e11f318e000a8cc434616d69e329edc374 github.com/deckarep/golang-set ef32fa3046d9f249d399f98ebaf9be944430fd1d