Skip to content

Commit

Permalink
dev: fix broken 'make prebuild'
Browse files Browse the repository at this point in the history
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
  • Loading branch information
spacewander committed Oct 23, 2024
1 parent f1f3d87 commit cabd992
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 18 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build-and-push-dev-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ jobs:
# https://github.com/mosn/htnn/pkgs/container/htnn-proxy
- name: Build and push Docker image
run: |
make prebuild
cd ./manifests
# push image with the dev tag
export PROXY_IMAGE=${{ env.PROXY_IMAGE_NAME }}:dev
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ verify-example:
cd ./examples/dev_your_plugin && ./verify.sh

# use a path outside repo so the linters won't lint the istio files
TARGET_ISTIO_DIR ?= $(shell pwd)/../istio
TARGET_ISTIO_DIR = $(shell pwd)/../istio

.PHONY: prebuild
prebuild:
Expand Down
12 changes: 6 additions & 6 deletions manifests/images/cp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ ARG TARGETARCH
ARG GOPROXY
ENV GOPROXY=$GOPROXY

WORKDIR /workspace
WORKDIR /htnn

# Copy the source

COPY go.* ./
RUN sed -i 's/.\/site/.\/external\/istio/' go.work && sed -i '/.\/e2e/d' go.work && sed -i '/.\/tools/d' go.work
RUN sed -i '/.\/site/d' go.work && sed -i '/.\/e2e/d' go.work && sed -i '/.\/tools/d' go.work
# use single layer to copy only works on files, so we have to list all the directories
COPY api/ api/
COPY types/ types/
Expand All @@ -49,9 +49,9 @@ _EOF

# hadolint ignore=DL3008
RUN apt-get update && apt-get install -y patch --no-install-recommends
RUN TARGET_ISTIO_DIR=$(pwd)/external/istio make prebuild
WORKDIR /workspace/external/istio
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -C pilot/cmd/pilot-discovery -a -o /workspace/pilot-discovery
RUN make prebuild
WORKDIR /istio
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -C pilot/cmd/pilot-discovery -a -o /htnn/pilot-discovery

# hadolint ignore=DL3006
FROM ${CONTROLLER_BASE_IMAGE}
Expand All @@ -62,4 +62,4 @@ LABEL org.opencontainers.image.source=https://github.com/mosn/htnn
LABEL org.opencontainers.image.description="This is image used in the HTNN control plane."
LABEL org.opencontainers.image.licenses="Apache-2.0"

COPY --from=builder /workspace/pilot-discovery /usr/local/bin/
COPY --from=builder /htnn/pilot-discovery /usr/local/bin/
14 changes: 7 additions & 7 deletions manifests/images/dp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ ARG TARGETARCH
ARG GOPROXY
ENV GOPROXY=$GOPROXY

WORKDIR /workspace
WORKDIR /htnn

# Copy the source

COPY go.* ./
RUN sed -i 's/.\/site/.\/external\/istio/' go.work && sed -i '/.\/e2e/d' go.work && sed -i '/.\/tools/d' go.work
RUN sed -i '/.\/site/d' go.work && sed -i '/.\/e2e/d' go.work && sed -i '/.\/tools/d' go.work
COPY api/ api/
COPY types/ types/
COPY plugins/ plugins/
Expand All @@ -48,7 +48,7 @@ _EOF

# hadolint ignore=DL3008
RUN apt-get update && apt-get install -y patch --no-install-recommends
RUN TARGET_ISTIO_DIR=$(pwd)/external/istio make prebuild
RUN make prebuild

COPY patch/switch-envoy-go-version.sh patch/switch-envoy-go-version.sh
COPY common.mk common.mk
Expand All @@ -57,8 +57,8 @@ 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
WORKDIR /istio
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -C pilot/cmd/pilot-agent -a -o /htnn/pilot-agent

# hadolint ignore=DL3006
FROM ${PROXY_BASE_IMAGE}
Expand All @@ -69,6 +69,6 @@ LABEL org.opencontainers.image.source=https://github.com/mosn/htnn
LABEL org.opencontainers.image.description="This is image used in the HTNN data plane."
LABEL org.opencontainers.image.licenses="Apache-2.0"

COPY --from=builder /workspace/pilot-agent /usr/local/bin/
COPY --from=builder /workspace/plugins/libgolang.so /etc/libgolang.so
COPY --from=builder /htnn/pilot-agent /usr/local/bin/
COPY --from=builder /htnn/plugins/libgolang.so /etc/libgolang.so
CMD ["envoy"]
6 changes: 3 additions & 3 deletions patch/istio/1.21/20240410-htnn-go-mod.patch
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ index e7f308e890..def9507093 100644
+)
+
+replace (
+ mosn.io/htnn/api => ../../api
+ mosn.io/htnn/controller => ../../controller
+ mosn.io/htnn/types => ../../types
+ mosn.io/htnn/api => ../htnn/api
+ mosn.io/htnn/controller => ../htnn/controller
+ mosn.io/htnn/types => ../htnn/types
+)
+
+// Downgrade some deps to match the one used in istio
Expand Down

0 comments on commit cabd992

Please sign in to comment.