Skip to content

Commit

Permalink
v
Browse files Browse the repository at this point in the history
Signed-off-by: spacewander <[email protected]>
  • Loading branch information
spacewander committed Sep 23, 2024
1 parent 974c944 commit 8f49325
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 15 deletions.
27 changes: 20 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ jobs:
api-module-test:
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
envoy_version:
- 1.29
- 1.31
env:
ENVOY_API_VERSION: ${{ matrix.envoy_version }}
# patch version should not contain API breaking changes, so we just pick the first one
FULL_ENVOY_VERSION: ${{ matrix.envoy_version }}.0
PROXY_IMAGE: envoyproxy/envoy:contrib-v${{ matrix.envoy_version }}.0
defaults:
run:
working-directory: ./api
Expand All @@ -37,22 +48,22 @@ jobs:
- name: Choose the Envoy API
run: |
pushd ..
./patch/switch-envoy-go-version.sh 1.29.5
./patch/switch-envoy-go-version.sh ${FULL_ENVOY_VERSION}
popd
- name: Unit test
run: ENVOY_API_VERSION=1.29 make unit-test
run: make unit-test

- name: Build
run: make build-test-so
- name: Integration test
run: ENVOY_API_VERSION=1.29 PROXY_IMAGE=envoyproxy/envoy:contrib-v1.29.5 make integration-test
run: make integration-test
- name: Upload logs
uses: actions/upload-artifact@v4
if: failure()
with:
# upload artifact can be found in https://github.com/mosn/htnn/actions/runs/$id
name: api-module-test-logs
name: api-module-test-logs-${{ matrix.envoy_version }}
path: ./test-envoy

- name: Generate coverage
Expand All @@ -63,7 +74,7 @@ jobs:
if: always() # always upload coverage, so the coverage percents won't affect by the failed tests
uses: actions/upload-artifact@v4
with:
name: api-module-test-cover
name: api-module-test-cover-${{ matrix.envoy_version }}
path: |
./api/cover.out
./api/cover_integration.out
Expand Down Expand Up @@ -218,8 +229,10 @@ jobs:
with:
fail_ci_if_error: true
files: |
./api-module-test-cover/cover.out,
./api-module-test-cover/cover_integration.out,
./api-module-test-cover-1.29/cover.out,
./api-module-test-cover-1.29/cover_integration.out,
./api-module-test-cover-1.31/cover.out,
./api-module-test-cover-1.31/cover_integration.out,
./types-module-test-cover/cover.out,
./plugins-unit-test-cover/cover.out,
./plugins-integration-test-cover/cover.out,
Expand Down
1 change: 1 addition & 0 deletions api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ build-test-so:
-v $(PWD)/..:/go/src/${PROJECT_NAME} \
-w /go/src/${PROJECT_NAME}/api \
-e GOPROXY \
-e ENVOY_API_VERSION \
${BUILD_IMAGE} \
bash -c "git config --global --add safe.directory '*' && make build-test-so-local"

Expand Down
6 changes: 1 addition & 5 deletions manifests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@ PROXY_BASE_IMAGE ?= istio/proxyv2:$(ISTIO_VERSION)
CONTROLLER_IMAGE ?= htnn/controller:latest
CONTROLLER_BASE_IMAGE ?= docker.io/istio/pilot:$(ISTIO_VERSION)

.PHONY: build-so
build-so:
cd ../plugins/ && ENVOY_API_VERSION=1.29 make build-so

.PHONY: build-proxy-image
build-proxy-image: build-so
build-proxy-image:
cd .. && $(CONTAINER_TOOL) build -t ${PROXY_IMAGE} --build-arg GOPROXY=${GOPROXY} --build-arg PROXY_BASE_IMAGE=${PROXY_BASE_IMAGE} \
-f manifests/images/dp/Dockerfile .

Expand Down
12 changes: 9 additions & 3 deletions manifests/images/dp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@ COPY api/ api/
COPY types/ types/
COPY plugins/ plugins/
COPY controller/ controller/
COPY patch/switch-envoy-go-version.sh patch/switch-envoy-go-version.sh
RUN ./patch/switch-envoy-go-version.sh 1.29.5
# Remember to run `make prebuild` before building the image
COPY external/istio/ external/istio/

COPY patch/switch-envoy-go-version.sh patch/switch-envoy-go-version.sh
COPY common.mk common.mk
# hadolint ignore=DL3003
RUN ./patch/switch-envoy-go-version.sh 1.29.5 && \
cd plugins/ && \
ENVOY_API_VERSION=1.29 make build-so-local

WORKDIR /workspace/external/istio
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -C pilot/cmd/pilot-agent -a -o /workspace/pilot-agent

Expand All @@ -48,5 +54,5 @@ LABEL org.opencontainers.image.description="This is image used in the HTNN data
LABEL org.opencontainers.image.licenses="Apache-2.0"

COPY --from=builder /workspace/pilot-agent /usr/local/bin/
COPY plugins/libgolang.so /etc/libgolang.so
COPY --from=builder /workspace/plugins/libgolang.so /etc/libgolang.so
CMD ["envoy"]
2 changes: 2 additions & 0 deletions plugins/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ build-test-so-local:
build-test-so:
docker run --rm ${MOUNT_GOMOD_CACHE} -v ${PROJECT_ROOT}:/go/src/${PROJECT_NAME} -w /go/src/${PROJECT_NAME}/plugins \
-e GOPROXY \
-e ENVOY_API_VERSION \
${BUILD_IMAGE} \
bash -c "git config --global --add safe.directory '*' && make build-test-so-local"

Expand Down Expand Up @@ -70,6 +71,7 @@ build-so-local:
build-so:
docker run --rm ${MOUNT_GOMOD_CACHE} -v ${PROJECT_ROOT}:/go/src/${PROJECT_NAME} -w /go/src/${PROJECT_NAME}/plugins \
-e GOPROXY \
-e ENVOY_API_VERSION \
${BUILD_IMAGE} \
bash -c "git config --global --add safe.directory '*' && make build-so-local"

Expand Down
1 change: 1 addition & 0 deletions types/registries/nacos/config.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8f49325

Please sign in to comment.