Skip to content

Commit 7a485d7

Browse files
committed
Add generate-all make target
Problem: We have a lot of generated files now and we might forget to run some targets. Soluton: Add generate-all target that calls all the other generate targets. Use this new target in the CI check and in the release PR to make sure everything is up to date.
1 parent 36d8120 commit 7a485d7

File tree

3 files changed

+26
-23
lines changed

3 files changed

+26
-23
lines changed

.github/workflows/ci.yml

+17-17
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,8 @@ jobs:
6666
run: go mod tidy && git diff --exit-code -- go.mod go.sum
6767
working-directory: tests
6868

69-
- name: Check if generated go files are up to date
70-
run: make generate && git diff --exit-code
71-
72-
- name: Check if generated CRDs and types are up to date
73-
run: make generate-crds && git diff --exit-code
74-
75-
- name: Check if generated manifests are up to date
76-
run: make generate-manifests && git diff --exit-code
77-
78-
- name: Check if helm docs are up to date
79-
run: make helm-docs && git diff --exit-code
80-
81-
- name: Check if API docs are up to date
82-
run: make generate-api-docs && git diff --exit-code
69+
- name: Check if all the generated files are up to date
70+
run: make generate-all && git diff --exit-code
8371

8472
unit-tests:
8573
name: Unit Tests
@@ -230,7 +218,11 @@ jobs:
230218
fail-fast: false
231219
matrix:
232220
image: [nginx, plus]
233-
k8s-version: ["${{ needs.vars.outputs.min_k8s_version }}", "${{ needs.vars.outputs.k8s_latest }}"]
221+
k8s-version:
222+
[
223+
"${{ needs.vars.outputs.min_k8s_version }}",
224+
"${{ needs.vars.outputs.k8s_latest }}",
225+
]
234226
uses: ./.github/workflows/functional.yml
235227
with:
236228
image: ${{ matrix.image }}
@@ -245,7 +237,11 @@ jobs:
245237
fail-fast: false
246238
matrix:
247239
image: [nginx, plus]
248-
k8s-version: ["${{ needs.vars.outputs.min_k8s_version }}", "${{ needs.vars.outputs.k8s_latest }}"]
240+
k8s-version:
241+
[
242+
"${{ needs.vars.outputs.min_k8s_version }}",
243+
"${{ needs.vars.outputs.k8s_latest }}",
244+
]
249245
enable-experimental: [true, false]
250246
uses: ./.github/workflows/conformance.yml
251247
with:
@@ -262,7 +258,11 @@ jobs:
262258
fail-fast: false
263259
matrix:
264260
image: [nginx, plus]
265-
k8s-version: ["${{ needs.vars.outputs.min_k8s_version }}", "${{ needs.vars.outputs.k8s_latest }}"]
261+
k8s-version:
262+
[
263+
"${{ needs.vars.outputs.min_k8s_version }}",
264+
"${{ needs.vars.outputs.k8s_latest }}",
265+
]
266266
uses: ./.github/workflows/helm.yml
267267
with:
268268
image: ${{ matrix.image }}

.github/workflows/release-pr.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ jobs:
7878
include: "charts/nginx-gateway-fabric/*.yaml"
7979
regex: false
8080

81-
- name: Generate manifests and changelog
81+
- name: Generate files and changelog
8282
run: |
8383
sed -i -e "s/v${{ steps.vars.outputs.current_version }}/v${{ inputs.version }}/g" README.md
8484
sed -i -e "s/\[${{ steps.vars.outputs.current_version }}\]/\[${{ inputs.version }}\]/g" README.md
8585
sed -i -e "s/VERSION = edge/VERSION = ${{ inputs.version }}/g" Makefile
8686
sed -i "6r .github/CHANGELOG_TEMPLATE.md" CHANGELOG.md
8787
sed -i -e "s/%%VERSION%%/${{ inputs.version }}/g" CHANGELOG.md
8888
sed -i "8a ${{ join(fromJson(steps.notes.outputs.release-sections).release-notes, '\n') }}\n" CHANGELOG.md
89-
make generate-manifests
89+
make generate-all
9090
9191
- name: Create Pull Request
9292
uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e # v6.0.5

Makefile

+7-4
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@ generate-manifests: ## Generate manifests using Helm.
138138
generate-api-docs: ## Generate API docs
139139
go run github.com./ahmetb/gen-crd-api-reference-docs -config site/config/api/config.json -template-dir site/config/api -out-file site/content/reference/api.md -api-dir "github.com./nginxinc/nginx-gateway-fabric/apis"
140140

141+
.PHONY: generate-helm-docs
142+
generate-helm-docs: ## Generate the Helm chart documentation
143+
docker run --pull always --rm -v $(CURDIR):/nginx-gateway-fabric -w /nginx-gateway-fabric jnorwood/helm-docs:latest --chart-search-root=charts --template-files _templates.gotmpl --template-files README.md.gotmpl
144+
145+
.PHONY: generate-all
146+
generate-all: generate generate-crds generate-manifests generate-api-docs generate-helm-docs ## Generate all the necessary files
147+
141148
.PHONY: clean
142149
clean: ## Clean the build
143150
-rm -r $(OUT_DIR)
@@ -202,10 +209,6 @@ njs-unit-test: ## Run unit tests for the njs httpmatches module
202209
lint-helm: ## Run the helm chart linter
203210
docker run --pull always --rm -v $(CURDIR):/nginx-gateway-fabric -w /nginx-gateway-fabric quay.io/helmpack/chart-testing:latest ct lint --config .ct.yaml
204211

205-
.PHONY: helm-docs
206-
helm-docs: ## Generate the Helm chart documentation
207-
docker run --pull always --rm -v $(CURDIR):/nginx-gateway-fabric -w /nginx-gateway-fabric jnorwood/helm-docs:latest --chart-search-root=charts --template-files _templates.gotmpl --template-files README.md.gotmpl
208-
209212
.PHONY: load-images
210213
load-images: ## Load NGF and NGINX images on configured kind cluster.
211214
kind load docker-image $(PREFIX):$(TAG) $(NGINX_PREFIX):$(TAG)

0 commit comments

Comments
 (0)