Skip to content

Commit e51e5e6

Browse files
authored
fix: Reduce CI running costs (#28)
* fix: Reduce CI running costs
1 parent 62f4940 commit e51e5e6

9 files changed

+14
-119
lines changed

.github/dependabot.yml

-51
This file was deleted.

.github/workflows/dependency-review.yml

-36
This file was deleted.

.github/workflows/e2e-test-ci-v2-cron-dev.yml

+1-8
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ on:
2424
- cron: '0 0 * * *'
2525
push:
2626
branches:
27-
- master
2827
- 1.8.0
2928

3029
concurrency:
@@ -33,7 +32,7 @@ concurrency:
3332

3433
jobs:
3534
changes:
36-
if: ${{ (!github.event.pull_request.draft && github.event.schedule == '0 0 * * *') }}
35+
if: ${{ (!github.event.pull_request.draft && github.event.schedule == '0 0 * * *') && contains(github.event.pull_request.labels.*.name, 'ci-e2e-test') }}
3736
runs-on: ubuntu-20.04
3837
outputs:
3938
docs: ${{ steps.filter.outputs.docs }}
@@ -83,12 +82,6 @@ jobs:
8382
- name: Set up QEMU
8483
uses: docker/setup-qemu-action@v3
8584

86-
- name: Set up Docker Buildx
87-
id: buildx
88-
uses: docker/setup-buildx-action@v3
89-
with:
90-
version: latest
91-
9285
- name: Prepare Host
9386
run: |
9487
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64

.github/workflows/e2e-test-ci-v2-cron.yml

-7
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ on:
2323
- cron: '0 0 * * *'
2424
pull_request:
2525
branches:
26-
- master
2726
- 1.8.0
2827

2928
concurrency:
@@ -82,12 +81,6 @@ jobs:
8281
- name: Set up QEMU
8382
uses: docker/setup-qemu-action@v3
8483

85-
- name: Set up Docker Buildx
86-
id: buildx
87-
uses: docker/setup-buildx-action@v3
88-
with:
89-
version: latest
90-
9184
- name: Prepare Host
9285
run: |
9386
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64

.github/workflows/e2e-test-ci.yml

+6-12
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ concurrency:
1515

1616
jobs:
1717
changes:
18-
if: '! github.event.pull_request.draft'
18+
if: |
19+
contains(github.event.pull_request.labels.*.name, 'ci-e2e-test')
1920
runs-on: ubuntu-20.04
2021
outputs:
2122
docs: ${{ steps.filter.outputs.docs }}
@@ -47,7 +48,7 @@ jobs:
4748
- ".github/**"
4849
build:
4950
name: Build
50-
runs-on: ubuntu-20.04
51+
runs-on: buildjet-2vcpu-ubuntu-2204
5152
needs: changes
5253
if: needs.changes.outputs.go == 'true'
5354
steps:
@@ -64,12 +65,6 @@ jobs:
6465
- name: Set up QEMU
6566
uses: docker/setup-qemu-action@v3
6667

67-
- name: Set up Docker Buildx
68-
id: buildx
69-
uses: docker/setup-buildx-action@v3
70-
with:
71-
version: latest
72-
7368
- name: Login to Private Registry
7469
uses: docker/login-action@v1
7570
with:
@@ -91,6 +86,7 @@ jobs:
9186
REGISTRY: 127.0.0.1:5000
9287
ENABLE_PROXY: "false"
9388
BASE_IMAGE_TAG: "debug"
89+
USE_BUILDKIT: 0
9490
run: |
9591
echo "building images..."
9692
make clean-image build-images
@@ -117,7 +113,7 @@ jobs:
117113
prepare:
118114
needs: changes
119115
if: needs.changes.outputs.go == 'true'
120-
runs-on: ubuntu-20.04
116+
runs-on: buildjet-2vcpu-ubuntu-2204
121117
steps:
122118
- uses: actions/checkout@v4
123119
with:
@@ -140,13 +136,12 @@ jobs:
140136
- changes
141137
- prepare
142138
- build
143-
runs-on: ubuntu-20.04
139+
runs-on: buildjet-2vcpu-ubuntu-2204
144140
strategy:
145141
fail-fast: false # If false, GitHub will not cancels all in-progress jobs in the matrix if any matrix job fails.
146142
matrix:
147143
suite: ${{ fromJson(needs.prepare.outputs.matrix) }}
148144
ingress-class-values: [ "apisix", "apisix-and-all" ]
149-
enabled-etcdserver: [ true, false ]
150145
steps:
151146
- name: Checkout
152147
uses: actions/checkout@v4
@@ -195,7 +190,6 @@ jobs:
195190
E2E_FOCUS: "${{ matrix.suite }}"
196191
ENABLE_PROXY: "false"
197192
INGRESS_CLASS: "${{ matrix.ingress-class-values }}"
198-
ENABLED_ETCD_SERVER: "${{ matrix.enabled-etcdserver }}"
199193
E2E_SKIP_BUILD: "1"
200194
E2E_FLAKE_ATTEMPTS: "2"
201195
E2E_ENV: "ci"

.github/workflows/unit-test-ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ on:
2828
- 1.8.0
2929
jobs:
3030
changes:
31+
if: |
32+
contains(github.event.pull_request.labels.*.name, 'ci-unit-test')
3133
runs-on: ubuntu-latest
3234
outputs:
3335
docs: ${{ steps.filter.outputs.docs }}

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ RUN if [ "$ENABLE_PROXY" = "true" ] ; then go env -w GOPROXY=https://goproxy.cn,
2626
&& go mod download
2727

2828
COPY . .
29-
RUN --mount=type=cache,target=/root/.cache/go-build make build
29+
RUN make build
3030

3131
FROM gcr.io/distroless/static-debian12:${BASE_IMAGE_TAG}
3232
LABEL maintainer="[email protected]"

Makefile

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ VERSION ?= 1.8.0
2121

2222
TARGET_APISIX_VERSION ?= "3.4.1-centos"
2323
APISIX_ADMIN_API_VERSION ?= "v3"
24-
24+
USE_BUILDKIT ?= 1
2525
ifeq ($(APISIX_ADMIN_API_VERSION),"v2")
2626
TARGET_APISIX_VERSION ?= "2.15.3-centos"
2727
endif
@@ -75,11 +75,12 @@ clean-image: ## Removes local image
7575
### build-image: Build api7-ingress-controller image
7676
.PHONY: build-image
7777
build-image:
78-
ifeq ($(E2E_SKIP_BUILD), 0)
79-
DOCKER_BUILDKIT=1 docker build -t api7/api7-ingress-controller:$(IMAGE_TAG) --build-arg ENABLE_PROXY=$(ENABLE_PROXY) --build-arg BASE_IMAGE_TAG=$(BASE_IMAGE_TAG) .
78+
ifeq ($(E2E_SKIP_BUILD), 0)
79+
DOCKER_BUILDKIT=$(USE_BUILDKIT) docker build -t api7/api7-ingress-controller:$(IMAGE_TAG) --build-arg ENABLE_PROXY=$(ENABLE_PROXY) --build-arg BASE_IMAGE_TAG=$(BASE_IMAGE_TAG) .
8080
docker tag api7/api7-ingress-controller:$(IMAGE_TAG) $(REGISTRY)/api7-ingress-controller:$(IMAGE_TAG)
8181
endif
8282

83+
8384
### pack-image: Build and push Ingress image used in e2e test suites to kind or custom registry.
8485
.PHONY: pack-image
8586
pack-image: build-image

test/e2e/suite-features/healthcheck.go

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ var _ = ginkgo.Describe("suite-features: health check", func() {
3030
s := scaffoldFunc()
3131
ginkgo.It("active check", func() {
3232
backendSvc, backendPorts := s.DefaultHTTPBackend()
33-
3433
au := fmt.Sprintf(`
3534
apiVersion: apisix.apache.org/v2
3635
kind: ApisixUpstream

0 commit comments

Comments
 (0)