From b472396d1059b342775b73e5f030c15a27b41c95 Mon Sep 17 00:00:00 2001 From: koba1t Date: Mon, 18 Aug 2025 06:53:06 +0900 Subject: [PATCH 1/2] introduce go tool directive --- cmd/gorepomod/go.mod | 2 + cmd/k8scopy/go.mod | 2 + cmd/mdtogo/go.mod | 2 + cmd/pluginator/go.mod | 2 + .../examples/fn-framework-application/go.mod | 2 +- .../examples/fn-framework-application/go.sum | 4 +- .../injection-tshirt-sizes/image/go.mod | 2 +- .../injection-tshirt-sizes/image/go.sum | 4 +- .../examples/template-go-nginx/image/go.mod | 2 +- .../examples/template-go-nginx/image/go.sum | 4 +- .../examples/validator-kubeval/image/go.mod | 2 +- .../examples/validator-kubeval/image/go.sum | 4 +- .../validator-resource-requests/image/go.mod | 2 +- .../validator-resource-requests/image/go.sum | 4 +- hack/go.mod | 56 ++++++++++++++----- hack/tools.go | 41 -------------- 16 files changed, 65 insertions(+), 70 deletions(-) delete mode 100644 hack/tools.go diff --git a/cmd/gorepomod/go.mod b/cmd/gorepomod/go.mod index 864fe5b41..8ab234ac4 100644 --- a/cmd/gorepomod/go.mod +++ b/cmd/gorepomod/go.mod @@ -2,6 +2,8 @@ module sigs.k8s.io/kustomize/cmd/gorepomod go 1.24.0 +tool sigs.k8s.io/kustomize/cmd/gorepomod + require ( github.com/spf13/viper v1.20.0 github.com/stretchr/testify v1.10.0 diff --git a/cmd/k8scopy/go.mod b/cmd/k8scopy/go.mod index 322fc2bda..c56db3fca 100644 --- a/cmd/k8scopy/go.mod +++ b/cmd/k8scopy/go.mod @@ -2,6 +2,8 @@ module sigs.k8s.io/kustomize/cmd/k8scopy go 1.24.0 +tool sigs.k8s.io/kustomize/cmd/k8scopy + require ( github.com/stretchr/testify v1.10.0 sigs.k8s.io/yaml v1.5.0 diff --git a/cmd/mdtogo/go.mod b/cmd/mdtogo/go.mod index 4f7bc36b5..bea529240 100644 --- a/cmd/mdtogo/go.mod +++ b/cmd/mdtogo/go.mod @@ -1,3 +1,5 @@ module sigs.k8s.io/kustomize/cmd/mdtogo go 1.24.0 + +tool sigs.k8s.io/kustomize/cmd/mdtogo diff --git a/cmd/pluginator/go.mod b/cmd/pluginator/go.mod index 989dfcc13..c38bce8a8 100644 --- a/cmd/pluginator/go.mod +++ b/cmd/pluginator/go.mod @@ -2,6 +2,8 @@ module sigs.k8s.io/kustomize/cmd/pluginator/v2 go 1.24.0 +tool sigs.k8s.io/kustomize/cmd/pluginator/v2 + require ( github.com/spf13/cobra v1.9.1 github.com/stretchr/testify v1.10.0 diff --git a/functions/examples/fn-framework-application/go.mod b/functions/examples/fn-framework-application/go.mod index a13a36be2..540ff36f3 100644 --- a/functions/examples/fn-framework-application/go.mod +++ b/functions/examples/fn-framework-application/go.mod @@ -17,7 +17,7 @@ require ( github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/swag v0.23.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/google/gnostic v0.5.7-v3refs // indirect github.com/google/gnostic-models v0.6.9 // indirect github.com/google/go-cmp v0.7.0 // indirect diff --git a/functions/examples/fn-framework-application/go.sum b/functions/examples/fn-framework-application/go.sum index c92287a47..9d1402640 100644 --- a/functions/examples/fn-framework-application/go.sum +++ b/functions/examples/fn-framework-application/go.sum @@ -36,8 +36,8 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/gnostic v0.5.7-v3refs h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54= github.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ= github.com/google/gnostic-models v0.6.9 h1:MU/8wDLif2qCXZmzncUQ/BOfxWfthHi63KqpoNbWqVw= diff --git a/functions/examples/injection-tshirt-sizes/image/go.mod b/functions/examples/injection-tshirt-sizes/image/go.mod index 767accc14..4a61cdbb8 100644 --- a/functions/examples/injection-tshirt-sizes/image/go.mod +++ b/functions/examples/injection-tshirt-sizes/image/go.mod @@ -10,7 +10,7 @@ require ( github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/swag v0.23.0 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/google/gnostic v0.5.7-v3refs // indirect github.com/google/gnostic-models v0.6.9 // indirect github.com/google/go-cmp v0.7.0 // indirect diff --git a/functions/examples/injection-tshirt-sizes/image/go.sum b/functions/examples/injection-tshirt-sizes/image/go.sum index 349009e7c..ef9009273 100644 --- a/functions/examples/injection-tshirt-sizes/image/go.sum +++ b/functions/examples/injection-tshirt-sizes/image/go.sum @@ -129,8 +129,8 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/gnostic v0.5.7-v3refs h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54= diff --git a/functions/examples/template-go-nginx/image/go.mod b/functions/examples/template-go-nginx/image/go.mod index 6cdff60cb..7f8bc15a4 100644 --- a/functions/examples/template-go-nginx/image/go.mod +++ b/functions/examples/template-go-nginx/image/go.mod @@ -10,7 +10,7 @@ require ( github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/swag v0.23.0 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/google/gnostic v0.5.7-v3refs // indirect github.com/google/gnostic-models v0.6.9 // indirect github.com/google/go-cmp v0.7.0 // indirect diff --git a/functions/examples/template-go-nginx/image/go.sum b/functions/examples/template-go-nginx/image/go.sum index 349009e7c..ef9009273 100644 --- a/functions/examples/template-go-nginx/image/go.sum +++ b/functions/examples/template-go-nginx/image/go.sum @@ -129,8 +129,8 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/gnostic v0.5.7-v3refs h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54= diff --git a/functions/examples/validator-kubeval/image/go.mod b/functions/examples/validator-kubeval/image/go.mod index 8ed665354..5c94536e7 100644 --- a/functions/examples/validator-kubeval/image/go.mod +++ b/functions/examples/validator-kubeval/image/go.mod @@ -14,7 +14,7 @@ require ( github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/swag v0.23.0 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/google/gnostic-models v0.6.9 // indirect github.com/google/go-cmp v0.7.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect diff --git a/functions/examples/validator-kubeval/image/go.sum b/functions/examples/validator-kubeval/image/go.sum index dfc011a24..85f4d4502 100644 --- a/functions/examples/validator-kubeval/image/go.sum +++ b/functions/examples/validator-kubeval/image/go.sum @@ -153,8 +153,8 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/gnostic v0.5.7-v3refs h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54= diff --git a/functions/examples/validator-resource-requests/image/go.mod b/functions/examples/validator-resource-requests/image/go.mod index ef505028f..eadeb267d 100644 --- a/functions/examples/validator-resource-requests/image/go.mod +++ b/functions/examples/validator-resource-requests/image/go.mod @@ -10,7 +10,7 @@ require ( github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/swag v0.23.0 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/google/gnostic-models v0.6.9 // indirect github.com/google/go-cmp v0.7.0 // indirect github.com/josharian/intern v1.0.0 // indirect diff --git a/functions/examples/validator-resource-requests/image/go.sum b/functions/examples/validator-resource-requests/image/go.sum index 5e0717512..2932735d7 100644 --- a/functions/examples/validator-resource-requests/image/go.sum +++ b/functions/examples/validator-resource-requests/image/go.sum @@ -128,8 +128,8 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/gnostic v0.5.7-v3refs h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54= diff --git a/hack/go.mod b/hack/go.mod index 03132e725..bd989844f 100644 --- a/hack/go.mod +++ b/hack/go.mod @@ -2,20 +2,35 @@ module sigs.k8s.io/kustomize/hack go 1.24.0 -require ( - github.com/campoy/embedmd v1.0.0 - github.com/cli/cli v1.2.1 - github.com/go-bindata/go-bindata/v3 v3.1.3 - github.com/gohugoio/hugo v0.120.4 - github.com/golangci/golangci-lint v1.64.8 - github.com/google/addlicense v1.1.1 - github.com/instrumenta/kubeval v0.16.1 - github.com/joelanford/go-apidiff v0.6.0 - github.com/monopole/mdrip v1.0.3 - golang.org/x/tools v0.36.0 - sigs.k8s.io/controller-tools v0.14.0 - sigs.k8s.io/kind v0.21.0 - sigs.k8s.io/kustomize/cmd/mdtogo v0.0.0-20240208073625-b154361c0042 +tool ( + // for embeding code and manifest into markdown docs + github.com/campoy/embedmd + // for creating GitHub PRs & releases + github.com/cli/cli/cmd/gh + // for bundling non-go files into go binaries + github.com/go-bindata/go-bindata/v3/go-bindata + // for site serving + github.com/gohugoio/hugo + // for code linting + github.com/golangci/golangci-lint/cmd/golangci-lint + // for license file header injection + github.com/google/addlicense + // for validating k8s manifests + github.com/instrumenta/kubeval + // for checking Go API compatibility + github.com/joelanford/go-apidiff + // for testable markdown examples + github.com/monopole/mdrip + // for code formatting + golang.org/x/tools/cmd/goimports + // for code generation + golang.org/x/tools/cmd/stringer + // for generating CRDs + sigs.k8s.io/controller-tools/cmd/controller-gen + // for local testing + sigs.k8s.io/kind + // for cobra command help text generation from markdown + sigs.k8s.io/kustomize/cmd/mdtogo ) require ( @@ -114,6 +129,7 @@ require ( github.com/briandowns/spinner v1.11.1 // indirect github.com/butuzov/ireturn v0.3.1 // indirect github.com/butuzov/mirror v1.3.0 // indirect + github.com/campoy/embedmd v1.0.0 // indirect github.com/catenacyber/perfsprint v0.8.2 // indirect github.com/ccojocar/zxcvbn-go v1.0.2 // indirect github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect @@ -123,6 +139,7 @@ require ( github.com/chavacava/garif v0.1.0 // indirect github.com/ckaznocha/intrange v0.3.0 // indirect github.com/clbanning/mxj/v2 v2.7.0 // indirect + github.com/cli/cli v1.2.1 // indirect github.com/cli/safeexec v1.0.1 // indirect github.com/cloudflare/circl v1.6.1 // indirect github.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78 // indirect @@ -153,6 +170,7 @@ require ( github.com/getkin/kin-openapi v0.131.0 // indirect github.com/ghodss/yaml v1.0.0 // indirect github.com/ghostiam/protogetter v0.3.9 // indirect + github.com/go-bindata/go-bindata/v3 v3.1.3 // indirect github.com/go-critic/go-critic v0.12.0 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/go-billy/v5 v5.6.0 // indirect @@ -175,6 +193,7 @@ require ( github.com/gofrs/flock v0.12.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/gohugoio/go-i18n/v2 v2.1.3-0.20230805085216-e63c13218d0e // indirect + github.com/gohugoio/hugo v0.120.4 // indirect github.com/gohugoio/locales v0.14.0 // indirect github.com/gohugoio/localescompressed v1.0.1 // indirect github.com/golang-jwt/jwt/v5 v5.2.2 // indirect @@ -184,10 +203,12 @@ require ( github.com/golangci/dupl v0.0.0-20250308024227-f665c8d69b32 // indirect github.com/golangci/go-printf-func-name v0.1.0 // indirect github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d // indirect + github.com/golangci/golangci-lint v1.64.8 // indirect github.com/golangci/misspell v0.6.0 // indirect github.com/golangci/plugin-module-register v0.1.1 // indirect github.com/golangci/revgrep v0.8.0 // indirect github.com/golangci/unconvert v0.0.0-20240309020433-c5143eacb3ed // indirect + github.com/google/addlicense v1.1.1 // indirect github.com/google/go-cmp v0.7.0 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/google/s2a-go v0.1.9 // indirect @@ -216,12 +237,14 @@ require ( github.com/henvic/httpretty v0.0.6 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/instrumenta/kubeval v0.16.1 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/jdkato/prose v1.2.1 // indirect github.com/jgautheron/goconst v1.7.1 // indirect github.com/jingyugao/rowserrcheck v1.1.1 // indirect github.com/jjti/go-spancheck v0.6.4 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect + github.com/joelanford/go-apidiff v0.6.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/julz/importas v0.2.0 // indirect @@ -265,6 +288,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect + github.com/monopole/mdrip v1.0.3 // indirect github.com/moricho/tparallel v0.3.2 // indirect github.com/muesli/reflow v0.1.0 // indirect github.com/muesli/smartcrop v0.3.0 // indirect @@ -385,6 +409,7 @@ require ( golang.org/x/term v0.34.0 // indirect golang.org/x/text v0.28.0 // indirect golang.org/x/time v0.10.0 // indirect + golang.org/x/tools v0.36.0 // indirect golang.org/x/tools/go/expect v0.1.1-deprecated // indirect golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated // indirect golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect @@ -407,7 +432,10 @@ require ( k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect mvdan.cc/gofumpt v0.7.0 // indirect mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f // indirect + sigs.k8s.io/controller-tools v0.14.0 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect + sigs.k8s.io/kind v0.21.0 // indirect + sigs.k8s.io/kustomize/cmd/mdtogo v0.0.0-20240208073625-b154361c0042 // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect sigs.k8s.io/yaml v1.5.0 // indirect software.sslmate.com/src/go-pkcs12 v0.2.0 // indirect diff --git a/hack/tools.go b/hack/tools.go deleted file mode 100644 index 973a376a4..000000000 --- a/hack/tools.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2022 The Kubernetes Authors. -// SPDX-License-Identifier: Apache-2.0 - -//go:build tools -// +build tools - -// This package imports tools required by build scripts. -// https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module -// To update the pinned versions, update `go.mod` or call `go get URL@VERSION“ -package hack - -import ( - // for code generation - _ "golang.org/x/tools/cmd/stringer" - // for code formatting - _ "golang.org/x/tools/cmd/goimports" - // for code linting - _ "github.com/golangci/golangci-lint/cmd/golangci-lint" - // for site serving - _ "github.com/gohugoio/hugo" - // for testable markdown examples - _ "github.com/monopole/mdrip" - // for cobra command help text generation from markdown - _ "sigs.k8s.io/kustomize/cmd/mdtogo" - // for license file header injection - _ "github.com/google/addlicense" - // for local testing - _ "sigs.k8s.io/kind" - // for embeding code and manifest into markdown docs - _ "github.com/campoy/embedmd" - // for generating CRDs - _ "sigs.k8s.io/controller-tools/cmd/controller-gen" - // for bundling non-go files into go binaries - _ "github.com/go-bindata/go-bindata/v3/go-bindata" - // for checking Go API compatibility - _ "github.com/joelanford/go-apidiff" - // for creating GitHub PRs & releases - _ "github.com/cli/cli/cmd/gh" - // for validating k8s manifests - _ "github.com/instrumenta/kubeval" -) From 5fd7b14fc8f07b8f61dc710627d8ed0ce761495e Mon Sep 17 00:00:00 2001 From: koba1t Date: Thu, 28 Aug 2025 02:52:30 +0900 Subject: [PATCH 2/2] update releasing/README.md to use Helps when you have a git repository with multiple Go modules. It handles tasks one might otherwise attempt with ''' find ./ -name "go.mod" | xargs {some hack} ''' Run it from a git repository root. It walks the repository, reads 'go.mod' files, builds a model of Go modules and intra-repo module dependencies, then performs some operation. Install: ''' go get sigs.k8s.io/kustomize/cmd/gorepomod ''' _Commands that change things (everything but 'list') do nothing but log commands unless you add the '--doIt' flag, allowing the change._ _If you want to run 'gorepomod' on your fork or outside of '$GOSRC' directory, add '--local' flag to your command._ Lists modules and intra-repo dependencies. Use this to get module names for use in other commands. Creates a change with mechanical updates to 'go.mod' and 'go.sum' files. Creates a change to 'go.mod' files. For each module _m_ in the repository, if _m_ depends on a _{module}_, then _m_'s dependency on _{module} will be replaced by a relative path to the in-repo version of _{module}_. If _conditionalModule_ is specified, then the replacement of _{module}_ will happen if _m_ depends on _{conditionalModule}_. Creates a change to 'go.mod' files. The opposite of 'unpin'. The change removes replacements and pins _m_ to a specific, previously tagged and released version of _{module}_. The argument _{version}_ defaults to recent version of _{module}_. _{version}_ should be in semver form, e.g. 'v1.2.3'. Computes a new version for the module, tags the repo with that version, and pushes the tag to the remote. The value of the 2nd argument, either 'patch' (the default), 'minor' or 'major', determines the new version. If the existing version is _v1.2.7_, then the new version will be: - 'patch' -> _v1.2.8_ - 'minor' -> _v1.3.0_ - 'major' -> _v2.0.0_ After establishing the version, the command looks for a branch named > _release-{module}/-v{major}.{minor}_ If the branch doesn't exist, the command creates it and pushes it to the remote. The command then creates a new tag in the form > _{module}/v{major}.{minor}.{patch}_ The command pushes this tag to the remote. This typically triggers cloud activity to create release artifacts. This undoes the work of 'release', by deleting the most recent tag both locally and at the remote. You can then fix whatever, and re-release. This, however, must be done almost immediately. If there's a chance someone (or some cloud robot) already imported the module at the given tag, then don't do this, because it will confuse module caches. Do a new patch release instead. instead of --- releasing/README.md | 120 +++++++++++++++++++++----------------------- 1 file changed, 56 insertions(+), 64 deletions(-) diff --git a/releasing/README.md b/releasing/README.md index 336a1bd39..ff255954a 100644 --- a/releasing/README.md +++ b/releasing/README.md @@ -20,13 +20,12 @@ This document describes how to perform a [semver release] of one of the several [Go modules] in this repository. In this repo, releasing a module is accomplished by applying -a tag to the repo and pushing it upstream. A minor release +a tag to the repo and pushing it upstream. A minor release branch is also created as necessary to track patch releases. -A properly formatted tag (described below) contains -the module name and version. +A properly formatted tag (described below) contains the module name and version. -Pushing the tag upstream will trigger [GitHub Actions] to build a release and make it available on the [release page]. +Pushing the tag upstream will trigger [GitHub Actions] to build a release and make it available on the [release page]. [GitHub Actions] reads its instructions from the [`release.yaml`] file in `.github/workflows` directory. And, container image contains `kustomize` binary will build [Google Cloud Build] that instructions from [`cloudbuild_kustomize_image.yaml`] file triggered by tags contain `kustomize` and release versions. @@ -41,22 +40,21 @@ for an explanation of the path-like portion of these tags. Go's [semver]-compatible version tags take the form `v{major}.{minor}.{patch}`: -| major | minor | patch | -| :---: | :---: | :---: | -| API change | enhancements | bug fixes | +| major | minor | patch | +| :-----------: | :---------------: | :--------------------: | +| API change | enhancements | bug fixes | | manual update | maybe auto-update | auto-update encouraged | - - If there are only bug fixes or refactors, increment `patch` from whatever it is now. - - If there are new features, increment `minor`. - - If there's an API change (either the Go API or the CLI behavior - with respect to CLI arguments and flags), increment `major`. +- If there are only bug fixes or refactors, increment `patch` from whatever it is now. +- If there are new features, increment `minor`. +- If there's an API change (either the Go API or the CLI behavior with respect to CLI arguments and flags), increment `major`. ## Release sequence The dependencies determine the release order: -| module | depends on | -| --- | --- | +| module | depends on | +| ---------------------------------- | --------------------- | | `sigs.k8s.io/kustomize/kyaml` | no local dependencies | | `sigs.k8s.io/kustomize/cmd/config` | `kyaml`, | | `sigs.k8s.io/kustomize/api` | `kyaml` | @@ -101,12 +99,6 @@ The release scripts expect Kustomize code to be cloned at a path ending in `sigs source releasing/helpers.sh ``` -#### Install the release tool - -``` -( cd cmd/gorepomod; go install . ) -``` - #### Authenticate to github using [gh](https://github.com/cli/cli) (version [1.8.1](https://github.com/cli/cli/releases/tag/v1.8.1) or higher). ``` @@ -118,8 +110,7 @@ gh auth login #### Establish clean state ``` -refreshMaster && -testKustomizeRepo +refreshMaster && testKustomizeRepo ``` While you're waiting for the tests, review the commit log: @@ -130,18 +121,18 @@ releasing/compile-changelog.sh kyaml HEAD Based on the changes to be included in this release, decide whether a patch, minor or major version bump is needed: [semver review]. -kyaml has no intra-repo deps, so if the tests pass, -it can just be released. +kyaml has no intra-repo deps, so if the tests pass, it can just be released. #### Release it The default increment is a new patch version. ``` -gorepomod release kyaml [patch|minor|major] --doIt +go tool gorepomod release kyaml [patch|minor|major] --doIt ``` Note the version: + ``` versionKyaml=v0.10.20 # EDIT THIS! ``` @@ -149,23 +140,25 @@ versionKyaml=v0.10.20 # EDIT THIS! See the process of the [build history of GitHub Actions job]. Undraft the release on the [kustomize repo release page]: -* Make sure the version number is what you expect. -* Remove references to commits that aren't relevant to end users of this module (e.g. test commits, refactors). -* Make sure each commit left in the release notes includes a PR reference. +- Make sure the version number is what you expect. +- Remove references to commits that aren't relevant to end users of this module (e.g. test commits, refactors). +- Make sure each commit left in the release notes includes a PR reference. ## Release `cmd/config` #### Pin to the most recent kyaml ``` -gorepomod pin kyaml --doIt +go tool gorepomod pin kyaml --doIt ``` Create the PR: + ``` createBranch pinToKyaml "Update kyaml to $versionKyaml" ``` + ``` createPr ``` @@ -173,9 +166,9 @@ createPr Review the resulting PR and get a collaborator to LGTM. Wait for CI to pass. Once the PR merges, get back on master and do paranoia test: + ``` -refreshMaster && -testKustomizeRepo +refreshMaster && testKustomizeRepo ``` While you're waiting for the tests, review the commit log: @@ -189,10 +182,11 @@ Based on the changes to be included in this release, decide whether a patch, min #### Release it ``` -gorepomod release cmd/config [patch|minor|major] --doIt +go tool gorepomod release cmd/config [patch|minor|major] --doIt ``` Note the version: + ``` versionCmdConfig=v0.9.12 # EDIT THIS! ``` @@ -200,34 +194,33 @@ versionCmdConfig=v0.9.12 # EDIT THIS! See the process of the [build history of GitHub Actions job]. Undraft the release on the [kustomize repo release page]: -* Make sure the version number is what you expect. -* Remove references to commits that aren't relevant to end users of this module (e.g. test commits, refactors). -* Make sure each commit left in the release notes includes a PR reference. +- Make sure the version number is what you expect. +- Remove references to commits that aren't relevant to end users of this module (e.g. test commits, refactors). +- Make sure each commit left in the release notes includes a PR reference. ## Release `api` This is the kustomize API, used by the kustomize CLI. - #### Pin to the new cmd/config ``` -gorepomod pin cmd/config --doIt +go tool gorepomod pin cmd/config --doIt ``` Create the PR: + ``` -createBranch pinToCmdConfig "Update cmd/config to $versionCmdConfig" && -createPr +createBranch pinToCmdConfig "Update cmd/config to $versionCmdConfig" && createPr ``` Review the resulting PR and get a collaborator to LGTM. Wait for CI to pass. Once the PR merges, get back on master and do paranoia test: + ``` -refreshMaster && -testKustomizeRepo +refreshMaster && testKustomizeRepo ``` While you're waiting for the tests, review the commit log: @@ -241,10 +234,11 @@ Based on the changes to be included in this release, decide whether a patch, min #### Release it ``` -gorepomod release api [patch|minor|major] --doIt +go tool gorepomod release api [patch|minor|major] --doIt ``` Note the version: + ``` versionApi=v0.8.10 # EDIT THIS! ``` @@ -252,10 +246,10 @@ versionApi=v0.8.10 # EDIT THIS! See the process of the [build history of GitHub Actions job]. Undraft the release on the [kustomize repo release page]: -* Make sure the version number is what you expect. -* Remove references to commits that aren't relevant to end users of this module (e.g. test commits, refactors). -* Make sure each commit left in the release notes includes a PR reference. +- Make sure the version number is what you expect. +- Remove references to commits that aren't relevant to end users of this module (e.g. test commits, refactors). +- Make sure each commit left in the release notes includes a PR reference. ## Release the kustomize CLI @@ -270,21 +264,21 @@ Example: https://github.com/kubernetes-sigs/kustomize/pull/5021 #### Pin to the new API ``` -gorepomod pin api --doIt +go tool gorepomod pin api --doIt ``` Create the PR: + ``` -createBranch pinToApi "Update api to $versionApi" && -createPr +createBranch pinToApi "Update api to $versionApi" && createPr ``` Review the resulting PR and get a collaborator to LGTM. Wait for CI to pass. Once the PR merges, get back on master and do paranoia test: + ``` -refreshMaster && -testKustomizeRepo +refreshMaster && testKustomizeRepo ``` While you're waiting for the tests, review the commit log: @@ -298,7 +292,7 @@ Based on the changes to be included in this release, decide whether a patch, min #### Release it ``` -gorepomod release kustomize [patch|minor|major] --doIt +go tool gorepomod release kustomize [patch|minor|major] --doIt ``` See the process of the [build history of GitHub Actions job]. @@ -306,29 +300,27 @@ See the process of the [build history of GitHub Actions job]. And check the process of [the build status for container image]. Undraft the release on the [kustomize repo release page]: -* Make sure the version number is what you expect. -* Remove references to commits that aren't relevant to end users of the CLI (e.g. test commits, refactors, changes that only surface in Go). -* Make sure each commit left in the release notes includes a PR reference. + +- Make sure the version number is what you expect. +- Remove references to commits that aren't relevant to end users of the CLI (e.g. test commits, refactors, changes that only surface in Go). +- Make sure each commit left in the release notes includes a PR reference. ## Confirm the kustomize binary is correct [installation instructions]: https://kubectl.docs.kubernetes.io/installation/kustomize/binaries/ -* Follow the [installation instructions] to install your new - release and make sure it reports the expected version number. +- Follow the [installation instructions] to install your new release and make sure it reports the expected version number. If not, something is very wrong. -* Visit the [release page] and edit the release notes as desired. +- Visit the [release page] and edit the release notes as desired. ## Return the repo to development mode Go back into development mode, where all modules depend on in-repo code: ``` -gorepomod unpin api --doIt && -gorepomod unpin cmd/config --doIt && -gorepomod unpin kyaml --doIt +go tool gorepomod unpin api --doIt && go tool gorepomod unpin cmd/config --doIt && go tool gorepomod unpin kyaml --doIt ``` [Makefile]: https://github.com/kubernetes-sigs/kustomize/blob/master/Makefile @@ -341,17 +333,17 @@ sed -i "" "s/LATEST_RELEASE=.*/LATEST_RELEASE=v5.0.0/" Makefile ``` Create the PR: + ``` -createBranch unpinEverything "Back to development mode; unpin the modules" && -createPr +createBranch unpinEverything "Back to development mode; unpin the modules" && createPr ``` Review the resulting PR and get a collaborator to LGTM. Wait for CI to pass. Once the PR merges, get back on master and do paranoia test: + ``` -refreshMaster && -testKustomizeRepo +refreshMaster && testKustomizeRepo ``` ## Publish Official Docker Image @@ -380,6 +372,7 @@ To update the version of kustomize shipped with kubectl, first fork and clone the [kubernetes/kubernetes] repo. In the root of the [kubernetes/kubernetes] repo, run the following command: + ```bash ./hack/update-kustomize.sh ``` @@ -396,7 +389,6 @@ https://github.com/kubernetes/kubernetes/pull/103419 https://github.com/kubernetes/kubernetes/pull/106389 - # Testing changes to the release pipeline You can test the release script locally by running [`create-release.sh`].