Skip to content

chore: sync make target #5647

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

daixiang0
Copy link
Member

What type of PR is this?

Now make image-multiarch will build go binary of all platforms due to different default value.

Another fix is to change the default value for go build.

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Release Notes: Yes/No

@daixiang0 daixiang0 requested a review from a team as a code owner April 1, 2025 03:08
@daixiang0
Copy link
Member Author

root:[gateway]$ make image-multiarch -n
make --warn-undefined-variables -f tools/make/common.mk image-multiarch
make[1]: Entering directory '/root/gateway'
echo -e "\033[0;32m===========> Running image.verify ... \033[0m"
if [ 1 -ne 1 ]; then \
        docker -v ;\
        echo -e "\033[36m===========> Unsupported docker version. Docker API version should be greater than 1.32\033[0m"; \
        exit 1; \
fi
echo -e "\033[0;32m===========> Running image.multiarch.verify ... \033[0m"
if [ -z "Usage:  docker buildx [OPTIONS] COMMAND Run 'docker buildx COMMAND --help' for more information on a command." ]; then \
        echo -e "\033[36m===========> Cannot find docker buildx\033[0m"; \
        exit 1;\
fi
echo -e "\033[0;32m===========> Running image.multiarch.emulate.amd64 ... \033[0m"
docker run --rm --privileged tonistiigi/binfmt --install linux/amd64
echo -e "\033[0;32m===========> Running image.multiarch.emulate.arm64 ... \033[0m"
docker run --rm --privileged tonistiigi/binfmt --install linux/arm64
echo -e "\033[0;32m===========> Running image.multiarch.setup ... \033[0m"
docker buildx rm gateway-build-tools-builder || :
docker buildx create --use --name gateway-build-tools-builder --platform "linux/amd64,linux/arm64"
echo -e "\033[0;32m===========> Running go.build.darwin_amd64.egctl ... \033[0m"
echo -e "\033[36m===========> "Building binary egctl with commit e7164505 for darwin amd64"\033[0m"
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o /root/gateway/bin/darwin/amd64/egctl -ldflags "-X github.com/envoyproxy/gateway/internal/cmd/version.envoyGatewayVersion=v1.3.2 -X github.com/envoyproxy/gateway/internal/cmd/version.gitCommitID=e7164505a9116d87287a09ddd23682d480468f54" github.com/envoyproxy/gateway/cmd/egctl
echo -e "\033[0;32m===========> Running go.build.darwin_amd64.envoy-gateway ... \033[0m"
echo -e "\033[36m===========> "Building binary envoy-gateway with commit e7164505 for darwin amd64"\033[0m"
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o /root/gateway/bin/darwin/amd64/envoy-gateway -ldflags "-X github.com/envoyproxy/gateway/internal/cmd/version.envoyGatewayVersion=v1.3.2 -X github.com/envoyproxy/gateway/internal/cmd/version.gitCommitID=e7164505a9116d87287a09ddd23682d480468f54" github.com/envoyproxy/gateway/cmd/envoy-gateway
echo -e "\033[0;32m===========> Running go.build.darwin_arm64.egctl ... \033[0m"
echo -e "\033[36m===========> "Building binary egctl with commit e7164505 for darwin arm64"\033[0m"
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o /root/gateway/bin/darwin/arm64/egctl -ldflags "-X github.com/envoyproxy/gateway/internal/cmd/version.envoyGatewayVersion=v1.3.2 -X github.com/envoyproxy/gateway/internal/cmd/version.gitCommitID=e7164505a9116d87287a09ddd23682d480468f54" github.com/envoyproxy/gateway/cmd/egctl
echo -e "\033[0;32m===========> Running go.build.darwin_arm64.envoy-gateway ... \033[0m"
echo -e "\033[36m===========> "Building binary envoy-gateway with commit e7164505 for darwin arm64"\033[0m"
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o /root/gateway/bin/darwin/arm64/envoy-gateway -ldflags "-X github.com/envoyproxy/gateway/internal/cmd/version.envoyGatewayVersion=v1.3.2 -X github.com/envoyproxy/gateway/internal/cmd/version.gitCommitID=e7164505a9116d87287a09ddd23682d480468f54" github.com/envoyproxy/gateway/cmd/envoy-gateway
echo -e "\033[0;32m===========> Running go.build.linux_amd64.egctl ... \033[0m"
echo -e "\033[36m===========> "Building binary egctl with commit e7164505 for linux amd64"\033[0m"
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /root/gateway/bin/linux/amd64/egctl -ldflags "-X github.com/envoyproxy/gateway/internal/cmd/version.envoyGatewayVersion=v1.3.2 -X github.com/envoyproxy/gateway/internal/cmd/version.gitCommitID=e7164505a9116d87287a09ddd23682d480468f54" github.com/envoyproxy/gateway/cmd/egctl
echo -e "\033[0;32m===========> Running go.build.linux_amd64.envoy-gateway ... \033[0m"
echo -e "\033[36m===========> "Building binary envoy-gateway with commit e7164505 for linux amd64"\033[0m"
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /root/gateway/bin/linux/amd64/envoy-gateway -ldflags "-X github.com/envoyproxy/gateway/internal/cmd/version.envoyGatewayVersion=v1.3.2 -X github.com/envoyproxy/gateway/internal/cmd/version.gitCommitID=e7164505a9116d87287a09ddd23682d480468f54" github.com/envoyproxy/gateway/cmd/envoy-gateway
echo -e "\033[0;32m===========> Running go.build.linux_arm64.egctl ... \033[0m"
echo -e "\033[36m===========> "Building binary egctl with commit e7164505 for linux arm64"\033[0m"
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o /root/gateway/bin/linux/arm64/egctl -ldflags "-X github.com/envoyproxy/gateway/internal/cmd/version.envoyGatewayVersion=v1.3.2 -X github.com/envoyproxy/gateway/internal/cmd/version.gitCommitID=e7164505a9116d87287a09ddd23682d480468f54" github.com/envoyproxy/gateway/cmd/egctl
echo -e "\033[0;32m===========> Running go.build.linux_arm64.envoy-gateway ... \033[0m"
echo -e "\033[36m===========> "Building binary envoy-gateway with commit e7164505 for linux arm64"\033[0m"
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o /root/gateway/bin/linux/arm64/envoy-gateway -ldflags "-X github.com/envoyproxy/gateway/internal/cmd/version.envoyGatewayVersion=v1.3.2 -X github.com/envoyproxy/gateway/internal/cmd/version.gitCommitID=e7164505a9116d87287a09ddd23682d480468f54" github.com/envoyproxy/gateway/cmd/envoy-gateway
echo -e "\033[0;32m===========> Running go.build.windows_amd64.egctl ... \033[0m"
echo -e "\033[36m===========> "Building binary egctl with commit e7164505 for windows amd64"\033[0m"
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o /root/gateway/bin/windows/amd64/egctl -ldflags "-X github.com/envoyproxy/gateway/internal/cmd/version.envoyGatewayVersion=v1.3.2 -X github.com/envoyproxy/gateway/internal/cmd/version.gitCommitID=e7164505a9116d87287a09ddd23682d480468f54" github.com/envoyproxy/gateway/cmd/egctl
echo -e "\033[0;32m===========> Running go.build.windows_amd64.envoy-gateway ... \033[0m"
echo -e "\033[36m===========> "Building binary envoy-gateway with commit e7164505 for windows amd64"\033[0m"
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o /root/gateway/bin/windows/amd64/envoy-gateway -ldflags "-X github.com/envoyproxy/gateway/internal/cmd/version.envoyGatewayVersion=v1.3.2 -X github.com/envoyproxy/gateway/internal/cmd/version.gitCommitID=e7164505a9116d87287a09ddd23682d480468f54" github.com/envoyproxy/gateway/cmd/envoy-gateway
echo -e "\033[0;32m===========> Running go.build.windows_arm64.egctl ... \033[0m"
echo -e "\033[36m===========> "Building binary egctl with commit e7164505 for windows arm64"\033[0m"
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -o /root/gateway/bin/windows/arm64/egctl -ldflags "-X github.com/envoyproxy/gateway/internal/cmd/version.envoyGatewayVersion=v1.3.2 -X github.com/envoyproxy/gateway/internal/cmd/version.gitCommitID=e7164505a9116d87287a09ddd23682d480468f54" github.com/envoyproxy/gateway/cmd/egctl
echo -e "\033[0;32m===========> Running go.build.windows_arm64.envoy-gateway ... \033[0m"
echo -e "\033[36m===========> "Building binary envoy-gateway with commit e7164505 for windows arm64"\033[0m"
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -o /root/gateway/bin/windows/arm64/envoy-gateway -ldflags "-X github.com/envoyproxy/gateway/internal/cmd/version.envoyGatewayVersion=v1.3.2 -X github.com/envoyproxy/gateway/internal/cmd/version.gitCommitID=e7164505a9116d87287a09ddd23682d480468f54" github.com/envoyproxy/gateway/cmd/envoy-gateway
echo -e "\033[0;32m===========> Running image.build.multiarch ... \033[0m"
docker buildx build bin -f "/root/gateway/tools/docker/envoy-gateway/Dockerfile" -t "docker.io/envoyproxy/gateway-dev:e7164505" --platform "linux/amd64,linux/arm64"
make[1]: Leaving directory '/root/gateway'

Copy link

codecov bot commented Apr 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.32%. Comparing base (63ca7b0) to head (eade638).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5647      +/-   ##
==========================================
+ Coverage   65.27%   65.32%   +0.05%     
==========================================
  Files         213      213              
  Lines       34076    34132      +56     
==========================================
+ Hits        22243    22297      +54     
  Misses      10500    10500              
- Partials     1333     1335       +2     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@@ -39,6 +39,7 @@ REV=$(shell git rev-parse --short HEAD)

# Supported Platforms for building multiarch binaries.
PLATFORMS ?= darwin_amd64 darwin_arm64 linux_amd64 linux_arm64 windows_amd64 windows_arm64
IMAGE_PLATFORMS ?= ${PLATFORMS}
Copy link
Contributor

Choose a reason for hiding this comment

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

curious why this is needed ?
the default seems to be IMAGE_PLATFORMS ?= linux_amd64 linux_arm64 in L14 in image.mk

Copy link
Member Author

Choose a reason for hiding this comment

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

As description said, although we only build linux image as default, go binary will build for all arches :(

Copy link
Contributor

Choose a reason for hiding this comment

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

im still unable to understand why IMAGE_PLATFORMS needs to be set here ? so we can build all image types by default ?

Copy link
Member Author

Choose a reason for hiding this comment

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

If not set here, build image with default value will build:

  • binaries for all arch
  • images only for Linux

I think should only build binaries only for Linux as well, WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

sure, how does setting L42 to all values in L41 solve this though

Copy link
Member Author

Choose a reason for hiding this comment

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

In this way, the default behavior will keep sync.

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.

2 participants