Skip to content

Commit 01d3a6d

Browse files
committed
Add ability to update to main branch of Go deps
1 parent d627248 commit 01d3a6d

File tree

4 files changed

+40
-6
lines changed

4 files changed

+40
-6
lines changed

.github/workflows/conformance.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ jobs:
7979
cache-to: type=gha,mode=max
8080
pull: true
8181

82+
- name: Update Go Modules
83+
if: ${{ github.event_name == 'schedule' }}
84+
run: make update-go-modules
85+
working-directory: ./conformance
86+
8287
- name: Build Test Docker Image
8388
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1
8489
with:
@@ -108,6 +113,5 @@ jobs:
108113
working-directory: ./conformance
109114

110115
- name: Run conformance tests
111-
run: |
112-
make run-conformance-tests TAG=${{ github.sha }}
116+
run: make run-conformance-tests TAG=${{ github.sha }}
113117
working-directory: ./conformance

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ deps: ## Add missing and remove unused modules, verify deps and download them to
5656
create-kind-cluster: ## Create a kind cluster
5757
$(eval KIND_IMAGE=$(shell grep -m1 'FROM kindest/node' <conformance/tests/Dockerfile | awk -F'[ ]' '{print $$2}'))
5858
kind create cluster --image $(KIND_IMAGE)
59-
kind export kubeconfig --kubeconfig $(KIND_KUBE_CONFIG)
59+
kind export kubeconfig --kubeconfig $(KIND_KUBE_CONFIG_FOLDER)/config
6060

6161
.PHONY: delete-kind-cluster
6262
delete-kind-cluster: ## Delete kind cluster

conformance/Makefile

+9
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ NGINX_IMAGE=$(shell yq '.spec.template.spec.containers[1].image as $$nginx_ver |
1414
help: Makefile ## Display this help
1515
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "; printf "Usage:\n\n make \033[36m<target>\033[0m\n\nTargets:\n\n"}; {printf " \033[36m%-30s\033[0m %s\n", $$1, $$2}'
1616

17+
.PHONY: update-go-modules
18+
update-go-modules: ## Update the gateway-api go modules to latest main version
19+
go get -u sigs.k8s.io/gateway-api@main
20+
go mod tidy
21+
1722
.PHONY: build-test-runner-image
1823
build-test-runner-image: ## Build conformance test runner image
1924
docker build -t $(PREFIX):$(TAG) -f tests/Dockerfile ..
@@ -94,6 +99,10 @@ uninstall-nkg: ## Uninstall NKG on configured kind cluster
9499
undo-image-update: ## Undo the NKG image name and tag in deployment manifest
95100
git checkout -- $(NKG_DEPLOYMENT_MANIFEST)
96101

102+
.PHONY: reset-go-modules
103+
reset-go-modules: ## Reset the go modules changes
104+
git checkout -- ../go.mod ../go.sum
105+
97106
.PHONY: delete-kind-cluster
98107
delete-kind-cluster: ## Delete kind cluster
99108
kind delete cluster

conformance/README.md

+24-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ install-nkg-local-no-build Install NKG from local build with provisioner on
2929
load-images Load NKG and NGINX containers on configured kind cluster
3030
preload-nginx-container Preload NGINX container on configured kind cluster
3131
prepare-nkg-dependencies Install NKG dependencies on configured kind cluster
32+
reset-go-modules Reset the go modules changes
3233
run-conformance-tests Run conformance tests
3334
undo-image-update Undo the NKG image name and tag in deployment manifest
3435
uninstall-nkg Uninstall NKG on configured kind cluster
36+
update-go-modules Update the gateway-api go modules to latest main version
3537
update-nkg-manifest Update the NKG deployment manifest image name and imagePullPolicy
3638
```
3739

@@ -59,6 +61,13 @@ make create-kind-cluster
5961

6062
### Step 2 - Install Nginx Kubernetes Gateway to configured kind cluster
6163

64+
> Note: If you want to run the latest conformance tests from the Gateway API `main` branch, set the following
65+
> environment variable before deploying NKG:
66+
> ```bash
67+
> export GW_API_VERSION=main
68+
>```
69+
> Otherwise, the latest stable version will be used by default.
70+
6271
#### *Option 1* Build and install Nginx Kubernetes Gateway from local to configured kind cluster
6372
6473
```makefile
@@ -97,6 +106,13 @@ make install-nkg-edge
97106

98107
### Step 3 - Build conformance test runner image
99108

109+
> Note: If you want to run the latest conformance tests from the Gateway API `main` branch, run the following
110+
> make command to update the Go modules to `main`:
111+
> ```makefile
112+
> make update-go-modules
113+
>```
114+
> Otherwise, the latest stable version will be used by default.
115+
100116
```makefile
101117
make build-test-runner-image
102118
```
@@ -117,16 +133,21 @@ make cleanup-conformance-tests
117133
make uninstall-nkg
118134
```
119135

120-
### Step 6 - Revert changes to the NKG deployment manifest
136+
### Step 6 - Revert changes to Go modules
137+
**Optional** Not required if you aren't running the `main` Gateway API tests.
138+
```makefile
139+
make reset-go-modules
140+
```
141+
142+
### Step 7 - Revert changes to the NKG deployment manifest
121143
**Optional** Not required if using `edge` image
122144
**Warning**: `make undo-image-update` will hard reset changes to the deploy/manifests/deployment.yaml file!
123145

124146
```makefile
125147
make undo-image-update
126148
```
127149

128-
### Step 7 - Delete kind cluster
129-
150+
### Step 8 - Delete kind cluster
130151
```makefile
131152
make delete-kind-cluster
132153
```

0 commit comments

Comments
 (0)