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

Added support for multi-arch i.e. s390x & pp64cle #62

Closed
wants to merge 12 commits into from

Conversation

modassarrana89
Copy link

Added support for multi-arch i.e. s390x & pp64cle

Description

  1. Added multi-arch build support in Makefile
  2. Updated build and push image github workflow to push multi-arch image
  3. Added timeout for golanci-lint as required running under qemu

How Has This Been Tested?

  1. Run Github workflow with local branch & able to push multi-arch to local repository
  2. Link for succesful github workflow - https://github.com/modassarrana89/model-registry/actions/runs/8659952670
  3. Attached screenshot for reference
Screenshot 2024-04-12 at 16 37 51

Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: modassarrana89
Once this PR has been reviewed and has the lgtm label, please assign tomcli for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

Copy link
Member

@tarilabs tarilabs left a comment

Choose a reason for hiding this comment

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

Thank you @modassarrana89 for this PR !

Some very early comments:

  • can you elaborate on why you are suggesting this approach in place of scripts/build_deploy.sh which was used at present, please?
  • would it be possible to include ARM, since this multi-arch build is being performed?

thank you as this improves on:

/ok-to-test

ps: also @modassarrana89 kindly sign-off commits to comply with DCO, KF community has decided it's being used going forward. thanks!

Makefile Outdated Show resolved Hide resolved
Dockerfile Outdated
Comment on lines 23 to 31
# Download protoc compiler v24.3
RUN set -ex\
; ARCH=$(uname -m) ; echo $ARCH \
; if [ "$ARCH" == "s390x" ] ; then ARCH="s390_64" ; elif [ "$ARCH" == "ppc64le" ] ; then ARCH="ppcle_64" ; fi \
; wget -q https://github.com/protocolbuffers/protobuf/releases/download/v24.3/protoc-24.3-linux-$ARCH.zip -O protoc.zip \
; unzip -q protoc.zip \
; bin/protoc --version \
; rm protoc.zip \
;
Copy link
Member

Choose a reason for hiding this comment

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

The download of protoc is already performed as part of make deps which includes make bin/protoc, in line below 34.

This was improved with #52

Kindly consider extending scripts/install_protoc.sh for your platforms, so we don't need this extra Docker RUN ?

Copy link
Author

Choose a reason for hiding this comment

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

i didn't know about the protoc change . Once it is approved , i will update my changes accordingly for protoc

Copy link
Member

@tarilabs tarilabs left a comment

Choose a reason for hiding this comment

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

Once it is approved , i will update my changes accordingly for protoc

Hi, I cannot approve until the setup can be replicated and sign-off commits to comply with DCO as required by KF community.

It seems to me at least the following modifications are needed:

diff --git a/Dockerfile b/Dockerfile
index 5980940..d777709 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -19,20 +19,6 @@ RUN yum install -y nodejs npm java-11
 # Copy the go source
 COPY ["Makefile", "main.go", ".openapi-generator-ignore", "openapitools.json", "./"]
 
-
-# Download protoc compiler v24.3
-RUN set -ex\
-    ; ARCH=$(uname -m) ; echo $ARCH \
-    ; if [ "$ARCH" == "s390x" ] ; then ARCH="s390_64" ; elif [ "$ARCH" == "ppc64le" ] ; then ARCH="ppcle_64" ; fi \
-    ; wget -q https://github.com/protocolbuffers/protobuf/releases/download/v24.3/protoc-24.3-linux-$ARCH.zip -O protoc.zip \
-    ; unzip -q protoc.zip \
-    ; bin/protoc --version \
-    ; rm protoc.zip \
-    ;
-
-# Download tools
-RUN make deps
-
 # Copy rest of the source
 COPY .git/ .git/
 COPY cmd/ cmd/
diff --git a/Makefile b/Makefile
index a227ee8..bba3fc7 100644
--- a/Makefile
+++ b/Makefile
@@ -225,7 +225,7 @@ PLATFORMS ?= linux/amd64,linux/s390x,linux/ppc64le
 .PHONY: image/buildx
 image/buildx: ## Build and push docker image for cross-platform support
         # copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
-       sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' ./Dockerfiles/Dockerfile > ./Dockerfiles/Dockerfile.cross
+       sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' ./Dockerfile > ./Dockerfile.cross
        - $(DOCKER) buildx create --name project-v3-builder
        $(DOCKER) buildx use project-v3-builder
        - $(DOCKER) buildx build --push --platform=$(PLATFORMS) --tag ${IMG}:$(IMG_VERSION) -f Dockerfile.cross .
diff --git a/scripts/install_protoc.sh b/scripts/install_protoc.sh
index b7b165e..e346c14 100755
--- a/scripts/install_protoc.sh
+++ b/scripts/install_protoc.sh
@@ -12,6 +12,10 @@ fi
 ARCH="x86_64"
 if [[ "$(uname -m)" == "arm"* ]]; then
   ARCH="aarch_64"
+elif [[ "$(uname -m)" == "s390x" ]]; then
+  ARCH="s390_64"
+elif [[ "$(uname -m)" == "ppc64le" ]]; then
+  ARCH="ppcle_64"
 fi
 
 mkdir -p ${SCRIPT_DIR}/../bin

as in:

  1. keep using scripts/install_protoc.sh for downloading protoc as part of makefile, not re-download as part of dockerfile
  2. not sure why this original PR changes makefile to use dockerfile in subdirectory ./Dockerfiles/ 🤔

Also, I believe it would be ideal for makefile image/buildx to not push the images, wdyt?

We appreciate your PR a lot! We just need to account for these comments and kindly sign-off commits so to make it easier to collaborate.

Dockerfile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
@modassarrana89
Copy link
Author

@tarilabs I have added architecture changes in install_protoc.sh , removed protoc part from dockerfile , updated Makefile as well. Addressed all your comments . Please review once.

@tarilabs
Copy link
Member

@tarilabs I have added architecture changes in install_protoc.sh , removed protoc part from dockerfile , updated Makefile as well. Addressed all your comments . Please review once.

thank you for the updates @modassarrana89 ! As mentioned last Apr 12, and last Apr 14, ensure you signing-off your commits to comply with DCO, KF community has decided it's being used going forward. This is required.

@modassarrana89
Copy link
Author

modassarrana89 commented Apr 15, 2024

@tarilabs I have added architecture changes in install_protoc.sh , removed protoc part from dockerfile , updated Makefile as well. Addressed all your comments . Please review once.

thank you for the updates @modassarrana89 ! As mentioned last Apr 12, and last Apr 14, ensure you signing-off your commits to comply with DCO, KF community has decided it's being used going forward. This is required.

Unfortunately i am not able to rebase it properly , as i mentioned before, my initial code changes were 1 week old code. so during rebase , i am getting issues with your fix . Do you mind , if i cancelled this PR & actually create a new one with my changes & proper signoff ( as required ). Please suggest

@tarilabs
Copy link
Member

i am getting issues with your fix . Do you mind , if i cancelled this PR & actually create a new one with my changes & proper signoff ( as required ). Please suggest

not sure which of "my" fix you are referring to, but feel free to close this PR and reopen a new one, it's no problem! thank you

@modassarrana89
Copy link
Author

@tarilabs Closing this PR , as another one( #66 ) has been raised with the required changes

@modassarrana89 modassarrana89 mentioned this pull request Apr 17, 2024
tarilabs pushed a commit to tarilabs/model-registry that referenced this pull request Jun 19, 2024
periodic sync upstream KF to midstream ODH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants