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

OCPVE-361: chore: allow multi-arch with ARCH / OS Flag #392

Conversation

jakobmoellerdev
Copy link
Contributor

Allows building multi-arch images with ARCH / OS Flag from makefile. Also adjusts dockerfile to have the correct flags passed to the builder and running platform image.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Aug 22, 2023
@openshift-ci-robot
Copy link

openshift-ci-robot commented Aug 22, 2023

@jakobmoellerdev: This pull request references OCPVE-361 which is a valid jira issue.

In response to this:

Allows building multi-arch images with ARCH / OS Flag from makefile. Also adjusts dockerfile to have the correct flags passed to the builder and running platform image.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci openshift-ci bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Aug 22, 2023
@openshift-ci openshift-ci bot requested review from jeff-roche and jerpeter1 August 22, 2023 11:13
@codecov-commenter
Copy link

Codecov Report

Merging #392 (2da37b6) into main (a962b90) will increase coverage by 40.06%.
Report is 28 commits behind head on main.
The diff coverage is 68.65%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main     #392       +/-   ##
===========================================
+ Coverage   16.59%   56.65%   +40.06%     
===========================================
  Files          24       26        +2     
  Lines        2061     2245      +184     
===========================================
+ Hits          342     1272      +930     
+ Misses       1693      883      -810     
- Partials       26       90       +64     
Files Changed Coverage Δ
controllers/lvmcluster_controller_watches.go 90.32% <ø> (+90.32%) ⬆️
pkg/vgmanager/lvm.go 52.03% <ø> (+4.06%) ⬆️
controllers/topolvm_snapshotclass.go 61.22% <14.28%> (+61.22%) ⬆️
pkg/vgmanager/vgmanager_controller.go 10.40% <48.43%> (+10.40%) ⬆️
controllers/lvmcluster_controller.go 58.63% <50.00%> (+58.63%) ⬆️
pkg/cluster/leaderelection.go 66.66% <66.66%> (ø)
pkg/cluster/sno.go 72.72% <72.72%> (ø)
controllers/persistent-volume-claim/controller.go 60.29% <75.00%> (+19.71%) ⬆️
pkg/vgmanager/lv_attr.go 92.59% <92.59%> (ø)
pkg/vgmanager/devices.go 76.80% <95.00%> (+2.60%) ⬆️
... and 1 more

... and 7 files with indirect coverage changes


build-prometheus-alert-rules: jsonnet monitoring/mixin.libsonnet monitoring/alerts/alerts.jsonnet monitoring/alerts/*.libsonnet
$(JSONNET) -S monitoring/alerts/alerts.jsonnet > config/prometheus/prometheus_rules.yaml

docker-build: ## Build docker image with the manager.
$(IMAGE_BUILD_CMD) build -t ${IMG} .
$(IMAGE_BUILD_CMD) build --platform=${OS}/${ARCH} -t ${IMG} .
Copy link
Contributor

Choose a reason for hiding this comment

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

This does not work on darwin/arm64:

➜  ✗ make docker-build
podman build --platform=darwin/arm64 -t quay.io/test/lvms-operator:tag .
[1/2] STEP 1/13: FROM golang:1.20 AS builder
Resolving "golang" using unqualified-search registries (/etc/containers/registries.conf.d/999-podman-machine.conf)
Trying to pull docker.io/library/golang:1.20...
Error: creating build container: choosing an image from manifest list docker://golang:1.20: no image found in manifest list for architecture arm64, variant "", OS darwin

make: *** [docker-build] Error 125

I don't know if we will ever need to build container images for different platforms from here. Can we make this at least parametric, meaning it will build for linux/amd64 by default unless related parameters are specified?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So it was actually parametric already, but used go env variables for OS / ARCH. I just hardcoded the Args to linux/amd64 now. You should be able to run this normally without any changes now.

@jakobmoellerdev jakobmoellerdev force-pushed the OCPVE-361-multi-arch-builds branch from 2da37b6 to 0eadbd6 Compare August 22, 2023 15:21
@jakobmoellerdev
Copy link
Contributor Author

/test images

@jakobmoellerdev
Copy link
Contributor Author

/test lvm-operator-e2e-aws

@suleymanakbas91
Copy link
Contributor

/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 22, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 22, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jakobmoellerdev, suleymanakbas91

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 22, 2023
@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD 04a7434 and 2 for PR HEAD 0eadbd6 in total

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 22, 2023

@jakobmoellerdev: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot merged commit 05fea28 into openshift:main Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants