Skip to content

update to go 1.16#2144

Merged
tonistiigi merged 1 commit into
moby:masterfrom
thaJeztah:bump_golang
Jun 8, 2021
Merged

update to go 1.16#2144
tonistiigi merged 1 commit into
moby:masterfrom
thaJeztah:bump_golang

Conversation

@thaJeztah

@thaJeztah thaJeztah commented Jun 1, 2021

Copy link
Copy Markdown
Member

depends on #2146

relates to moby/moby#40353 moby/moby#40353 (comment)

This updates all occurrences of Go 1.13 to Go 1.16; also updated the code that's used to redact credentials in URLs to use the Go implementation (based on golang/go@e3323f5, it's available in Go 1.15 and up).

@thaJeztah

Copy link
Copy Markdown
Member Author

Runc Compile is failing;

#30 [buildkitd 1/1] RUN --mount=target=. --mount=target=/root/.cache,type=cache   --mount=target=/go/pkg/mod,type=cache   --mount=source=/tmp/.ldflags,target=/tmp/.ldflags,from=buildkit-version   CGO_ENABLED=0 xx-go build -ldflags "$(cat /tmp/.ldflags) -extldflags '-static'" -tags "osusergo netgo static_build seccomp ${BUILDKITD_TAGS}" -o /usr/bin/buildkitd ./cmd/buildkitd &&   xx-verify --static /usr/bin/buildkitd
#30 sha256:85c4cf958570ea07260c8042fd2d26e1fbeb9b8059a9fba73bd826a388619fcd
#30 CANCELED
------
 > [runc 3/3] RUN --mount=from=runc-src,src=/usr/src/runc,target=. --mount=target=/root/.cache,type=cache   CGO_ENABLED=1 xx-go build -mod=vendor -ldflags '-extldflags -static' -tags 'apparmor seccomp netgo cgo static_build osusergo' -o /usr/bin/runc ./ &&   xx-verify --static /usr/bin/runc:
------
Dockerfile:56
--------------------
  55 |       [ "$(xx-info arch)" != "ppc64le" ] || XX_CC_PREFER_LINKER=ld xx-clang --setup-target-triple
  56 | >>> RUN --mount=from=runc-src,src=/usr/src/runc,target=. --mount=target=/root/.cache,type=cache \
  57 | >>>   CGO_ENABLED=1 xx-go build -mod=vendor -ldflags '-extldflags -static' -tags 'apparmor seccomp netgo cgo static_build osusergo' -o /usr/bin/runc ./ && \
  58 | >>>   xx-verify --static /usr/bin/runc
  59 |     
--------------------
error: failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c CGO_ENABLED=1 xx-go build -mod=vendor -ldflags '-extldflags -static' -tags 'apparmor seccomp netgo cgo static_build osusergo' -o /usr/bin/runc ./ &&   xx-verify --static /usr/bin/runc]: exit code: 2
Error: Process completed with exit code 1.

@thaJeztah

Copy link
Copy Markdown
Member Author

Looks like I get a more detailed error when running locally;

make TARGETPLATFORM=linux/amd64 binaries
hack/binaries
+ docker buildx build --platform linux/amd64 --target binaries --output type=local,dest=./bin/ .
[+] Building 65.3s (24/28)
...
 => ERROR [runc 3/3] RUN --mount=from=runc-src,src=/usr/src/runc,target=. --mount=target=/root/.cache,type=cache   CGO_ENABLED=1 xx-go build -mod=vendor -ldflags '-extldflags -static' -tags 'appar  46.3s
------
 > [runc 3/3] RUN --mount=from=runc-src,src=/usr/src/runc,target=. --mount=target=/root/.cache,type=cache   CGO_ENABLED=1 xx-go build -mod=vendor -ldflags '-extldflags -static' -tags 'apparmor seccomp netgo cgo static_build osusergo' -o /usr/bin/runc ./ &&   xx-verify --static /usr/bin/runc:
#18 45.08 # github.com/opencontainers/runc
#18 45.08 /usr/local/go/pkg/tool/linux_amd64/link: running x86_64-alpine-linux-musl-clang failed: exit status 1
#18 45.08 ld.lld: error: unable to find library -lseccomp
#18 45.08 ld.lld: error: unable to find library -lseccomp
#18 45.08 clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
#18 45.08
------
error: failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c CGO_ENABLED=1 xx-go build -mod=vendor -ldflags '-extldflags -static' -tags 'apparmor seccomp netgo cgo static_build osusergo' -o /usr/bin/runc ./ &&   xx-verify --static /usr/bin/runc]: exit code: 2
make: *** [binaries] Error 1

@crazy-max

Copy link
Copy Markdown
Member

@thaJeztah

Copy link
Copy Markdown
Member Author

Ah! Looks like I didn't scroll back far enough. Slightly confusing that that error is not included in the final error that buildkit returns (perhaps it should be?)

@tonistiigi

Copy link
Copy Markdown
Member

@thaJeztah

Copy link
Copy Markdown
Member Author

Ugh.. more fun with modules;

#30 [containerd-alt 1/1] RUN --mount=from=containerd-src,src=/usr/src/containerd,readwrite --mount=target=/root/.cache,type=cache   git fetch origin   && git checkout -q "v1.4.6"   && make bin/containerd   && make bin/containerd-shim-runc-v2   && mv bin /out
#30 sha256:449b41208d4462fcc0693e02e9743ec7fffa53a71c7c2028a30ab89c6d3622b5
#30 3.283 + bin/containerd
#30 3.297 go: cannot find main module, but found vendor.conf in /go/src/github.com/containerd/containerd
#30 3.297 	to create a module there, run:
#30 3.297 	go mod init
#30 3.298 make: *** [Makefile:193: bin/containerd] Error 1
#30 ERROR: executor failed running [/bin/sh -c git fetch origin   && git checkout -q "$CONTAINERD_ALT_VERSION"   && make bin/containerd   && make bin/containerd-shim-runc-v2   && mv bin /out]: exit code: 2

@thaJeztah
thaJeztah force-pushed the bump_golang branch 2 times, most recently from 1ddca36 to 4045235 Compare June 1, 2021 22:00
@thaJeztah

Copy link
Copy Markdown
Member Author

All green now 🎉 ✅

I'll rebase, and move this out of draft once #2146 is merged

This updates all occurrences of Go 1.13 to Go 1.16; also updated
the code that's used to redact credentials in URLs to use the Go
implementation.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah
thaJeztah marked this pull request as ready for review June 1, 2021 22:32
Comment thread Dockerfile
# containerd v1.4 for integration tests
FROM containerd-base as containerd-alt
ARG CONTAINERD_ALT_VERSION
ARG GO111MODULE=off

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH, not sure why go1.16 didn't detect vendor here, and complains about no go.mod being present; guess it still requires a go.mod even if a vendor is present 🤷‍♂️

I'lll have a look at adding this to the containerd makefile in the 1.4 branch

Or would it be better to build this version of containerd with Go 1.15? https://github.com/containerd/containerd/blob/v1.4.6/.github/workflows/ci.yml#L29

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't matter until the tests pass. These binaries are never released.

@AkihiroSuda AkihiroSuda left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will probably have to mess around with the EINTR stuff, but anyway building is flaky by nature mostly due to network flakiness, so possible extra flakiness added by EINTR is not a huge deal 😛

So LGTM.

@thaJeztah

Copy link
Copy Markdown
Member Author

We will probably have to mess around with the EINTR stuff, but anyway building is flaky by nature mostly due to network flakiness, so possible extra flakiness added by EINTR is not a huge deal 😛

From https://docs.google.com/spreadsheets/d/1U6HUWokcRnQtWCtym6mRNmF9f_OQdxFbjx6F3ItHxKY/edit#gid=1727584665

Looks like the "vendor" directory of BuildKit in moby is ok, but perhaps it'd be good to run Tibor's script on the BuildKit codebase itself (script is here: https://gist.github.com/tiborvass/786c66dfa614db4a60805c05bdf8a923#file-syscalls-go)

Here's an Excel export of that file (for others to view) - I think the conditional formatting got lost in the export from Google docs though);
Syscall_Interruption_Analysis_of_Docker.xlsx

@crazy-max

Copy link
Copy Markdown
Member

@thaJeztah In a follow-up, wonder if we should start produce riscv64 arch bin which is available since 1.14.

@tonistiigi

Copy link
Copy Markdown
Member

@crazy-max There are no alpine packages (for runc and image)

@AkihiroSuda

Copy link
Copy Markdown
Member

@tonistiigi LGTY?

@tonistiigi tonistiigi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging. But please do run the script above and create follow-up issues for any discoveries.

@tonistiigi
tonistiigi merged commit 03af083 into moby:master Jun 8, 2021
@thaJeztah
thaJeztah deleted the bump_golang branch June 8, 2021 18:00
@tonistiigi

Copy link
Copy Markdown
Member

I've seen "flightcontrol: exceeded retry timeout" errors in ci 2 times in the past day that I've never seen before. Wondering if it can be related somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants