Skip to content

Commit eaf913d

Browse files
committed
ci: parallelize e2e job to speed it up
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
1 parent 29e8364 commit eaf913d

1 file changed

Lines changed: 72 additions & 54 deletions

File tree

.github/workflows/e2e.yaml

Lines changed: 72 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ on:
66
- 'main'
77
- 'release/**'
88
jobs:
9-
kind:
9+
test:
1010
runs-on: ubuntu-latest
1111
permissions:
12-
contents: read # for reading the repository code.
12+
contents: read
1313
steps:
14-
- name: Test suite setup
15-
uses: fluxcd/gha-workflows/.github/actions/setup-kubernetes@v0.11.0
14+
- name: Checkout
15+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
16+
- name: Setup Go
17+
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
1618
with:
1719
go-version: 1.26.x
18-
- name: Enable integration tests
19-
# Only run integration tests for main branch
20-
if: github.ref == 'refs/heads/main'
21-
run: |
22-
echo 'GO_TEST_ARGS=-tags integration' >> $GITHUB_ENV
20+
cache-dependency-path: |
21+
**/go.sum
22+
**/go.mod
2323
- name: Run controller tests
2424
env:
2525
TEST_AZURE_CLIENT_ID: ${{ secrets.TEST_AZURE_CLIENT_ID }}
@@ -31,6 +31,20 @@ jobs:
3131
run: make test
3232
- name: Check if working tree is dirty
3333
run: make verify
34+
kind:
35+
runs-on: ubuntu-latest
36+
permissions:
37+
contents: read # for reading the repository code.
38+
steps:
39+
- name: Test suite setup
40+
uses: fluxcd/gha-workflows/.github/actions/setup-kubernetes@v0.11.0
41+
with:
42+
go-version: 1.26.x
43+
- name: Enable integration tests
44+
# Only run integration tests for main branch
45+
if: github.ref == 'refs/heads/main'
46+
run: |
47+
echo 'GO_TEST_ARGS=-tags integration' >> $GITHUB_ENV
3448
- name: Build container image
3549
run: |
3650
make docker-build IMG=test/kustomize-controller:latest \
@@ -55,49 +69,53 @@ jobs:
5569
make dev-deploy IMG=test/kustomize-controller:latest
5670
kubectl -n kustomize-system rollout status deploy/source-controller --timeout=1m
5771
kubectl -n kustomize-system rollout status deploy/kustomize-controller --timeout=1m
58-
- name: Run tests for removing kubectl managed fields
59-
run: |
60-
kubectl create ns managed-fields
61-
kustomize build github.com/stefanprodan/podinfo//kustomize?ref=6.3.5 > /tmp/podinfo.yaml
62-
kubectl -n managed-fields apply -f /tmp/podinfo.yaml
63-
kubectl -n managed-fields apply -f ./config/testdata/managed-fields
64-
kubectl -n managed-fields wait kustomization/podinfo --for=condition=ready --timeout=4m
65-
OUTDATA=$(kubectl -n managed-fields get deploy podinfo --show-managed-fields -oyaml)
66-
if echo "$OUTDATA" | grep -q "kubectl";then
67-
echo "kubectl client-side manager not removed"
68-
exit 1
69-
fi
70-
kubectl -n managed-fields apply --server-side --force-conflicts -f /tmp/podinfo.yaml
71-
kubectl -n managed-fields annotate --overwrite kustomization/podinfo reconcile.fluxcd.io/requestedAt="$(date +%s)"
72-
kubectl -n managed-fields wait kustomization/podinfo --for=condition=ready --timeout=4m
73-
OUTDATA=$(kubectl -n managed-fields get deploy podinfo --show-managed-fields -oyaml)
74-
if echo "$OUTDATA" | grep -q "kubectl";then
75-
echo "kubectl server-side manager not removed"
76-
exit 1
77-
fi
78-
kubectl delete ns managed-fields
79-
- name: Run overlays tests
80-
run: |
81-
kubectl -n kustomize-system apply -k ./config/testdata/overlays
82-
kubectl -n kustomize-system wait kustomizations/webapp-staging --for=condition=ready --timeout=4m
83-
kubectl -n kustomize-system wait kustomizations/webapp-production --for=condition=ready --timeout=4m
84-
- name: Run dependencies tests
85-
run: |
86-
kubectl -n kustomize-system apply -k ./config/testdata/dependencies
87-
kubectl -n kustomize-system wait kustomizations/common --for=condition=ready --timeout=4m
88-
kubectl -n kustomize-system wait kustomizations/backend --for=condition=ready --timeout=4m
89-
kubectl -n kustomize-system wait kustomizations/frontend --for=condition=ready --timeout=4m
90-
- name: Run impersonation tests
91-
run: |
92-
kubectl -n impersonation apply -f ./config/testdata/impersonation
93-
kubectl -n impersonation wait kustomizations/podinfo --for=condition=ready --timeout=4m
94-
kubectl -n impersonation delete kustomizations/podinfo
95-
until kubectl -n impersonation get deploy/podinfo 2>&1 | grep NotFound ; do sleep 2; done
96-
- name: Run OCI tests
97-
run: |
98-
kubectl create ns oci
99-
kubectl -n oci apply -f ./config/testdata/oci
100-
kubectl -n oci wait kustomizations/oci --for=condition=ready --timeout=4m
72+
- parallel:
73+
- name: Run managed-fields tests
74+
run: |
75+
set -euo pipefail
76+
kubectl create ns managed-fields
77+
kustomize build github.com/stefanprodan/podinfo//kustomize?ref=6.3.5 > /tmp/podinfo.yaml
78+
kubectl -n managed-fields apply -f /tmp/podinfo.yaml
79+
kubectl -n managed-fields apply -f ./config/testdata/managed-fields
80+
kubectl -n managed-fields wait kustomization/podinfo --for=condition=ready --timeout=4m
81+
OUTDATA=$(kubectl -n managed-fields get deploy podinfo --show-managed-fields -oyaml)
82+
if echo "$OUTDATA" | grep -q "kubectl";then
83+
echo "kubectl client-side manager not removed"
84+
exit 1
85+
fi
86+
kubectl -n managed-fields apply --server-side --force-conflicts -f /tmp/podinfo.yaml
87+
kubectl -n managed-fields annotate --overwrite kustomization/podinfo reconcile.fluxcd.io/requestedAt="$(date +%s)"
88+
kubectl -n managed-fields wait kustomization/podinfo --for=condition=ready --timeout=4m
89+
OUTDATA=$(kubectl -n managed-fields get deploy podinfo --show-managed-fields -oyaml)
90+
if echo "$OUTDATA" | grep -q "kubectl";then
91+
echo "kubectl server-side manager not removed"
92+
exit 1
93+
fi
94+
kubectl delete ns managed-fields
95+
- name: Run overlays and dependencies tests
96+
run: |
97+
set -euo pipefail
98+
echo ">>> Run overlays tests"
99+
kubectl -n kustomize-system apply -k ./config/testdata/overlays
100+
kubectl -n kustomize-system wait kustomizations/webapp-staging --for=condition=ready --timeout=4m
101+
kubectl -n kustomize-system wait kustomizations/webapp-production --for=condition=ready --timeout=4m
102+
echo ">>> Run dependencies tests"
103+
kubectl -n kustomize-system apply -k ./config/testdata/dependencies
104+
kubectl -n kustomize-system wait kustomizations/common --for=condition=ready --timeout=4m
105+
kubectl -n kustomize-system wait kustomizations/backend --for=condition=ready --timeout=4m
106+
kubectl -n kustomize-system wait kustomizations/frontend --for=condition=ready --timeout=4m
107+
- name: Run impersonation and OCI tests
108+
run: |
109+
set -euo pipefail
110+
echo ">>> Run impersonation tests"
111+
kubectl -n impersonation apply -f ./config/testdata/impersonation
112+
kubectl -n impersonation wait kustomizations/podinfo --for=condition=ready --timeout=4m
113+
kubectl -n impersonation delete kustomizations/podinfo
114+
until kubectl -n impersonation get deploy/podinfo 2>&1 | grep NotFound ; do sleep 2; done
115+
echo ">>> Run OCI tests"
116+
kubectl create ns oci
117+
kubectl -n oci apply -f ./config/testdata/oci
118+
kubectl -n oci wait kustomizations/oci --for=condition=ready --timeout=4m
101119
- name: Logs
102120
if: always()
103121
continue-on-error: true
@@ -110,8 +128,8 @@ jobs:
110128
kubectl -n kustomize-system get gitrepositories -oyaml
111129
kubectl -n kustomize-system get kustomizations -oyaml
112130
kubectl -n kustomize-system get all
113-
kubectl -n oci get ocirepository/oci -oyaml
114-
kubectl -n oci get kustomization/oci -oyaml
131+
kubectl -n oci get ocirepository/oci -oyaml || true
132+
kubectl -n oci get kustomization/oci -oyaml || true
115133
sops-openbao:
116134
runs-on: ubuntu-latest
117135
permissions:

0 commit comments

Comments
 (0)