Skip to content

Commit

Permalink
Arm (#20)
Browse files Browse the repository at this point in the history
* citest

* citest

* citest
  • Loading branch information
wangzul authored Apr 24, 2024
1 parent 2c6b03e commit 048c147
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 15 deletions.
82 changes: 72 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,90 @@ version: 2.1

# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/configuration-reference/#jobs
jobs:
build-envoy:

executors:
linux_x64_executor: # declares a reusable executor
docker:
- image: secretflow/ubuntu-base-ci:latest
- image: envoyproxy/envoy-build-ubuntu:81a93046060dbe5620d5b3aa92632090a9ee4da6
resource_class: 2xlarge
shell: /bin/bash --login -eo pipefail
linux_aarch64_executor:
docker:
- image: envoyproxy/envoy-build-ubuntu:81a93046060dbe5620d5b3aa92632090a9ee4da6
resource_class: arm.2xlarge
shell: /bin/bash --login -eo pipefail

commands:
build_envoy:
steps:
- checkout
- run:
name: Build envoy
name: "make build-envoy-local"
command: |
git submodule update --init
git config --global --add safe.directory ./
bazel build //:envoy -c opt --ui_event_filters=-info,-debug,-warning --jobs 16
mkdir -p build_apps
mv bazel-bin/envoy build_apps
make build-envoy-local
- store_artifacts:
path: build_apps
path: output

jobs:
linux_build_envoy:
parameters:
executor:
type: string
executor: <<parameters.executor>>
steps:
- checkout
- build_envoy
docker_image_publish:
docker:
- image: cimg/deploy:2023.06.1
steps:
- attach_workspace:
at: output
- checkout
- setup_remote_docker
- run:
name: Build Docker image
command: |
CIRCLETAG=$(echo ${CIRCLE_TAG} | sed 's/v//')
docker buildx create --name kuscia-envoy --platform linux/arm64,linux/amd64 --use
IMG=secretflow/kuscia-envoy
IMG_LATEST={IMG}:latest
IMG_TAG={IMG}:{CIRCLETAG}
ALIYUN_IMG=secretflow-registry.cn-hangzhou.cr.aliyuncs.com/secretflow/kuscia-envoy
ALIYUN_IMG_LATEST={ALIYUN_IMG}:latest
ALIYUN_IMG_TAG={ALIYUN_IMG}:{CIRCLETAG}
#login docker
docker login -u ${DOCKER_USERNAME} -p ${DOCKER_DEPLOY_TOKEN}
docker buildx build -t ${IMG_LATEST} --platform linux/arm64,linux/amd64 -f ./build_image/dockerfile/kuscia-envoy-anolis.Dockerfile . --push
docker buildx build -t ${IMG_TAG} --platform linux/arm64,linux/amd64 -f ./build_image/dockerfile/kuscia-envoy-anolis.Dockerfile . --push
# login docker - aliyun
docker login -u ${ALIYUN_DOCKER_USERNAME} -p ${ALIYUN_DOCKER_PASSWORD} secretflow-registry.cn-hangzhou.cr.aliyuncs.com
docker buildx build -t {ALIYUN_IMG_LATEST} --platform linux/amd64,linux/arm64 -f ./build_image/dockerfile/kuscia-envoy-anolis.Dockerfile . --push
docker buildx build -t {ALIYUN_IMG_TAG} --platform linux/amd64,linux/arm64 -f ./build_image/dockerfile/kuscia-envoy-anolis.Dockerfile . --push
# Orchestrate jobs using workflows
# See: https://circleci.com/docs/configuration-reference/#workflows
workflows:
build-workflow:
jobs:
- build-envoy
- linux_build_envoy:
matrix:
parameters:
executor: [ "linux_x64_executor", "linux_aarch64_executor" ]
- docker_image_publish:
requires:
- linux_build_envoy
filters:
branches:
ignore: /.*/
tags:
only: /^v.*/
16 changes: 12 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ COMMIT_ID = $(shell git log -1 --pretty="format:%h")
TAG = ${KUSCIA_VERSION_TAG}-${DATETIME}-${COMMIT_ID}
IMG ?= secretflow/kuscia-envoy:${TAG}

# Get current architecture information
UNAME_M_OUTPUT := $(shell uname -m)

# To configure the ARCH variable to either arm64 or amd64 or UNAME_M_OUTPUT
ARCH := $(if $(filter aarch64 arm64,$(UNAME_M_OUTPUT)),arm64,$(if $(filter amd64 x86_64,$(UNAME_M_OUTPUT)),amd64,$(UNAME_M_OUTPUT)))

CONTAINER_NAME ?= "build-envoy"
COMPILE_MODE ?=opt
TARGET ?= "//:envoy"
Expand Down Expand Up @@ -40,14 +46,15 @@ build-envoy:
@$(call start_docker)
docker exec -it ${CONTAINER_NAME} make build-envoy-local
docker exec -it ${CONTAINER_NAME} strip -s /home/admin/dev/bazel-bin/envoy
mkdir -p output/bin
mkdir -p output/conf
docker cp ${CONTAINER_NAME}:/home/admin/dev/bazel-bin/envoy output/bin
docker cp ${CONTAINER_NAME}:/home/admin/dev/kuscia/conf/envoy.yaml output/conf


.PHONY: build-envoy-local
build-envoy-local:
bazel build -c ${COMPILE_MODE} ${TARGET} --verbose_failures ${BUILD_OPTS} --@envoy//source/extensions/wasm_runtime/v8:enabled=false
mkdir -p output/linux/${ARCH}/bin
mkdir -p output/linux/${ARCH}/conf
cp bazel-bin/envoy output/linux/${ARCH}/bin
cp kuscia/conf/envoy.yaml output/linux/${ARCH}/conf

.PHONY: test-envoy
test-envoy:
Expand All @@ -65,6 +72,7 @@ clean:
$(call stop_docker)
rm -rf output


.PHONY: image
image: build-envoy
docker build -t ${IMG} -f ./build_image/dockerfile/kuscia-envoy-anolis.Dockerfile .
5 changes: 4 additions & 1 deletion build_image/dockerfile/kuscia-envoy-anolis.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
FROM openanolis/anolisos:8.8

ARG TARGETPLATFORM

ENV TZ=Asia/Shanghai

ARG ROOT_DIR="/home/kuscia"
COPY output $ROOT_DIR/

COPY ./output/$TARGETPLATFORM $ROOT_DIR/

WORKDIR ${ROOT_DIR}

Expand Down

0 comments on commit 048c147

Please sign in to comment.