Skip to content

Commit

Permalink
repo-sync-2024-05-08T11:48:38+0800 (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
gshilei authored May 8, 2024
1 parent 1d5d7dd commit f2203cc
Show file tree
Hide file tree
Showing 46 changed files with 5,202 additions and 310 deletions.
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.3.2
6.0.0
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:7304f974de2724617b7492ccb4c9c58cd420353a
resource_class: 2xlarge
shell: /bin/bash --login -eo pipefail
linux_aarch64_executor:
docker:
- image: envoyproxy/envoy-build-ubuntu:7304f974de2724617b7492ccb4c9c58cd420353a
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.*/
8 changes: 8 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Language: Cpp
BasedOnStyle: LLVM
DerivePointerAlignment: false
PointerAlignment: Left
ColumnLimit: 99
MaxEmptyLinesToKeep: 1
PenaltyBreakAssignment: 2
AlignTrailingComments: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ bazel-*
.bazel-cache
.idea
.vscode
cache
2 changes: 2 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ envoy_cc_binary(
"//kuscia/source/filters/http/kuscia_crypt:kuscia_crypt_config",
"//kuscia/source/filters/http/kuscia_token_auth:kuscia_token_auth_config",
"//kuscia/source/filters/http/kuscia_header_decorator:kuscia_header_decorator_config",
"//kuscia/source/filters/http/kuscia_poller:kuscia_poller_config",
"//kuscia/source/filters/http/kuscia_receiver:kuscia_receiver_config",
"@envoy//source/exe:envoy_main_entry_lib",
],
)
Expand Down
27 changes: 21 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SHELL := /bin/bash
BUILD_IMAGE = envoyproxy/envoy-build-ubuntu:81a93046060dbe5620d5b3aa92632090a9ee4da6
BUILD_IMAGE = envoyproxy/envoy-build-ubuntu:7304f974de2724617b7492ccb4c9c58cd420353a

# Image URL to use all building image targets
DATETIME = $(shell date +"%Y%m%d%H%M%S")
Expand All @@ -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-$(shell echo ${USER})"
COMPILE_MODE ?=opt
TARGET ?= "//:envoy"
Expand All @@ -17,6 +23,8 @@ TEST_COMPILE_MODE = fastbuild
TEST_TARGET ?= "//kuscia/test/..."
TEST_LOG_LEVEL = debug

GCC_VERSION := $(shell docker exec -it $(CONTAINER_NAME) /bin/bash -c 'gcc --version | grep gcc | head -n 1 | cut -d" " -f4')

define start_docker
if [ ! -f "./envoy/BUILD" ]; then\
git submodule update --init;\
Expand All @@ -26,7 +34,13 @@ define start_docker
-e GOPROXY='https://goproxy.cn,direct' --cap-add=NET_ADMIN $(BUILD_IMAGE);\
docker exec -it $(CONTAINER_NAME) /bin/bash -c 'git config --global --add safe.directory /home/admin/dev';\
fi;

echo "GCC_VERSION: $(GCC_VERSION)";\
if [[ ($(ARCH) == "aarch64" || $(ARCH) == "arm64") && $(GCC_VERSION) == "9.4.0" ]]; then\
echo "ARCH: $(ARCH) - Install gcc-11 g++-11";\
docker exec $(CONTAINER_NAME) /bin/bash -c 'apt update';\
docker exec $(CONTAINER_NAME) /bin/bash -c 'apt install -y gcc-11 g++-11';\
docker exec $(CONTAINER_NAME) /bin/bash -c 'rm /usr/bin/g++ /usr/bin/gcc && ln -s /usr/bin/g++-11 /usr/bin/g++ && ln -s /usr/bin/gcc-11 /usr/bin/gcc';\
fi;
endef

define stop_docker
Expand All @@ -40,14 +54,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 Down
11 changes: 11 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ local_repository(
path = "envoy",
)

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "bazel_gazelle",
sha256 = "501deb3d5695ab658e82f6f6f549ba681ea3ca2a5fb7911154b5aa45596183fa",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.26.0/bazel-gazelle-v0.26.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.26.0/bazel-gazelle-v0.26.0.tar.gz",
],
)

load("@envoy//bazel:api_binding.bzl", "envoy_api_binding")

envoy_api_binding()
Expand Down
7 changes: 5 additions & 2 deletions 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
FROM openanolis/anolisos:23

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
11 changes: 11 additions & 0 deletions kuscia/api/filters/http/kuscia_poller/v3/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py.

load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package")

licenses(["notice"]) # Apache 2

api_proto_package(
deps = [
"@com_github_cncf_udpa//udpa/annotations:pkg",
],
)
Loading

0 comments on commit f2203cc

Please sign in to comment.