Skip to content

Commit

Permalink
build: move istio out of repo (#772)
Browse files Browse the repository at this point in the history
Signed-off-by: spacewander <[email protected]>
  • Loading branch information
spacewander authored Oct 23, 2024
1 parent 4e25755 commit f1f3d87
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 30 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,6 @@ jobs:
run: |
make delete-cluster create-cluster
- name: Prepare code
run: |
pushd ..
make prebuild
popd
- name: Prepare controller
run: |
make e2e-prepare-controller-image
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ controller/**/log
!controller/pkg/registry/log
controller/tests/testdata/crd/
go.work.sum
external/*
e2e/log
.idea
# helm charts
Expand Down
1 change: 0 additions & 1 deletion .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ header:
- 'site/layouts/**'
- 'api/internal/cookie/cookie.go'
- 'controller/registries/nacos/config.go'
- 'external/**'
comment: on-failure

dependency:
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ fmt-proto: dev-tools

.PHONY: fmt-proto-local
fmt-proto-local:
find . -name '*.proto' | grep -v './external' | xargs clang-format -i
find . -name '*.proto' | xargs clang-format -i


LICENSE_CHECKER_VERSION = 0.6.0
Expand All @@ -144,7 +144,7 @@ lint-spell: dev-tools
${DEV_TOOLS_IMAGE} \
make lint-spell-local

CODESPELL = codespell --skip '.ignore_words,test-envoy,go.mod,go.sum,*.svg,*.patch,./site/public/**,external,.git,.idea,go.work.sum' --check-filenames --check-hidden --ignore-words ./.ignore_words .
CODESPELL = codespell --skip '.ignore_words,test-envoy,go.mod,go.sum,*.svg,*.patch,./site/public/**,.git,.idea,go.work.sum' --check-filenames --check-hidden --ignore-words ./.ignore_words .
.PHONY: lint-spell-local
lint-spell-local:
$(CODESPELL)
Expand Down Expand Up @@ -187,8 +187,7 @@ lint-website: $(LOCALBIN)
.PHONY: lint-markdown
lint-markdown:
if ! command -v markdownlint >/dev/null 2>&1; then npm install -g markdownlint-cli; fi
@# ignore markdown under 'external/istio'
markdownlint '{*.md,site/**/*.md}' --disable MD012 MD013 MD024 MD029 MD033 MD034 MD036 MD041
markdownlint '**/*.md' --disable MD012 MD013 MD024 MD029 MD033 MD034 MD036 MD041

# We don’t use if ! command -v yamllint because some environments might have a pre-installed Python version.
# Checking the specific path ensures we're using the Node.js version to avoid conflicts.
Expand All @@ -215,7 +214,8 @@ fmt: fmt-go fmt-proto fix-spell fix-cjk
verify-example:
cd ./examples/dev_your_plugin && ./verify.sh

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

.PHONY: prebuild
prebuild:
Expand Down
1 change: 0 additions & 1 deletion external/.gitkeep

This file was deleted.

18 changes: 16 additions & 2 deletions manifests/images/cp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,22 @@ COPY api/ api/
COPY types/ types/
COPY plugins/ plugins/
COPY controller/ controller/
# Remember to run `make prebuild` before building the image
COPY external/istio/ external/istio/
# Copy files used by `make prebuild`
COPY Makefile common.mk ./
COPY patch/ patch/
# Download istio to external/istio
# Note that if we switch to non-debian base image these commands will break...
RUN cat <<_EOF > /etc/apt/sources.list.d/debian.sources
Types: deb
URIs: https://mirrors.tuna.tsinghua.edu.cn/debian
Suites: bookworm bookworm-updates bookworm-backports
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
_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

Expand Down
18 changes: 16 additions & 2 deletions manifests/images/dp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,22 @@ COPY api/ api/
COPY types/ types/
COPY plugins/ plugins/
COPY controller/ controller/
# Remember to run `make prebuild` before building the image
COPY external/istio/ external/istio/
# Copy files used by `make prebuild`
COPY Makefile common.mk ./
COPY patch/ patch/
# Download istio to external/istio
# Note that if we switch to non-debian base image these commands will break...
RUN cat <<_EOF > /etc/apt/sources.list.d/debian.sources
Types: deb
URIs: https://mirrors.tuna.tsinghua.edu.cn/debian
Suites: bookworm bookworm-updates bookworm-backports
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
_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

COPY patch/switch-envoy-go-version.sh patch/switch-envoy-go-version.sh
COPY common.mk common.mk
Expand Down
13 changes: 1 addition & 12 deletions patch/apply-patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,6 @@ done

pushd "$TARGET_ISTIO_DIR"
go mod tidy
go install golang.org/x/tools/cmd/goimports@latest # required by codegen
if [ "$(uname -s)" = "Darwin" ]; then
sed -i '' -e 's/.\/site/.\/external\/istio/' ../../go.work
else
sed -i -e 's/.\/site/.\/external\/istio/' ../../go.work
fi
# go run will fail without adding `./external/istio` to go.work
go install golang.org/x/tools/cmd/[email protected] # required by codegen. Version higher than 0.24.0 doesn't support Go 1.21.
go run pkg/config/schema/codegen/tools/collections.main.go
if [ "$(uname -s)" = "Darwin" ]; then
sed -i '' -e 's/.\/external\/istio/.\/site/' ../../go.work
else
sed -i -e 's/.\/external\/istio/.\/site/' ../../go.work
fi
popd

0 comments on commit f1f3d87

Please sign in to comment.