From a87f17c01b656ee15599ca926f8d2943c0aa4741 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 6 Sep 2017 15:13:24 -0700 Subject: [PATCH 1/4] Fix 'make all' for other platforms Since commit d7e2c4ce7 ("Use gometalinter for linting") command "make all" fails on all the non-default platforms (i.e. ARMs, PPC, and s390) in this way: # make all ... Congratulations! All commits are properly signed with the DCO! /go/src/github.com/docker/docker/hack/validate/gometalinter: line 6: gometalinter: command not found Makefile:105: recipe for target 'all' failed make: *** [all] Error 127 Make sure gometalinter is installed for those platforms Signed-off-by: Kir Kolyshkin Upstream-commit: fc3040a4c41d3916739639b70fc3efd92888a0f5 Component: engine --- components/engine/Dockerfile.aarch64 | 2 +- components/engine/Dockerfile.armhf | 2 +- components/engine/Dockerfile.ppc64le | 2 +- components/engine/Dockerfile.s390x | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/engine/Dockerfile.aarch64 b/components/engine/Dockerfile.aarch64 index 5f3b25ce59..c59335b53f 100644 --- a/components/engine/Dockerfile.aarch64 +++ b/components/engine/Dockerfile.aarch64 @@ -173,7 +173,7 @@ RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \ # Please edit hack/dockerfile/install-binaries.sh to update them. COPY hack/dockerfile/binaries-commits /tmp/binaries-commits COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh -RUN /tmp/install-binaries.sh tomlv vndr runc containerd tini proxy dockercli +RUN /tmp/install-binaries.sh tomlv vndr runc containerd tini proxy dockercli gometalinter ENV PATH=/usr/local/cli:$PATH # Wrap all commands in the "docker-in-docker" script to allow nested containers diff --git a/components/engine/Dockerfile.armhf b/components/engine/Dockerfile.armhf index 18cd74f12f..80005bc26d 100644 --- a/components/engine/Dockerfile.armhf +++ b/components/engine/Dockerfile.armhf @@ -162,7 +162,7 @@ RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \ # Please edit hack/dockerfile/install-binaries.sh to update them. COPY hack/dockerfile/binaries-commits /tmp/binaries-commits COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh -RUN /tmp/install-binaries.sh tomlv vndr runc containerd tini proxy dockercli +RUN /tmp/install-binaries.sh tomlv vndr runc containerd tini proxy dockercli gometalinter ENV PATH=/usr/local/cli:$PATH ENTRYPOINT ["hack/dind"] diff --git a/components/engine/Dockerfile.ppc64le b/components/engine/Dockerfile.ppc64le index 3234239ea6..4b27236964 100644 --- a/components/engine/Dockerfile.ppc64le +++ b/components/engine/Dockerfile.ppc64le @@ -160,7 +160,7 @@ RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \ # Please edit hack/dockerfile/install-binaries.sh to update them. COPY hack/dockerfile/binaries-commits /tmp/binaries-commits COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh -RUN /tmp/install-binaries.sh tomlv vndr runc containerd tini proxy dockercli +RUN /tmp/install-binaries.sh tomlv vndr runc containerd tini proxy dockercli gometalinter ENV PATH=/usr/local/cli:$PATH # Wrap all commands in the "docker-in-docker" script to allow nested containers diff --git a/components/engine/Dockerfile.s390x b/components/engine/Dockerfile.s390x index 14dfd12bdb..1d36b490c2 100644 --- a/components/engine/Dockerfile.s390x +++ b/components/engine/Dockerfile.s390x @@ -153,7 +153,7 @@ RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \ # Please edit hack/dockerfile/install-binaries.sh to update them. COPY hack/dockerfile/binaries-commits /tmp/binaries-commits COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh -RUN /tmp/install-binaries.sh tomlv vndr runc containerd tini proxy dockercli +RUN /tmp/install-binaries.sh tomlv vndr runc containerd tini proxy dockercli gometalinter ENV PATH=/usr/local/cli:$PATH # Wrap all commands in the "docker-in-docker" script to allow nested containers From 4219a83be8db95d4bdc622ae7eaeffcd30b587f1 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Fri, 1 Sep 2017 19:16:54 +0300 Subject: [PATCH 2/4] overlay gd: fix build for 32-bit ARM This commit reverts a hunk of commit 2f5f0af3f ("Add unconvert linter") and adds a hint for unconvert linter to ignore excessive conversion as it is required on 32-bit platforms (e.g. armhf). The exact error on armhf is this: 19:06:45 ---> Making bundle: dynbinary (in bundles/17.06.0-dev/dynbinary) 19:06:48 Building: bundles/17.06.0-dev/dynbinary-daemon/dockerd-17.06.0-dev 19:10:58 # github.com/docker/docker/daemon/graphdriver/overlay 19:10:58 daemon/graphdriver/overlay/copy.go:161: cannot use stat.Atim.Sec (type int32) as type int64 in argument to time.Unix 19:10:58 daemon/graphdriver/overlay/copy.go:161: cannot use stat.Atim.Nsec (type int32) as type int64 in argument to time.Unix 19:10:58 daemon/graphdriver/overlay/copy.go:162: cannot use stat.Mtim.Sec (type int32) as type int64 in argument to time.Unix 19:10:58 daemon/graphdriver/overlay/copy.go:162: cannot use stat.Mtim.Nsec (type int32) as type int64 in argument to time.Unix Signed-off-by: Kir Kolyshkin Upstream-commit: 21b2c278cc86f0fc411018becbcbf2a7e44b6057 Component: engine --- components/engine/daemon/graphdriver/overlay/copy.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/engine/daemon/graphdriver/overlay/copy.go b/components/engine/daemon/graphdriver/overlay/copy.go index 8c35b91ddc..f7e35e2bd3 100644 --- a/components/engine/daemon/graphdriver/overlay/copy.go +++ b/components/engine/daemon/graphdriver/overlay/copy.go @@ -157,9 +157,10 @@ func copyDir(srcDir, dstDir string, flags copyFlags) error { } // system.Chtimes doesn't support a NOFOLLOW flag atm + // nolint: unconvert if !isSymlink { - aTime := time.Unix(stat.Atim.Sec, stat.Atim.Nsec) - mTime := time.Unix(stat.Mtim.Sec, stat.Mtim.Nsec) + aTime := time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) + mTime := time.Unix(int64(stat.Mtim.Sec), int64(stat.Mtim.Nsec)) if err := system.Chtimes(dstPath, aTime, mTime); err != nil { return err } From 57c34191f2bcdc0f6d0f60583cc37522a0e25a2b Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Thu, 7 Sep 2017 11:59:56 -0700 Subject: [PATCH 3/4] gometalinter: add per-platform configurable options I have run into two separate issues while doing 'make all' on armhf (a Scaleway C1 machine, same as used in CI). This commit fixes both. 1. There were a lot of "not enough memory" errors, and after that in a few runs gometalinter just stuck forever on FUTEX_WAIT with no children left. Looking into docs, I found the --enable-gc option which solved the issue. [Update: this has already been added] 2. Timeout of 2 minutes is not enough for the abovementioned platform. The longest running linter is goimports which takes almost 6 minutes to run. Set the timeout to the observable run time roughly doubled. In addition, ARM platforms does not have too much RAM (2GB), so running too many processes in parallel might be problematic. Limit it by using -j2 [v2: make the timeout arch-dependent, also tested on aarch64 (2m15s)] [v3: moved timeout setting to Dockerfiles] [v4: generalized to GOMETALINTER_OPTS, added -j2 for ARM platforms] [v5: rebase to master] Signed-off-by: Kir Kolyshkin Upstream-commit: b96093fa56a9c085cb3123010be2430753c40cbc Component: engine --- components/engine/Dockerfile | 3 +++ components/engine/Dockerfile.aarch64 | 3 +++ components/engine/Dockerfile.armhf | 3 +++ components/engine/hack/validate/gometalinter | 7 ++++++- components/engine/hack/validate/gometalinter.json | 1 - 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/components/engine/Dockerfile b/components/engine/Dockerfile index 8971edf6b8..ba84584954 100644 --- a/components/engine/Dockerfile +++ b/components/engine/Dockerfile @@ -216,3 +216,6 @@ ENTRYPOINT ["hack/dind"] # Upload docker source COPY . /go/src/github.com/docker/docker + +# Options for hack/validate/gometalinter +ENV GOMETALINTER_OPTS="--deadline 2m" diff --git a/components/engine/Dockerfile.aarch64 b/components/engine/Dockerfile.aarch64 index c59335b53f..ee67dcb8c8 100644 --- a/components/engine/Dockerfile.aarch64 +++ b/components/engine/Dockerfile.aarch64 @@ -181,3 +181,6 @@ ENTRYPOINT ["hack/dind"] # Upload docker source COPY . /go/src/github.com/docker/docker + +# Options for hack/validate/gometalinter +ENV GOMETALINTER_OPTS="--deadline 4m -j2" diff --git a/components/engine/Dockerfile.armhf b/components/engine/Dockerfile.armhf index 80005bc26d..ed42b2dae9 100644 --- a/components/engine/Dockerfile.armhf +++ b/components/engine/Dockerfile.armhf @@ -169,3 +169,6 @@ ENTRYPOINT ["hack/dind"] # Upload docker source COPY . /go/src/github.com/docker/docker + +# Options for hack/validate/gometalinter +ENV GOMETALINTER_OPTS="--deadline 10m -j2" diff --git a/components/engine/hack/validate/gometalinter b/components/engine/hack/validate/gometalinter index 9830659d69..ae411e864a 100755 --- a/components/engine/hack/validate/gometalinter +++ b/components/engine/hack/validate/gometalinter @@ -3,4 +3,9 @@ set -e -o pipefail SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -gometalinter --config $SCRIPTDIR/gometalinter.json ./... +# CI platforms differ, so per-platform GOMETALINTER_OPTS can be set +# from a platform-specific Dockerfile, otherwise let's just set +# (somewhat pessimistic) default of 10 minutes. +gometalinter \ + ${GOMETALINTER_OPTS:--deadine 10m} \ + --config $SCRIPTDIR/gometalinter.json ./... diff --git a/components/engine/hack/validate/gometalinter.json b/components/engine/hack/validate/gometalinter.json index c43ddec892..93328f82ad 100644 --- a/components/engine/hack/validate/gometalinter.json +++ b/components/engine/hack/validate/gometalinter.json @@ -1,6 +1,5 @@ { "Vendor": true, - "Deadline": "2m", "EnableGC": true, "Sort": ["linter", "severity", "path"], "Exclude": [ From 9d7caf267cc1e5e074d124d7be921f4f892f4f62 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 12 Sep 2017 13:53:59 -0700 Subject: [PATCH 4/4] Update gometalinter This is mostly to include the following fix: https://github.com/alecthomas/gometalinter/commit/78e3fbd90a20b03a Signed-off-by: Kir Kolyshkin Upstream-commit: 6be4b3703c2a2b41ccdf97fcf8d2da6863a402bd Component: engine --- components/engine/hack/dockerfile/binaries-commits | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/engine/hack/dockerfile/binaries-commits b/components/engine/hack/dockerfile/binaries-commits index 3c465a4073..4338a3b48b 100644 --- a/components/engine/hack/dockerfile/binaries-commits +++ b/components/engine/hack/dockerfile/binaries-commits @@ -10,4 +10,4 @@ LIBNETWORK_COMMIT=7b2b1feb1de4817d522cc372af149ff48d25028e VNDR_COMMIT=9909bb2b8a0b7ea464527b376dc50389c90df587 # Linting -GOMETALINTER_COMMIT=5507b26af3204e949ffe50ec08ee73e5847938e1 +GOMETALINTER_COMMIT=bfcc1d6942136fd86eb6f1a6fb328de8398fbd80