Skip to content

Commit 57259aa

Browse files
committed
move packaging to a separate go module
1 parent a636c55 commit 57259aa

File tree

5 files changed

+349
-84
lines changed

5 files changed

+349
-84
lines changed

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
5858
BIN_DIR := bin
5959
BUILD_DIR := .build
6060
TEST_DIR := test
61+
PACKAGING_DIR := packaging
6162
VCSIM_DIR := test/infrastructure/vcsim
6263
NETOP_DIR := test/infrastructure/net-operator
6364
TEST_EXTENSION_DIR := test/extension
@@ -359,6 +360,7 @@ generate-go-conversions: $(CONTROLLER_GEN) $(CONVERSION_GEN) ## Runs Go related
359360
generate-modules: ## Run go mod tidy to ensure modules are up to date
360361
go mod tidy
361362
cd $(TEST_DIR); go mod tidy
363+
cd $(PACKAGING_DIR); go mod tidy
362364

363365
.PHONY: generate-doctoc
364366
generate-doctoc:
@@ -460,6 +462,7 @@ generate-test-infra-prowjobs: $(PROWJOB_GEN) ## Generates the prowjob configurat
460462
lint: $(GOLANGCI_LINT) ## Lint the codebase
461463
$(GOLANGCI_LINT) run -v $(GOLANGCI_LINT_EXTRA_ARGS)
462464
cd $(TEST_DIR); $(GOLANGCI_LINT) run --path-prefix $(TEST_DIR) --config $(ROOT_DIR)/.golangci.yml -v $(GOLANGCI_LINT_EXTRA_ARGS)
465+
cd $(PACKAGING_DIR); $(GOLANGCI_LINT) run --path-prefix $(PACKAGING_DIR) --config $(ROOT_DIR)/.golangci.yml -v $(GOLANGCI_LINT_EXTRA_ARGS)
463466

464467
.PHONY: lint-fix
465468
lint-fix: $(GOLANGCI_LINT) ## Lint the codebase and run auto-fixers if supported by the linter
@@ -486,6 +489,10 @@ verify-modules: generate-modules ## Verify go modules are up to date
486489
git diff; \
487490
echo "go module files are out of date"; exit 1; \
488491
fi
492+
@if !(git diff --quiet HEAD -- go.sum go.mod $(PACKAGING_DIR)/go.mod $(PACKAGING_DIR)/go.sum); then \
493+
git diff; \
494+
echo "go module files are out of date"; exit 1; \
495+
fi
489496
@if (find . -name 'go.mod' | xargs -n1 grep -q -i 'k8s.io/client-go.*+incompatible'); then \
490497
find . -name "go.mod" -exec grep -i 'k8s.io/client-go.*+incompatible' {} \; -print; \
491498
echo "go module contains an incompatible client-go version"; exit 1; \
@@ -532,6 +539,10 @@ verify-govulncheck: $(GOVULNCHECK) ## Verify code for vulnerabilities
532539
if [ "$$R1" -ne "0" ] || [ "$$R2" -ne "0" ]; then \
533540
exit 1; \
534541
fi
542+
$(GOVULNCHECK) -C "$(PACKAGING_DIR)" ./... && R2=$$? || R2=$$?; \
543+
if [ "$$R1" -ne "0" ] || [ "$$R2" -ne "0" ]; then \
544+
exit 1; \
545+
fi
535546

536547
.PHONY: verify-security
537548
verify-security: ## Verify code and images for vulnerabilities
@@ -786,7 +797,9 @@ e2e-flavors-main: $(RELEASE_DIR)
786797

787798
.PHONY: generate-flavors
788799
generate-flavors: $(FLAVOR_DIR)
789-
go run ./packaging/flavorgen --output-dir $(FLAVOR_DIR)
800+
cd $(PACKAGING_DIR)/flavorgen; go build -o flavorgen ./
801+
$(PACKAGING_DIR)/flavorgen/flavorgen --output-dir $(FLAVOR_DIR)
802+
rm $(PACKAGING_DIR)/flavorgen/flavorgen
790803

791804
.PHONY: release-staging
792805
release-staging: ## Build and push container images to the staging registry

go.mod

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ require (
4141
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8
4242
sigs.k8s.io/cluster-api v0.0.0-00010101000000-000000000000
4343
sigs.k8s.io/controller-runtime v0.19.0
44-
sigs.k8s.io/kustomize/api v0.17.3
45-
sigs.k8s.io/kustomize/kyaml v0.17.2
4644
sigs.k8s.io/yaml v1.4.0
4745
)
4846

@@ -54,20 +52,16 @@ require (
5452
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
5553
github.com/felixge/httpsnoop v1.0.4 // indirect
5654
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
57-
github.com/go-errors/errors v1.4.2 // indirect
5855
github.com/go-logr/stdr v1.2.2 // indirect
5956
github.com/go-logr/zapr v1.3.0 // indirect
6057
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
6158
github.com/google/gnostic-models v0.6.8 // indirect
6259
github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 // indirect
63-
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
6460
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
65-
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
6661
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
6762
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
6863
github.com/stretchr/objx v0.5.2 // indirect
6964
github.com/x448/float16 v0.8.4 // indirect
70-
github.com/xlab/treeprint v1.2.0 // indirect
7165
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect
7266
go.opentelemetry.io/otel v1.28.0 // indirect
7367
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect
@@ -76,7 +70,6 @@ require (
7670
go.opentelemetry.io/otel/sdk v1.28.0 // indirect
7771
go.opentelemetry.io/otel/trace v1.28.0 // indirect
7872
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
79-
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
8073
go.uber.org/multierr v1.11.0 // indirect
8174
go.uber.org/zap v1.27.0 // indirect
8275
golang.org/x/net v0.30.0 // indirect

0 commit comments

Comments
 (0)