Skip to content

Build CLI for arm64 Linux (and Alpine)#1442

Merged
Steven Gagniere (sgagniere) merged 34 commits intomainfrom
linux-arm64
Sep 29, 2022
Merged

Build CLI for arm64 Linux (and Alpine)#1442
Steven Gagniere (sgagniere) merged 34 commits intomainfrom
linux-arm64

Conversation

@sgagniere
Copy link
Member

@sgagniere Steven Gagniere (sgagniere) commented Sep 17, 2022

Checklist

  1. [CRUCIAL] Is the change for CP or CCloud functionalities that are already live in prod?
    • yes: ok

What

Modified the build and release scripts + makefiles to support Linux (using glibc) and Alpine (using musl libc) arm64 versions.

  • Alpine arm64 can now be built using: GOOS=linux GOARCH=arm64 make cross-build.
    • The appropriate cross-compile toolchain must be installed first: brew install filosottile/musl-cross/musl-cross --with-aarch64 (or reinstall if you've already installed the non-aarch64 version; this command installs both)
  • Linux (glibc) arm64 is built in a docker container with an image stored in a prod ECR repo.
  • Since the new version v1.9.3-RC3 of confluent-kafka-go already contains all library files that we need, the make targets switch-librdkafka-arm64 and restore-librdkafka-amd64 have been removed.

References

https://confluentinc.atlassian.net/browse/INIT-1251

Test & Review

  • Checked that the following (cross-)builds work:
    • make
    • GOARCH=arm64 make cross-build
    • GOOS=linux make cross-build
    • GOOS=linux GOARCH=arm64 make cross-build
    • GOOS=windows make cross-build
  • Built both of the glibc linux versions using an updated build_linux_glibc.sh script.
  • Ran confluent kafka topic produce and confluent kafka topic consume commands in CentOS and Alpine arm64 image to test the new supported versions.

@MuweiHe
Copy link
Contributor

MuweiHe commented Sep 19, 2022

https://confluentinc.atlassian.net/wiki/spaces/Foundations/pages/2610299218/How+to+Build+the+CLI+with+confluent-kafka-go+for+All+Platforms
let's update this one pager after merging this one!

Co-authored-by: Brian Strauch <bstrauch@confluent.io>
@brianstrauch

Do these changes still make the release significantly slower? If yes, about how much?

@sgagniere
Copy link
Member Author

Do these changes still make the release significantly slower? If yes, about how much?

Nope. Aside from the unavoidable slowness of having to upload and release 2 additional binaries, compiling linux glibc arm64 version is now down to about the same time as the rest (so anywhere from a few seconds to a minute depending on your luck), down from 12+ minutes in the last iteration.

main: cmd/confluent/main.go
flags:
- -mod=readonly
- -mod=vendor

Choose a reason for hiding this comment

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

Do you mind explaining why this was changed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Originally I did this because I had issues getting my github credentials to work on the arm64 image, but I went back and updated this amd64 file too because it feels slightly cleaner.

This way, we download all the dependencies before we copy into the image instead of downloading them in the image, and that way we don't need to copy our netrc into the cli directory and into the image.

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.

3 participants