Skip to content

Commit

Permalink
sync (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
yushiqie authored Apr 30, 2024
1 parent 6005464 commit c999ea2
Show file tree
Hide file tree
Showing 11 changed files with 334 additions and 302 deletions.
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.4.1
6.0.0
28 changes: 13 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ version: 2.1
executors:
linux_x64_executor: # declares a reusable executor
docker:
- image: envoyproxy/envoy-build-ubuntu:81a93046060dbe5620d5b3aa92632090a9ee4da6
- image: envoyproxy/envoy-build-ubuntu:7304f974de2724617b7492ccb4c9c58cd420353a
resource_class: 2xlarge
shell: /bin/bash --login -eo pipefail
linux_aarch64_executor:
docker:
- image: envoyproxy/envoy-build-ubuntu:81a93046060dbe5620d5b3aa92632090a9ee4da6
- image: envoyproxy/envoy-build-ubuntu:7304f974de2724617b7492ccb4c9c58cd420353a
resource_class: arm.2xlarge
shell: /bin/bash --login -eo pipefail

Expand Down Expand Up @@ -54,26 +54,24 @@ jobs:
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/amd64 --build-arg ARCH=amd64 -f ./build_image/dockerfile/kuscia-envoy-anolis.Dockerfile . --push
docker buildx build -t ${IMG_LATEST} --platform linux/arm64 --build-arg ARCH=arm64 -f ./build_image/dockerfile/kuscia-envoy-anolis.Dockerfile . --push
docker buildx build -t ${IMG_TAG} --platform linux/amd64 --build-arg ARCH=amd64 -f ./build_image/dockerfile/kuscia-envoy-anolis.Dockerfile . --push
docker buildx build -t ${IMG_TAG} --platform linux/arm64 --build-arg ARCH=arm64 -f ./build_image/dockerfile/kuscia-envoy-anolis.Dockerfile . --push
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 --build-arg ARCH=amd64 -f ./build_image/dockerfile/kuscia-envoy-anolis.Dockerfile . --push
docker buildx build -t ${ALIYUN_IMG_LATEST} --platform linux/arm64 --build-arg ARCH=arm64 -f ./build_image/dockerfile/kuscia-envoy-anolis.Dockerfile . --push
docker buildx build -t ${ALIYUN_IMG_TAG} --platform linux/amd64 --build-arg ARCH=amd64 -f ./build_image/dockerfile/kuscia-envoy-anolis.Dockerfile . --push
docker buildx build -t ${ALIYUN_IMG_TAG} --platform linux/arm64 --build-arg ARCH=arm64 -f ./build_image/dockerfile/kuscia-envoy-anolis.Dockerfile . --push
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
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "envoy"]
path = envoy
url = https://github.com/envoyproxy/envoy.git
branch = release/v1.20
branch = release/v1.25
19 changes: 13 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 @@ -14,7 +14,7 @@ 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"
CONTAINER_NAME ?= "build-envoy-$(shell echo ${USER})"
COMPILE_MODE ?=opt
TARGET ?= "//:envoy"
BUILD_OPTS ?="--strip=always"
Expand All @@ -23,16 +23,24 @@ 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;\
fi;
if [[ ! -n $$(docker ps -q -f "name=^$(CONTAINER_NAME)$$") ]]; then\
docker run -itd --rm -v $(shell pwd):/home/admin/dev -v $(shell pwd)/cache:/root/.cache/bazel -w /home/admin/dev --name $(CONTAINER_NAME) \
docker run -itd --rm -v $(shell pwd)/cache:/root/.cache/bazel -v $(shell pwd):/home/admin/dev -w /home/admin/dev --name $(CONTAINER_NAME) \
-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 'sudo apt update';\
docker exec $(CONTAINER_NAME) /bin/bash -c 'sudo apt install -y gcc-11 g++-11';\
docker exec $(CONTAINER_NAME) /bin/bash -c 'sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 60 --slave /usr/bin/g++ g++ /usr/bin/g++-11';\
fi;
endef

define stop_docker
Expand Down Expand Up @@ -72,7 +80,6 @@ clean:
$(call stop_docker)
rm -rf output


.PHONY: image
image: build-envoy
docker build -t ${IMG} --build-arg ARCH=${ARCH} -f ./build_image/dockerfile/kuscia-envoy-anolis.Dockerfile .
docker build -t ${IMG} -f ./build_image/dockerfile/kuscia-envoy-anolis.Dockerfile .
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
6 changes: 3 additions & 3 deletions build_image/dockerfile/kuscia-envoy-anolis.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM openanolis/anolisos:8.8
FROM openanolis/anolisos:23

ARG ARCH
ARG TARGETPLATFORM

ENV TZ=Asia/Shanghai

ARG ROOT_DIR="/home/kuscia"

COPY ./output/linux/$ARCH $ROOT_DIR/
COPY ./output/$TARGETPLATFORM $ROOT_DIR/

WORKDIR ${ROOT_DIR}

Expand Down
2 changes: 1 addition & 1 deletion envoy
Submodule envoy updated 237 files
7 changes: 2 additions & 5 deletions kuscia/source/filters/http/kuscia_common/kuscia_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.


#pragma once

#include "envoy/http/header_map.h"
Expand All @@ -34,9 +33,7 @@ const Http::LowerCaseString HeaderKeyKusciaToken("Kuscia-Token");
const Http::LowerCaseString HeaderKeyKusciaHost("Kuscia-Host");
const Http::LowerCaseString HeaderKeyOriginSource("Kuscia-Origin-Source");


const Http::LowerCaseString HeaderKeyErrorMessage("Kuscia-Error-Message");
const Http::LowerCaseString HeaderKeyFmtError("Kuscia-Error-Formatted");
const Http::LowerCaseString HeaderKeyErrorMessageInternal("Kuscia-Error-Message-Internal");
const Http::LowerCaseString HeaderKeyRecordBody("Kuscia-Record-Body");

Expand All @@ -46,8 +43,8 @@ const Http::LowerCaseString HeaderKeyEncryptIv("Kuscia-Encrypt-Iv");
const Http::LowerCaseString HeaderKeyForwardRequestId("Kuscia-Foward-Request-Id");

class KusciaHeader {
public:
static absl::optional<absl::string_view> getSource(const Http::RequestHeaderMap& headers);
public:
static absl::optional<absl::string_view> getSource(const Http::RequestHeaderMap& headers);
};

// receiver.${peer}.svc/poll?timeout=xxx&service=xxx
Expand Down
2 changes: 1 addition & 1 deletion kuscia/source/filters/http/kuscia_gress/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ envoy_cc_library(
"@envoy//source/extensions/filters/http/common:pass_through_filter_lib",
"@envoy//source/common/http:codes_lib",
"@com_github_nlohmann_json//:json",
"@envoy//source/common/api:os_sys_calls_lib",
"@envoy//source/common/api:os_sys_calls_lib"
],
)

Expand Down
Loading

0 comments on commit c999ea2

Please sign in to comment.