-
Notifications
You must be signed in to change notification settings - Fork 160
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
Sedna control plane supports amd64/arm64 #196
Conversation
8a1cad5
to
31e53c6
Compare
22826f1
to
2666fd9
Compare
hack/lib/mutil-arch.sh
Outdated
https://github.com/docker/buildx/releases/download/v0.6.3/buildx-v0.6.3.linux-amd64 | ||
chmod a+x ~/.docker/cli-plugins/docker-buildx | ||
|
||
cat > ~/.docker/config.json <<EOF |
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.
this would overwrite the user original docker config
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.
fix it
Makefile
Outdated
for target in "gm" "lc"; do \ | ||
docker buildx build --push \ | ||
--build-arg GO_LDFLAGS=${GO_LDFLAGS} \ | ||
--platform linux/amd64,linux/arm64 \ |
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.
make the platforms configurable.
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.
fix it
hack/lib/mutil-arch.sh
Outdated
|
||
# Update buildx plugin to version 6.0+. | ||
mkdir -pv ~/.docker/cli-plugins/ | ||
wget -O ~/.docker/cli-plugins/docker-buildx \ |
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.
please check it first, buildx maybe already built in docker, or installed by this way.
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.
fix it
hack/lib/mutil-arch.sh
Outdated
# Update buildx plugin to version 6.0+. | ||
mkdir -pv ~/.docker/cli-plugins/ | ||
wget -O ~/.docker/cli-plugins/docker-buildx \ | ||
https://github.com/docker/buildx/releases/download/v0.6.3/buildx-v0.6.3.linux-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.
please get arch from current build machine first instead of hard amd64
https://github.com/docker/buildx/releases/download/v0.6.3/buildx-v0.6.3.linux-amd64 | |
https://github.com/docker/buildx/releases/download/v0.6.3/buildx-v0.6.3.linux-$arch |
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.
fix it
hack/lib/golang.sh
Outdated
@@ -207,6 +207,9 @@ sedna::golang::build_binaries() { | |||
goldflags="${GOLDFLAGS=-s -w -buildid=} $(sedna::version::ldflags)" | |||
gogcflags="${GOGCFLAGS:-}" | |||
|
|||
CGO_ENABLED=0 | |||
GOARCH=arm64 |
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.
Only build arm64, how about other archs, e.g. x86
?
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.
delete it
7780eaf
to
4017c62
Compare
hack/lib/mutil-arch.sh
Outdated
docker_buildx=~/.docker/cli-plugins/docker-buildx | ||
if [ ! -x $docker_buildx ];then | ||
mkdir -pv $(dirname $docker_buildx) | ||
arch=$(dpkg --print-architecture) |
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.
dpkg only available in debain like system, use 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.
delete install buildx
hack/lib/mutil-arch.sh
Outdated
arch=$(dpkg --print-architecture) | ||
wget -O $docker_buildx \ | ||
https://github.com/docker/buildx/releases/download/v0.6.3/buildx-v0.6.3.linux-$arch | ||
chmod a+x ~/.docker/cli-plugins/docker-buildx |
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.
chmod a+x ~/.docker/cli-plugins/docker-buildx | |
chmod a+x $docker_buildx |
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.
delete install buildx
@@ -13,8 +13,14 @@ | |||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
# See the License for the specific language governing permissions and | |||
# limitations under the License. | |||
set -x |
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.
set -x |
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.
ok
hack/lib/mutil-arch.sh
Outdated
mkdir -pv $(dirname $docker_buildx) | ||
arch=$(dpkg --print-architecture) | ||
wget -O $docker_buildx \ | ||
https://github.com/docker/buildx/releases/download/v0.6.3/buildx-v0.6.3.linux-$arch |
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.
make buildx version as variable
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.
delete install buildx
1211c18
to
365641d
Compare
Makefile
Outdated
@@ -18,6 +18,10 @@ OUT_DIR ?= _output | |||
OUT_BINPATH := $(OUT_DIR)/bin | |||
|
|||
IMAGE_REPO ?= kubeedge | |||
|
|||
PLATFORMS ?= "linux/amd64,linux/arm64" |
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.
Can you add a description about full list of platforms?
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.
OK
@@ -17,4 +17,9 @@ | |||
cd "$(dirname "${BASH_SOURCE[0]}")" | |||
|
|||
source build_image.sh | |||
docker push $IMAGE | |||
|
|||
if [ ! -n "$1" ]; then |
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.
Use environment variable instead of argument list to toggle cross build capability.
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.
Such as
if [ ! -n "$1" ]; then | |
if [ -z "${CROSS_PLATFORMS:-}" ]; then |
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.
ok
365641d
to
e6e10c1
Compare
hack/lib/mutil-arch.sh
Outdated
@@ -0,0 +1,47 @@ | |||
#!/usr/bin/env bash |
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.
delete this script
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.
No need since we can leave the buildx download/config to developer.
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.
we need to have buildx multiple platforms features config, leave the buildx download to developer.
Add a cross build target in Makefile, not only image push action |
e6e10c1
to
b9fee0b
Compare
@llhuii |
hack/lib/buildx.sh
Outdated
|
||
# Check whether buildx exists. | ||
if ! docker buildx >/dev/null 2>&1; then | ||
echo "ERROR: docker buildx not available. Docker 19.03 or higher is required with experimental features enabled" |
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.
log error to stderr
echo "ERROR: docker buildx not available. Docker 19.03 or higher is required with experimental features enabled" | |
echo "ERROR: docker buildx not available. Docker 19.03 or higher is required with experimental features enabled" >&2 |
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.
fix it
hack/lib/buildx.sh
Outdated
docker run --privileged --rm tonistiigi/binfmt --install all | ||
|
||
# Create a new builder which gives access to the new multi-architecture features. | ||
builder_instance="build-node-sedna" |
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.
prefix sedna?
builder_instance="build-node-sedna" | |
builder_instance="sedna-buildx" |
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.
ok
hack/lib/buildx.sh
Outdated
|
||
# Create a new builder which gives access to the new multi-architecture features. | ||
builder_instance="build-node-sedna" | ||
temp=$(docker buildx ls | awk NF=1) |
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.
How about using docker buildx inspect $builder_instance
?
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.
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.
ok, use if ! docker buildx inspect $build_instance
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.
remember to discard stdout/stdin
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.
ok
Use the |
can not do it by my test, https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#image |
b9fee0b
to
bbbe967
Compare
|
b3dcbba
to
776e71b
Compare
98a76af
to
1a65964
Compare
good job |
The checker |
/hold |
1a65964
to
a737a08
Compare
fix it , reference: https://docs.docker.com/buildx/working-with-buildx/#build-multi-platform-images |
hack/lib/buildx.sh
Outdated
for component in ${COMPONENTS[@]}; do | ||
echo "building ${PLATFORMS} image for ${component}" | ||
|
||
sed "/AS builder/s/FROM/FROM --platform=\$BUILDPLATFORM/g" build/${component}/Dockerfile > ${temp_dockerfile} |
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 cross-build-dockerfile generating code happend at two places, use function generate-cross-build-dockerfile
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.
fix it
a737a08
to
9165ea1
Compare
control plane images support amd64/arm64 add a workerflow action: docker_cross_build Signed-off-by: JimmyYang20 <yangjin39@huawei.com>
9165ea1
to
d8766bd
Compare
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: llhuii 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 |
fix issues: #170
Signed-off-by: JimmyYang20 yangjin39@huawei.com