-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[WIP] feat: add harbor arm build parameters #17968
[WIP] feat: add harbor arm build parameters #17968
Conversation
@@ -13,6 +13,8 @@ env: | |||
REDIS_HOST: localhost | |||
REG_VERSION: v2.7.1-patch-2819-2553 | |||
UI_BUILDER_VERSION: 1.6.0 | |||
ARCH: amd64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add support for multi-architecture parameters,default is amd64.
@@ -121,13 +121,19 @@ CHARTMUSEUMVERSION=$(CHARTMUSEUM_SRC_TAG)-redis | |||
# version of registry for pulling the source code | |||
REGISTRY_SRC_TAG=v2.8.0 | |||
|
|||
# go build param |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added support for golang cross-compilation parameters
@@ -147,6 +153,17 @@ DOCKERSAVE=$(DOCKERCMD) save | |||
DOCKERCOMPOSECMD=$(shell which docker-compose) | |||
DOCKERTAG=$(DOCKERCMD) tag | |||
|
|||
# according to the build platform, replace the relevant parameters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If compiling the image of the arm architecture, replace the build image parameters arm
suffix
GOARCH=arm64 | ||
TRIVY_DOWNLOAD_URL=https://github.com/aquasecurity/trivy/releases/download/$(TRIVYVERSION)/trivy_$(TRIVYVERSION:v%=%)_Linux-ARM64.tar.gz | ||
TRIVY_ADAPTER_DOWNLOAD_URL=https://github.com/aquasecurity/harbor-scanner-trivy/releases/download/$(TRIVYADAPTERVERSION)/harbor-scanner-trivy_$(TRIVYADAPTERVERSION:v%=%)_Linux_arm64.tar.gz | ||
DOCKERBUILD=$(DOCKERCMD) buildx build --platform linux/arm64 --progress plain --output=type=docker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace docker build with dokcer buildx
@@ -371,27 +388,27 @@ check_environment: | |||
compile_core: gen_apis | |||
@echo "compiling binary for core (golang image)..." | |||
@echo $(GOBUILDPATHINCONTAINER) | |||
@$(DOCKERCMD) run --rm -v $(BUILDPATH):$(GOBUILDPATHINCONTAINER) -w $(GOBUILDPATH_CORE) $(GOBUILDIMAGE) $(GOIMAGEBUILD_CORE) -o $(GOBUILDPATHINCONTAINER)/$(GOBUILDMAKEPATH_CORE)/$(CORE_BINARYNAME) | |||
@$(DOCKERCMD) run --rm --env GOOS=$(GOOS) --env GOARCH=$(GOARCH) -v $(BUILDPATH):$(GOBUILDPATHINCONTAINER) -w $(GOBUILDPATH_CORE) $(GOBUILDIMAGE) $(GOIMAGEBUILD_CORE) -o $(GOBUILDPATHINCONTAINER)/$(GOBUILDMAKEPATH_CORE)/$(CORE_BINARYNAME) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pass golang cross-compilation parameters during compilation to support multi-architecture compilation
@@ -22,12 +22,17 @@ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/insta | |||
sudo service postgresql stop || echo no postgresql need to be stopped | |||
sleep 2 | |||
|
|||
# support for multi-architecture compilation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are building an arm image, the replacement tag should have a tag with an arm suffix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -8,7 +8,7 @@ docker run --env LDAP_ORGANISATION="Harbor." \ | |||
--env LDAP_TLS_VERIFY_CLIENT="never" \ | |||
-p 389:389 \ | |||
-p 636:636 \ | |||
--detach --name $NAME osixia/openldap:1.1.7 | |||
--detach --name $NAME osixia/openldap:1.5.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
openldap version 1.5.0 is a multi-architecture mirror
@@ -7,8 +7,19 @@ ARG MOCKERY_VERSION | |||
ENV XDG_CACHE_HOME /tmp | |||
ENV GO111MODULE auto | |||
|
|||
RUN mkdir -p /tmp/mockery-${MOCKERY_VERSION} && \ | |||
RUN ARCH= && dpkgArch="$(uname -m)" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mockery component supports building arm images
Codecov Report
@@ Coverage Diff @@
## main #17968 +/- ##
==========================================
+ Coverage 66.40% 66.42% +0.01%
==========================================
Files 1012 1012
Lines 108670 108670
Branches 2674 2674
==========================================
+ Hits 72167 72182 +15
+ Misses 32540 32528 -12
+ Partials 3963 3960 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
|
cd0a600
to
70d8e5f
Compare
Signed-off-by: Jeremy-boo <bozhu@alauda.io>
70d8e5f
to
028c28a
Compare
@Jeremy-boo Hi, I want to know why the current pr has not been merged, and I hope I can help solve some problems. |
Sorry, this PR has already been reviewed before. I was busy at the beginning of the year and didn’t have time to deal with the comments. I will send time to deal with the comments this weekend, and then re-initiate the review process. Thank you very much |
This PR is being marked stale due to a period of inactivty. If this PR is still relevant, please comment or remove the stale label. Otherwise, this PR will close in 30 days. |
@dioguerra @wy65701436 |
Any news regarding this PR? |
This PR is being marked stale due to a period of inactivty. If this PR is still relevant, please comment or remove the stale label. Otherwise, this PR will close in 30 days. |
This PR was closed because it has been stalled for 30 days with no activity. If this PR is still relevant, please re-open a new PR against main. |
Signed-off-by: Jeremy-boo bozhu@alauda.io
Thank you for contributing to Harbor!
Comprehensive Summary of your change
Add support for multi-arch platform builds
Issue being fixed
Fixes #(issue)
Please indicate you've done the following: