Skip to content

Commit b2c0462

Browse files
committed
Update CI config
1 parent ac1d946 commit b2c0462

File tree

3 files changed

+78
-21
lines changed

3 files changed

+78
-21
lines changed

.github/workflows/e2e-tests.yaml

Lines changed: 77 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ env:
1717
HTTPS_ENABLE: true
1818
NETBOX_RESTORATION_HASH_FIELD_NAME: netboxOperatorRestorationHash
1919
jobs:
20-
e2e-tests:
21-
name: E2E tests for netbox operator
20+
e2e-tests-3-7-8:
21+
name: Against netbox version 3.7.8
2222
runs-on: ubuntu-latest
2323
steps:
2424
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
@@ -28,7 +28,6 @@ jobs:
2828
- name: Import environment variables from file
2929
run: |
3030
cat ".github/env" >> "$GITHUB_ENV"
31-
echo "E2E_DIAGNOSTIC_DIRECTORY=$(mktemp -d)" >> "$GITHUB_ENV"
3231
- name: Start kind cluster
3332
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
3433
with:
@@ -47,27 +46,88 @@ jobs:
4746
kubectl get pods -A
4847
echo "Cluster information"
4948
kubectl cluster-info
50-
- name: Setup kind cluster with required software such as NetBox
49+
- name: Run e2e tests
5150
run: |
52-
make create-kind
53-
- name: Deploy NetBox operator to the kind cluster
51+
# # Very straight forward way of implementing a test and checking the result
52+
# kubectl apply -f config/samples/netbox_v1_prefixclaim.yaml
53+
# kubectl get prefixclaim,prefix,ipaddressclaim,ipaddress,iprange,iprangeclaim
54+
# kubectl wait --for=condition=ready --timeout=30s prefixclaim.netbox.dev/prefixclaim-sample
55+
56+
# Use Chainsaw
57+
make test-e2e-3.7.8
58+
e2e-tests-4-0-11:
59+
name: Against netbox version 4.0.11
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
63+
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
64+
with:
65+
go-version: 1.23.4
66+
- name: Import environment variables from file
5467
run: |
55-
make deploy-kind
56-
- name: Run tests
57-
env:
58-
E2E_DIAGNOSTIC_DIRECTORY: ${{ env.E2E_DIAGNOSTIC_DIRECTORY }}
68+
cat ".github/env" >> "$GITHUB_ENV"
69+
- name: Start kind cluster
70+
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
71+
with:
72+
version: ${{ env.kind-version }}
73+
node_image: ${{ env.kind-image }}
74+
wait: 300s
75+
config: ./tests/e2e/kind-config.yaml
76+
cluster_name: e2e
77+
- name: Wait for cluster to finish bootstraping
78+
run: |
79+
echo "Waiting for all nodes to be ready..."
80+
kubectl wait --for=condition=Ready nodes --all --timeout=120s
81+
kubectl get nodes
82+
echo "Waiting for all pods to be ready..."
83+
kubectl wait --for=condition=Ready pods --all --all-namespaces --timeout=300s
84+
kubectl get pods -A
85+
echo "Cluster information"
86+
kubectl cluster-info
87+
- name: Run e2e tests
5988
run: |
6089
# # Very straight forward way of implementing a test and checking the result
6190
# kubectl apply -f config/samples/netbox_v1_prefixclaim.yaml
6291
# kubectl get prefixclaim,prefix,ipaddressclaim,ipaddress,iprange,iprangeclaim
6392
# kubectl wait --for=condition=ready --timeout=30s prefixclaim.netbox.dev/prefixclaim-sample
6493
6594
# Use Chainsaw
66-
make test-e2e
67-
- name: Upload diagnostics artifact
68-
if: ${{ failure() }}
69-
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
95+
make test-e2e-4.0.11
96+
e2e-tests-4-1-7:
97+
name: Against netbox version 4.1.7
98+
runs-on: ubuntu-latest
99+
steps:
100+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
101+
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
102+
with:
103+
go-version: 1.23.4
104+
- name: Import environment variables from file
105+
run: |
106+
cat ".github/env" >> "$GITHUB_ENV"
107+
- name: Start kind cluster
108+
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
70109
with:
71-
name: cluster-state
72-
path: ${{ env.E2E_DIAGNOSTIC_DIRECTORY }}
73-
retention-days: 15
110+
version: ${{ env.kind-version }}
111+
node_image: ${{ env.kind-image }}
112+
wait: 300s
113+
config: ./tests/e2e/kind-config.yaml
114+
cluster_name: e2e
115+
- name: Wait for cluster to finish bootstraping
116+
run: |
117+
echo "Waiting for all nodes to be ready..."
118+
kubectl wait --for=condition=Ready nodes --all --timeout=120s
119+
kubectl get nodes
120+
echo "Waiting for all pods to be ready..."
121+
kubectl wait --for=condition=Ready pods --all --all-namespaces --timeout=300s
122+
kubectl get pods -A
123+
echo "Cluster information"
124+
kubectl cluster-info
125+
- name: Run e2e tests
126+
run: |
127+
# # Very straight forward way of implementing a test and checking the result
128+
# kubectl apply -f config/samples/netbox_v1_prefixclaim.yaml
129+
# kubectl get prefixclaim,prefix,ipaddressclaim,ipaddress,iprange,iprangeclaim
130+
# kubectl wait --for=condition=ready --timeout=30s prefixclaim.netbox.dev/prefixclaim-sample
131+
132+
# Use Chainsaw
133+
make test-e2e-4.1.7

Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,23 +242,20 @@ generate_mocks: ## TODO: auto install go install go.uber.org/mock/mockgen@latest
242242
.PHONY: create-kind-3.7.8
243243
create-kind-3.7.8:
244244
./kind/local-env.sh --version 3.7.8
245-
246245
.PHONY: test-e2e-3.7.8
247246
test-e2e-3.7.8: create-kind-3.7.8 deploy-kind install-$(GO_PACKAGE_NAME_CHAINSAW)
248247
chainsaw test --namespace e2e
249248

250249
.PHONY: create-kind-4.0.11
251250
create-kind-4.0.11:
252251
./kind/local-env.sh --version 4.0.11
253-
254252
.PHONY: test-e2e-4.0.11
255253
test-e2e-4.0.11: create-kind-4.0.11 deploy-kind install-$(GO_PACKAGE_NAME_CHAINSAW)
256254
chainsaw test --namespace e2e
257255

258256
.PHONY: create-kind-4.1.7
259257
create-kind-4.1.7:
260258
./kind/local-env.sh --version 4.1.7
261-
262259
.PHONY: test-e2e-4.1.7
263260
test-e2e-4.1.7: create-kind-4.1.7 deploy-kind install-$(GO_PACKAGE_NAME_CHAINSAW)
264261
chainsaw test --namespace e2e

kind/local-env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ elif [[ "${VERSION}" == "4.1.7" ]] ;then
4545
else
4646
echo "Unknown version ${VERSION}"
4747
exit 1
48-
if
48+
fi
4949

5050
# create a kind cluster
5151
kind create cluster || echo "cluster already exists, continuing..."

0 commit comments

Comments
 (0)