Skip to content
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

Add qemu emulated arm64 node image build #8806

Merged
merged 2 commits into from
May 9, 2024
Merged

Conversation

hjiawei
Copy link
Contributor

@hjiawei hjiawei commented May 9, 2024

Description

Qemu emulated arm64 node image build was remove in [1] in favor of the native builds. However, our release process isn't update to date with native runners. This changeset adds qemu back to arm64 node image build and updates qemu static binary copy and clean up for ppc64le and s390x.

[1] https://github.com/projectcalico/calico/pull/8558/files#diff-c6e82bd404a904c10b9a0756d78d913a8a5e2ff833fefd384c80af1d7c93c3bb

Related issues/PRs

Todos

  • Tests
  • Documentation
  • Release note

Release Note

TBD

Reminder for the reviewer

Make sure that this PR has the correct labels and milestone set.

Every PR needs one docs-* label.

  • docs-pr-required: This change requires a change to the documentation that has not been completed yet.
  • docs-completed: This change has all necessary documentation completed.
  • docs-not-required: This change has no user-facing impact and requires no docs.

Every PR needs one release-note-* label.

  • release-note-required: This PR has user-facing changes. Most PRs should have this label.
  • release-note-not-required: This PR has no user-facing changes.

Other optional labels:

  • cherry-pick-candidate: This PR should be cherry-picked to an earlier release. For bug fixes only.
  • needs-operator-pr: This PR is related to install and requires a corresponding change to the operator.

Qemu emulated arm64 node image build was remove in [1]
in favor of the native builds. However, our release process
isn't update to date with native runners. This changeset adds
qemu back to arm64 node image build and updates qemu
static binary copy and clean up for ppc64le and s390x.

[1] https://github.com/projectcalico/calico/pull/8558/files#diff-c6e82bd404a904c10b9a0756d78d913a8a5e2ff833fefd384c80af1d7c93c3bb
@hjiawei hjiawei requested a review from a team as a code owner May 9, 2024 15:37
@marvin-tigera marvin-tigera added this to the Calico v3.29.0 milestone May 9, 2024
@marvin-tigera marvin-tigera added release-note-required Change has user-facing impact (no matter how small) docs-pr-required Change is not yet documented labels May 9, 2024
Copy link
Collaborator

@frozenprocess frozenprocess left a comment

Choose a reason for hiding this comment

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

@hjiawei you need to add the follwoing

if [[ "$BUILDPLATFORM" != "$TARGETPLATFORM" ]]; then \
    sed -i "s/runit-init/\/tmp\/admin\/runit-2.1.2\/compile\/runit-init/" src/runit-init.dist && \
    sed -i "s/runsv/\/tmp\/admin\/runit-2.1.2\/compile\/runsv/" src/runsv.dist && \
    sed -i "s/runsvchdir/\/tmp\/admin\/runit-2.1.2\/compile\/runsvchdir/" src/runsvchdir.dist && \
    sed -i "s/runsvdir/\/tmp\/admin\/runit-2.1.2\/compile\/runsvdir/" src/runsvdir.dist && \
    sed -i "s/svlogd/\/tmp\/admin\/runit-2.1.2\/compile\/svlogd/" src/svlogd.dist && \
    sed -i "s/utmpset/\/tmp\/admin\/runit-2.1.2\/compile\/utmpset/" src/utmpset.dist && \
    fi && \
    package/install

to https://github.com/projectcalico/calico/blob/8dec244a9ddfa91944cface00f01a45ea8f09beb/node/Dockerfile.arm64#L87C1-L87C43
This change prevents the run-it check from failing which happens since binfmt absolute path differs from a native build.

BUILDPLATFORM + TARGETPLATFORM -> https://docs.docker.com/build/building/multi-platform/#cross-compilation

`package/check` (part of `package/install`) fails on qemu emulated arm64
build without the hacks we made in [1]. However, this hack will break
native arm64 build [2]. This change workaround this issue by calling
`pacpackage/compile` as the runit binaries are important to us and
copied in the next stage.

[1] https://github.com/projectcalico/node/pull/1044/files#diff-02ae637382f3cca949bd439c8b796acdb08abfbbe4b712eafae1bb80dd08f866R99
[2] #8285
@hjiawei
Copy link
Contributor Author

hjiawei commented May 9, 2024

@hjiawei you need to add the follwoing

if [[ "$BUILDPLATFORM" != "$TARGETPLATFORM" ]]; then \
    sed -i "s/runit-init/\/tmp\/admin\/runit-2.1.2\/compile\/runit-init/" src/runit-init.dist && \
    sed -i "s/runsv/\/tmp\/admin\/runit-2.1.2\/compile\/runsv/" src/runsv.dist && \
    sed -i "s/runsvchdir/\/tmp\/admin\/runit-2.1.2\/compile\/runsvchdir/" src/runsvchdir.dist && \
    sed -i "s/runsvdir/\/tmp\/admin\/runit-2.1.2\/compile\/runsvdir/" src/runsvdir.dist && \
    sed -i "s/svlogd/\/tmp\/admin\/runit-2.1.2\/compile\/svlogd/" src/svlogd.dist && \
    sed -i "s/utmpset/\/tmp\/admin\/runit-2.1.2\/compile\/utmpset/" src/utmpset.dist && \
    fi && \
    package/install

to https://github.com/projectcalico/calico/blob/8dec244a9ddfa91944cface00f01a45ea8f09beb/node/Dockerfile.arm64#L87C1-L87C43 This change prevents the run-it check from failing which happens since binfmt absolute path differs from a native build.

BUILDPLATFORM + TARGETPLATFORM -> https://docs.docker.com/build/building/multi-platform/#cross-compilation

@frozenprocess Thanks for pointing that out and I also noticed this when retesting the emulated arm64 build. I have made and alternative change in 407509a. PTAL.

Copy link
Collaborator

@frozenprocess frozenprocess left a comment

Choose a reason for hiding this comment

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

@hjiawei thanks for the quick change! it should fix the runit problem in a clean way.

@hjiawei hjiawei merged commit 5f808f9 into master May 9, 2024
2 checks passed
@hjiawei hjiawei deleted the node-arm64-emulated-build branch May 9, 2024 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-pr-required Change is not yet documented release-note-required Change has user-facing impact (no matter how small)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants