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

multiarch: Build multiarch binaries and images #24

Merged
merged 1 commit into from
Jun 17, 2024

Conversation

Billy99
Copy link
Contributor

@Billy99 Billy99 commented Jun 14, 2024

Since bpfman-operator is moving to it's own repo, no longer build and push the bpfman-operator and bpfman-agent from the bpfman repo, but instead, build and push from the bpfman-operator repo.

Rework the Makefile such that it no longer loops through each architecture. Building all architectures is done in github actions. The Makefile still allows local cross compiling for a single architecture, just not all architectures in one command. This simplifies the Makefile and yaml files loading images don't need -amd64 appended anywhere.

@Billy99 Billy99 force-pushed the billy99-oper-multiarch-bins branch 2 times, most recently from aec0df7 to 3416968 Compare June 14, 2024 16:33
Copy link

codecov bot commented Jun 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 27.04%. Comparing base (49345cd) to head (45fc3fa).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #24      +/-   ##
==========================================
+ Coverage   26.36%   27.04%   +0.67%     
==========================================
  Files          75       75              
  Lines        5112     6083     +971     
==========================================
+ Hits         1348     1645     +297     
- Misses       3600     4274     +674     
  Partials      164      164              
Flag Coverage Δ
unittests 27.04% <ø> (+0.67%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Billy99 Billy99 force-pushed the billy99-oper-multiarch-bins branch 6 times, most recently from 7e6816f to a341411 Compare June 14, 2024 20:06
@Billy99 Billy99 force-pushed the billy99-oper-multiarch-bins branch 2 times, most recently from 1d790c8 to fa94e4f Compare June 17, 2024 17:39
@Billy99 Billy99 marked this pull request as ready for review June 17, 2024 17:39
@Billy99 Billy99 changed the title [WIP] multiarch: Build multiarch binaries and images multiarch: Build multiarch binaries and images Jun 17, 2024
Copy link
Contributor

@anfredette anfredette left a comment

Choose a reason for hiding this comment

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

LGTM, but @astoycos has been following this more closely than me, so I'll let him do the final approval.

with:
files: ./cover.out
flags: unittests
fail_ci_if_error: false
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for breaking this out.

uses: docker/build-push-action@v5
with:
platforms: linux/amd64, linux/arm64, linux/ppc64le, linux/s390x
push: ${{ fromJSON(steps.set-push.outputs.push_flag) }}
Copy link
Member

Choose a reason for hiding this comment

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

hrm why the fromJSON() function call here?

Copy link
Member

Choose a reason for hiding this comment

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

I would think just steps.set-push.outputs.push_flag would work

Copy link
Contributor Author

@Billy99 Billy99 Jun 17, 2024

Choose a reason for hiding this comment

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

Needed to convert from the string "true" to a boolean true/false. It balked at just passing steps.set-push.outputs.push_flag.

@@ -95,21 +162,10 @@ jobs:
images: ${{ matrix.image.registry }}/${{ matrix.image.repository }}/${{ matrix.image.image }}
tags: ${{ matrix.image.tags }}

- name: Build image
Copy link
Member

Choose a reason for hiding this comment

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

Wait are we still actually building the bundle image anywhere?

Copy link
Contributor Author

@Billy99 Billy99 Jun 17, 2024

Choose a reason for hiding this comment

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

Yes, it's in it's own job, line 132 (https://github.com/bpfman/bpfman-operator/pull/24/files#diff-502adaf7a495a56eb3ecef9c7f4c295ce0ac343f9b0d4e2fd321910fdf8f58bdR132). I was on the fence on one job or two. There are a handful of common steps (Checkout bpfman, Install Golang, etc), but several that are specific to bundle (Generate olm bundle on disk, Push to registry) and even more in the Build Image job that don't need to run.

Copy link
Member

@astoycos astoycos Jun 17, 2024

Choose a reason for hiding this comment

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

I get that it's in it's own job now and that's alright since we don't have to build it for every different platform, however in the

name: Build Bundle Image (${{ matrix.image.image }})
job I don't see where we're building the bundle image,

make bundle just makes sure all the manifests for the bundle are generated


- name: Generate olm bundle on disk
if: ${{ matrix.image.image == 'bpfman-operator-bundle' }}
run: |
make bundle
Copy link
Member

@astoycos astoycos Jun 17, 2024

Choose a reason for hiding this comment

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

This needs to be make bundle-build to actually build the bundle image. Since the manifests in https://github.com/bpfman/bpfman-operator/tree/main/bundle should always be up to date now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


- uses: actions/setup-go@v5
- name: Install Golang
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we'll even need this for just make bundle-build

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

@Billy99 Billy99 force-pushed the billy99-oper-multiarch-bins branch 2 times, most recently from 94b3890 to 45fc3fa Compare June 17, 2024 21:15
Copy link
Member

@astoycos astoycos left a comment

Choose a reason for hiding this comment

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

Thanks @Billy99!

@mergify mergify bot merged commit 2e1bef1 into bpfman:main Jun 17, 2024
15 checks passed
Since bpfman-operator is moving to it's own repo, no longer build and
push the bpfman-operator and bpfman-agent from the bpfman repo, but
instead, build and push from the bpfman-operator repo.

Rework the Makefile such that it no longer loops through each
architecture. Building all architectures is done in github actions. The
Makefile still allows local cross compiling for a single architecture,
just not all architectures in one command. This simplifies the Makefile.

Signed-off-by: Billy McFall <22157057+Billy99@users.noreply.github.com>
@Billy99 Billy99 deleted the billy99-oper-multiarch-bins branch June 18, 2024 11:36
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