Skip to content

Commit 8fb72a3

Browse files
Use YEAR in hack/boilerplate.go.txt as a literal for the current year
The YEAR string in the boilerplate header file will be replaced by controller-gen[^1] and kubebuilder[^2]. This change also requires to define a YEAR variable in the Makefile (holding the current year) which is passed as year=$(YEAR) to the controller-gen crd generation. The applyconfiguration generator of controller-gen handles this substitution automatically by using kubernetes/gengo[^3] and does not need the explicit parameter. [^1]: kubernetes-sigs/controller-tools@54a2e9f [^2]: kubernetes-sigs/kubebuilder@890b118 [^3]: https://github.com/kubernetes/gengo/blob/5ee0d033ba5bcb073f0e69c32057520b82d75ccb/v2/execute.go#L59
1 parent 815502c commit 8fb72a3

4 files changed

Lines changed: 6 additions & 4 deletions

File tree

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,14 +256,15 @@ GO_COVERPKGS := $(shell go list ./... | grep -E '/internal')
256256
null :=
257257
space := $(null) $(null)
258258
comma := ,
259+
YEAR ?= $(shell date +%Y)
259260

260261
check: FORCE static-check build/cover.html build-all
261262
@printf "\e[1;32m>> All checks successful.\e[0m\n"
262263

263264
generate: install-controller-gen
264265
@printf "\e[1;36m>> controller-gen\e[0m\n"
265266
@controller-gen crd rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
266-
@controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
267+
@controller-gen object:headerFile="hack/boilerplate.go.txt",year=$(YEAR) paths="./..."
267268
@controller-gen applyconfiguration:headerFile="hack/boilerplate.go.txt" paths="./..."
268269

269270
run-golangci-lint: FORCE install-golangci-lint
@@ -343,6 +344,7 @@ vars: FORCE
343344
@printf "SED=$(SED)\n"
344345
@printf "UNAME_S=$(UNAME_S)\n"
345346
@printf "XARGS=$(XARGS)\n"
347+
@printf "YEAR=$(YEAR)\n"
346348
help: FORCE
347349
@printf "\n"
348350
@printf "\e[1mUsage:\e[0m\n"

api/cisco/nx/v1alpha1/zz_generated.deepcopy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/core/v1alpha1/zz_generated.deepcopy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hack/boilerplate.go.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
// SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and IronCore contributors
1+
// SPDX-FileCopyrightText: YEAR SAP SE or an SAP affiliate company and IronCore contributors
22
// SPDX-License-Identifier: Apache-2.0

0 commit comments

Comments
 (0)