feat(build): split makefile, ensure tools isolation.#1041
Closed
feat(build): split makefile, ensure tools isolation.#1041
Conversation
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: c27cc6c | Docs | Datadog PR Page | Was this helpful? Give us feedback! |
Author
|
Closing this PR in favour of a deeper building system restructuring. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[Build] Modularise Makefile and isolate tool management
Summary
What: Splits the monolithic 530+ line
Makefileinto focused modules undermk/and introduces stamp-based isolated tool management in.tools/.Why: The original Makefile was difficult to navigate, mixed concerns (build, test, lint, deploy, tool installation), and installed tools globally into
$GOBIN, causing version conflicts between projects and non-reproducible developer environments.How: The root
Makefilebecomes a thin entry point that sets shared variables and includes seven domain-specific modules. All tool binaries are now installed in a project-local.tools/bin/directory, with stamp files that track versions, so Make skips reinstalling when versions haven't changed.Changes
Build System (
Makefile,mk/*.mk):Makefile(530 lines) into a thin entry point (~100 lines) with shared variablesmk/tools.mk— Stamp-based tool version management, all tools install to.tools/bin/mk/docker.mk— Docker build, save, and push targets for injector/handler/managermk/test.mk— Unit tests, e2e tests, and chaosli test targetsmk/generate.mk— CRD manifests, deepcopy, protobuf (DRY template), and mock generationmk/lint.mk—fmt,vet,lint, and spellcheck targetsmk/lima.mk— Lima cluster lifecycle, deployment, and local development helpersmk/ci.mk— CI-specific targets (minikube, headers, licenses, deps, release, Datadog agent)make helptarget that auto-generates help from##commentsTool Isolation:
.tools/bin/instead of global$GOBIN.tools/stamps/track installed versions — version bumps trigger reinstall, same version is a no-op.tools/to.gitignorePATHis extended at the Makefile level to include.tools/bin/clean-toolstarget to wipe the local tool directoryProtobuf:
chaosdogfood.pb.goanddisruptionlistener.pb.gowithprotoc-gen-go v1.36.11(aligned withgo.mod)foreachtemplate instead of duplicated targetsprotoc-gen-goandprotoc-gen-go-grpcare managed as isolated tools with pinned versionsOther:
=(recursive) with:=(simple) for most variable assignments where appropriate.PHONYdeclarations across all targetsTesting
Unit Tests:
make teststill works as before (generates + runs ginkgo suite)make lintinstalls golangci-lint locally and runsManual Testing:
make helpdisplays all available targets.tools/bin/on first usemakeinvocations skip tool install (stamp hit)make clean-toolsremoves.tools/make generateworks with locally installed controller-genmake manifestsworks with locally installed controller-gen + yamlfmtBreaking Changes
$GOBIN/$GOPATH/bin. They now go to.tools/bin/. This is intentional but means runninggolangci-lintorcontroller-gendirectly outside of Make will use the system-installed version, not the project-pinned one.spellcheck-reportandspellcheck-format-spellingtargets were removed (they were rarely used utilities).Dependencies
protoc-gen-gobumped fromv1.27.1tov1.36.11(aligned with go.mod dependency and generated code updated accordingly)go.mod/go.sumChecklist
.tools/added to.gitignoremake helpprovides discoverability for all targets