-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to golang-with-libgit2:1.1.1.6 and use static libraries for in development #562
Conversation
95ab956
to
3a14cb8
Compare
1870e29
to
cd5eefe
Compare
This fails on Apple Silicon with: $ uname -a
Darwin stefan-m1-max.lan 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000 arm64
$ make test
IMG_TAG=ghcr.io/fluxcd/golang-with-libgit2:libgit2-1.1.1-4 ./hack/extract-libraries.sh
+ IMG_TAG=ghcr.io/fluxcd/golang-with-libgit2:libgit2-1.1.1-4
+ setup_current
+ '[' -d ./hack/libgit2 ']'
+ DIR=x86_64-alpine-linux-musl
+ PLATFORM=linux/amd64
++ uname -m
+ '[' arm64 = armv7l ']'
++ uname -m
+ '[' arm64 = aarch64 ']'
+ setup linux/amd64 x86_64-alpine-linux-musl
+ PLATFORM=linux/amd64
+ DIR=x86_64-alpine-linux-musl
+ extract linux/amd64 x86_64-alpine-linux-musl
+ PLATFORM=linux/amd64
+ DIR=x86_64-alpine-linux-musl
++ docker create --platform=linux/amd64 ghcr.io/fluxcd/golang-with-libgit2:libgit2-1.1.1-4
+ id=1a11d719c1ebf1b0b014a457670c22388b736a3c9926546133b69b2f738949c4
+ docker cp 1a11d719c1ebf1b0b014a457670c22388b736a3c9926546133b69b2f738949c4:/usr/local -
+ docker rm -v 1a11d719c1ebf1b0b014a457670c22388b736a3c9926546133b69b2f738949c4
1a11d719c1ebf1b0b014a457670c22388b736a3c9926546133b69b2f738949c4
+ tar -xf output.tar.gz local/x86_64-alpine-linux-musl --strip-component=1
tar: --strip-component=1: Not found in archive
tar: Error exit delayed from previous errors.
make: *** [Makefile:146: /Users/stefanprodan/go/src/github.com/fluxcd/source-controller/hack/libgit2/lib/libgit2.a] Error 1 |
@stefanprodan thank you for testing, the output was quite useful. Do you mind testing it again with the latest change? |
Now it fails with:
|
990099e
to
75dee8f
Compare
75dee8f fails with:
|
eb5f1ae
to
a923945
Compare
Running
I initially thought the problem was the temporary folder was failing to be created, but then even after changing it to create the files at ./build/tmp/ it still errors. I removed the I executed the same command on a arm/v8 machine (rpi 4), and this worked fine (apart from some disk related tests):
|
Signed-off-by: Paulo Gomes <[email protected]>
Fix issues developing in amd64, arm64 and apple silicon Signed-off-by: Paulo Gomes <[email protected]>
Signed-off-by: Paulo Gomes <[email protected]>
6a9afb5
to
598c350
Compare
Signed-off-by: Paulo Gomes <[email protected]>
This has been tested on the physical environments:
Pending the final test that @aryan9600 is going to run on |
92718e5 fails with:
|
Signed-off-by: Paulo Gomes <[email protected]>
mkdir tmp-download; cd tmp-download; go mod init go-download; | ||
GOBIN="${GITHUB_WORKSPACE}/build/gobin" go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest | ||
cd ..; rm -rf tmp-download |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our arm64
runners don't seem to be able to deal with Makefile's go-install-tool
when installing setup-envtest
. Although it works fine for all other targets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was quite something to review, but it looks all good to me!
Awesome job on fixing the wiring on the cross-compile to get the build times back to normal, and a stellar job on solving the build issues on MacOS 🙇 💯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Tested this on Apple Silicon and works great. Thanks @pjbgf 🏅
Main changes:
golang-with-libgit2:1.1.1.6
to speed up build time when cross compiling. Previous version was compiling in emulation mode instead, which added +10x overhead.make test
is executed against the exact same libraries that will be shipped on the built image.Makefile
to reduce its complexity.linux-amd64
download static libraries from the official container image.linux-arm64
on top of the above, requires static musl tool chain (automatically downloaded).darwin-amd64
anddarwin-arm64
download universal static libraries fordarwin
from https://github.com/fluxcd/golang-with-libgit2 releases.Depends on:
Fix: #568