Skip to content

Commit b854817

Browse files
committed
[FLINK-36460] Pull out a shared workflow definition shared by multiple test matrices
1 parent bd374ce commit b854817

File tree

2 files changed

+162
-160
lines changed

2 files changed

+162
-160
lines changed

.github/workflows/ci.yml

Lines changed: 71 additions & 160 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ concurrency:
3434
jobs:
3535
test_ci:
3636
runs-on: ubuntu-latest
37-
name: test_ci
37+
name: maven build
3838
strategy:
3939
matrix:
4040
java-version: [ 11, 17, 21 ]
@@ -72,191 +72,102 @@ jobs:
7272
mvn -B verify -Dit.skip=false
7373
cd ..
7474
e2e_smoke_test:
75-
name: Operator smoke test
76-
runs-on: ubuntu-latest
75+
name: Smoke test
7776
strategy:
7877
matrix:
7978
http-client: [ "okhttp", "jdk", "jetty", "vertx" ]
80-
version: ["v1_20"]
81-
mode: ["native"]
82-
namespace: ["default", "flink"]
83-
java-version: ["11", "17", "21"]
79+
java-version: [ "11", "17", "21" ]
80+
uses: ./.github/workflows/e2e.yaml
81+
with:
82+
java-version: ${{ matrix.java-version }}
83+
flink-version: "v1_20"
84+
http-client: ${{ matrix.http-client }}
85+
test: test_application_operations.sh
86+
e2e_namespace_tests:
87+
name: Alternative namespace tests
88+
needs: e2e_smoke_test
89+
strategy:
90+
matrix:
91+
flink-version:
92+
- "v1_20"
93+
- "v1_18"
94+
- "v1_19"
95+
- "v1_17"
96+
- "v1_16"
97+
mode:
98+
- "native"
99+
- "standalone"
84100
test:
85101
- test_application_operations.sh
86-
steps:
87-
- uses: actions/checkout@v4
88-
- name: Set up JDK ${{ matrix.java-version }}
89-
uses: actions/setup-java@v4
90-
with:
91-
java-version: ${{ matrix.java-version }}
92-
distribution: 'temurin'
93-
cache: 'maven'
94-
- name: Start minikube
95-
run: |
96-
source e2e-tests/utils.sh
97-
start_minikube
98-
- name: Install cert-manager
99-
run: |
100-
kubectl get pods -A
101-
kubectl apply -f e2e-tests/cert-manager.yaml
102-
kubectl -n cert-manager wait --all=true --for=condition=Available --timeout=300s deploy
103-
- name: Build image
104-
run: |
105-
export SHELL=/bin/bash
106-
export DOCKER_BUILDKIT=1
107-
eval $(minikube -p minikube docker-env)
108-
JAVA_VERSION=${{matrix.java-version}}
109-
HTTP_CLIENT=${{ matrix.http-client }}
110-
docker build --progress=plain --no-cache -f ./Dockerfile -t flink-kubernetes-operator:ci-latest --progress plain --build-arg JAVA_VERSION="${JAVA_VERSION:-11}" --build-arg HTTP_CLIENT="${HTTP_CLIENT:-okhttp}" .
111-
docker images
112-
- name: Start the operator
113-
run: |
114-
source e2e-tests/utils.sh
115-
create_namespace flink
116-
helm --debug install flink-kubernetes-operator -n ${{ matrix.namespace }} helm/flink-kubernetes-operator --set image.repository=flink-kubernetes-operator --set image.tag=ci-latest --create-namespace --set "watchNamespaces={default,flink}"
117-
kubectl wait --for=condition=Available --timeout=120s -n ${{ matrix.namespace }} deploy/flink-kubernetes-operator
118-
kubectl get pods -n ${{ matrix.namespace }}
119-
- name: Run Flink e2e tests
120-
run: |
121-
sed -i "s/image: flink:.*/image: ${{ matrix.image }}/" e2e-tests/data/*.yaml
122-
sed -i "s/flinkVersion: .*/flinkVersion: ${{ matrix.version }}/" e2e-tests/data/*.yaml
123-
sed -i "s/mode: .*/mode: ${{ matrix.mode }}/" e2e-tests/data/*.yaml
124-
git diff HEAD
125-
echo "Running e2e-tests/$test"
126-
bash e2e-tests/${{ matrix.test }} || exit 1
127-
git reset --hard
128-
- name: Stop the operator
129-
run: |
130-
helm uninstall -n ${{ matrix.namespace }} flink-kubernetes-operator
131-
- name: Stop minikube
132-
run: |
133-
source e2e-tests/utils.sh
134-
stop_minikube
102+
- test_multi_sessionjob.sh
103+
- test_autoscaler.sh
104+
- test_dynamic_config.sh
105+
exclude:
106+
- mode: standalone
107+
test: test_autoscaler.sh
108+
- mode: standalone
109+
test: test_dynamic_config.sh
110+
- flink-version: v1_16
111+
test: test_autoscaler.sh
112+
- flink-version: v1_16
113+
test: test_dynamic_config.sh
114+
115+
uses: ./.github/workflows/e2e.yaml
116+
with:
117+
java-version: 11
118+
flink-version: ${{ matrix.flink-version }}
119+
test: ${{ matrix.test }}
120+
namespace: "flink"
121+
create-namespace: true
122+
mode: ${{ matrix.mode }}
135123
e2e_ci:
136124
needs: e2e_smoke_test
137-
runs-on: ubuntu-latest
138125
strategy:
139126
matrix:
140-
version: ["v1_20","v1_19","v1_18","v1_17","v1_16"]
141-
namespace: ["default","flink"]
142-
mode: ["native", "standalone"]
143-
java-version: [ 11 ]
127+
flink-version:
128+
- "v1_20"
129+
- "v1_18"
130+
- "v1_19"
131+
- "v1_17"
132+
- "v1_16"
133+
mode:
134+
- "native"
135+
- "standalone"
144136
test:
145137
- test_application_kubernetes_ha.sh
138+
- test_application_operations.sh
146139
- test_dynamic_config.sh
147140
- test_sessionjob_kubernetes_ha.sh
148141
- test_sessionjob_operations.sh
149-
- test_multi_sessionjob.sh
150142
- test_autoscaler.sh
151143
- test_flink_operator_ha.sh
152144
- test_snapshot.sh
153-
include:
154-
- namespace: flink
155-
extraArgs: '--create-namespace --set "watchNamespaces={default,flink}"'
156-
- version: v1_20
157-
image: flink:1.20
158-
- version: v1_19
159-
image: flink:1.19
160-
- version: v1_18
161-
image: flink:1.18
162-
- version: v1_17
163-
image: flink:1.17
164-
- version: v1_16
165-
image: flink:1.16
166145
exclude:
167-
- namespace: default
168-
test: test_multi_sessionjob.sh
169-
- namespace: default
170-
test: test_autoscaler.sh
171-
- namespace: default
172-
test: test_dynamic_config.sh
173-
- mode: standalone
146+
- flink-version: v1_16
174147
test: test_autoscaler.sh
175-
- mode: standalone
148+
- flink-version: v1_16
176149
test: test_dynamic_config.sh
177-
- mode: standalone
178-
test: test_snapshot.sh
179-
- version: v1_16
180-
test: test_autoscaler.sh
181-
- version: v1_16
182-
test: test_dynamic_config.sh
183-
- version: v1_16
150+
- flink-version: v1_16
184151
test: test_flink_operator_ha.sh
185-
- version: v1_16
152+
- flink-version: v1_16
186153
test: test_snapshot.sh
187-
- version: v1_17
154+
- flink-version: v1_17
188155
test: test_dynamic_config.sh
189-
- version: v1_17
156+
- flink-version: v1_17
190157
test: test_flink_operator_ha.sh
191-
- version: v1_17
158+
- flink-version: v1_17
192159
test: test_snapshot.sh
193-
- version: v1_18
160+
- flink-version: v1_18
194161
test: test_dynamic_config.sh
195-
- version: v1_18
162+
- flink-version: v1_18
196163
test: test_flink_operator_ha.sh
197-
- version: v1_18
164+
- flink-version: v1_18
198165
test: test_snapshot.sh
199-
- version: v1_19
166+
- flink-version: v1_19
200167
test: test_snapshot.sh
201-
- version: v1_16
202-
java-version: 17
203-
- version: v1_17
204-
java-version: 17
205-
- version: v1_16
206-
java-version: 21
207-
- version: v1_17
208-
java-version: 21
209-
- version: v1_18
210-
java-version: 21
211-
name: e2e_ci
212-
steps:
213-
- uses: actions/checkout@v4
214-
- name: Set up JDK ${{ matrix.java-version }}
215-
uses: actions/setup-java@v4
216-
with:
217-
java-version: ${{ matrix.java-version }}
218-
distribution: 'temurin'
219-
cache: 'maven'
220-
- name: Start minikube
221-
run: |
222-
source e2e-tests/utils.sh
223-
start_minikube
224-
- name: Install cert-manager
225-
run: |
226-
kubectl get pods -A
227-
kubectl apply -f e2e-tests/cert-manager.yaml
228-
kubectl -n cert-manager wait --all=true --for=condition=Available --timeout=300s deploy
229-
- name: Build image
230-
run: |
231-
export SHELL=/bin/bash
232-
export DOCKER_BUILDKIT=1
233-
eval $(minikube -p minikube docker-env)
234-
JAVA_VERSION=${{ matrix.java-version }}
235-
docker build --progress=plain --no-cache -f ./Dockerfile -t flink-kubernetes-operator:ci-latest --progress plain --build-arg JAVA_VERSION="${JAVA_VERSION:-11}" .
236-
docker images
237-
- name: Start the operator
238-
run: |
239-
if [[ "${{ matrix.test }}" == "test_flink_operator_ha.sh" ]]; then
240-
sed -i "s/# kubernetes.operator.leader-election.enabled: false/kubernetes.operator.leader-election.enabled: true/" helm/flink-kubernetes-operator/conf/flink-conf.yaml
241-
sed -i "s/# kubernetes.operator.leader-election.lease-name: flink-operator-lease/kubernetes.operator.leader-election.lease-name: flink-operator-lease/" helm/flink-kubernetes-operator/conf/flink-conf.yaml
242-
sed -i "s/replicas: 1/replicas: 2/" helm/flink-kubernetes-operator/values.yaml
243-
fi
244-
helm --debug install flink-kubernetes-operator -n ${{ matrix.namespace }} helm/flink-kubernetes-operator --set image.repository=flink-kubernetes-operator --set image.tag=ci-latest ${{ matrix.extraArgs }}
245-
kubectl wait --for=condition=Available --timeout=120s -n ${{ matrix.namespace }} deploy/flink-kubernetes-operator
246-
kubectl get pods -n ${{ matrix.namespace }}
247-
- name: Run Flink e2e tests
248-
run: |
249-
sed -i "s/image: flink:.*/image: ${{ matrix.image }}/" e2e-tests/data/*.yaml
250-
sed -i "s/flinkVersion: .*/flinkVersion: ${{ matrix.version }}/" e2e-tests/data/*.yaml
251-
sed -i "s/mode: .*/mode: ${{ matrix.mode }}/" e2e-tests/data/*.yaml
252-
git diff HEAD
253-
echo "Running e2e-tests/$test"
254-
bash e2e-tests/${{ matrix.test }} || exit 1
255-
git reset --hard
256-
- name: Stop the operator
257-
run: |
258-
helm uninstall -n ${{ matrix.namespace }} flink-kubernetes-operator
259-
- name: Stop minikube
260-
run: |
261-
source e2e-tests/utils.sh
262-
stop_minikube
168+
uses: ./.github/workflows/e2e.yaml
169+
with:
170+
java-version: 11
171+
flink-version: ${{ matrix.flink-version }}
172+
test: ${{ matrix.test }}
173+
mode: ${{ matrix.mode }}

.github/workflows/e2e.yaml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: E2E test workflow
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
java-version:
7+
required: true
8+
type: string
9+
flink-version:
10+
required: true
11+
type: string
12+
http-client:
13+
required: false
14+
type: string
15+
default: "okhttp"
16+
namespace:
17+
required: false
18+
type: string
19+
default: "default"
20+
mode:
21+
required: false
22+
type: string
23+
default: "native"
24+
test:
25+
required: true
26+
type: string
27+
create-namespace:
28+
type: boolean
29+
default: false
30+
31+
jobs:
32+
e2e_test:
33+
name: ${{ inputs.test }}
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v4
37+
- name: Set up JDK ${{ inputs.java-version }}
38+
uses: actions/setup-java@v4
39+
with:
40+
java-version: ${{ inputs.java-version }}
41+
distribution: 'temurin'
42+
cache: 'maven'
43+
- name: Start minikube
44+
run: |
45+
source e2e-tests/utils.sh
46+
start_minikube
47+
- name: Install cert-manager
48+
run: |
49+
kubectl get pods -A
50+
kubectl apply -f e2e-tests/cert-manager.yaml
51+
kubectl -n cert-manager wait --all=true --for=condition=Available --timeout=300s deploy
52+
- name: Build image
53+
run: |
54+
export SHELL=/bin/bash
55+
export DOCKER_BUILDKIT=1
56+
eval $(minikube -p minikube docker-env)
57+
JAVA_VERSION=${{ inputs.java-version }}
58+
HTTP_CLIENT=${{ inputs.http-client }}
59+
docker build --progress=plain --no-cache -f ./Dockerfile -t flink-kubernetes-operator:ci-latest --progress plain --build-arg JAVA_VERSION="${JAVA_VERSION:-11}" --build-arg HTTP_CLIENT="${HTTP_CLIENT:-okhttp}" .
60+
docker images
61+
- name: Create ${{ inputs.namespace }} == ${{ inputs.create-namespace }}
62+
id: namespace-creator
63+
if: ${{ inputs.create-namespace }}
64+
run: |
65+
source e2e-tests/utils.sh
66+
create_namespace ${{ inputs.namespace }}
67+
echo EXTRA_HELM_INSTALL_ARGS="--set "watchNamespaces={default,flink}"" >> $GITHUB_OUTPUT
68+
- name: Start the operator
69+
run: |
70+
helm --debug install flink-kubernetes-operator -n ${{ inputs.namespace }} helm/flink-kubernetes-operator --set image.repository=flink-kubernetes-operator --set image.tag=ci-latest ${{ steps.namespace-creator.outputs.EXTRA_HELM_INSTALL_ARGS }}
71+
kubectl wait --for=condition=Available --timeout=120s -n ${{ inputs.namespace }} deploy/flink-kubernetes-operator
72+
kubectl get pods -n ${{ inputs.namespace }}
73+
- name: Run Flink e2e tests
74+
run: |
75+
FLINK_IMAGE=$(sed --regexp-extended 's/v([0-9]+)_([0-9]+)/flink:\1.\2/g' <<< ${{ inputs.flink-version }} )
76+
echo FLINK_IMAGE=${FLINK_IMAGE}
77+
sed -i "s/image: flink:.*/image: ${FLINK_IMAGE}/" e2e-tests/data/*.yaml
78+
sed -i "s/flinkVersion: .*/flinkVersion: ${{ inputs.flink-version }}/" e2e-tests/data/*.yaml
79+
sed -i "s/mode: .*/mode: ${{ inputs.mode }}/" e2e-tests/data/*.yaml
80+
git diff HEAD
81+
echo "Running e2e-tests/$test"
82+
bash e2e-tests/${{ inputs.test }} || exit 1
83+
git reset --hard
84+
- name: Stop the operator
85+
run: |
86+
helm uninstall -n ${{ inputs.namespace }} flink-kubernetes-operator
87+
- name: Stop minikube
88+
run: |
89+
source e2e-tests/utils.sh
90+
stop_minikube
91+

0 commit comments

Comments
 (0)