Skip to content

chore: migrate to go-makefile-maker generated Makefile#67

Open
onuryilmaz wants to merge 7 commits into
mainfrom
use-gmm-makefile
Open

chore: migrate to go-makefile-maker generated Makefile#67
onuryilmaz wants to merge 7 commits into
mainfrom
use-gmm-makefile

Conversation

@onuryilmaz
Copy link
Copy Markdown

Summary

  • Enable makefile: enabled: true in Makefile.maker.yaml so g-m-m generates the Makefile
  • Move version ldflags (GitBranch, GitCommit, GitState, BuildDate) to golang.ldflags so build-all injects them automatically via GO_LDFLAGS
  • Preserve custom project-specific targets in verbatim:: manifests, test (envtest), fmt, vet, kustomize, build-local, run, docker targets, deployment targets, generate-helm-chart
  • Remove hand-written duplicates superseded by g-m-m: build-all, generate, controller-gen, envtest, install-go-licence-detector, check-dependency-licenses, build/cover.out, golint/lint, help
  • Rename custom compilation target from build to build-local to avoid collision with g-m-m's build (which creates the build/ directory)
  • Rename install/uninstall (CRD operations via kustomize) to install-crd/uninstall-crd to avoid collision with g-m-m's install (binary install)

Test plan

  • make build-all compiles binary with correct version ldflags
  • make check passes (static-check + tests)
  • make generate runs controller-gen correctly
  • make manifests generates CRDs/RBAC correctly
  • make install-crd installs CRDs to cluster

Enable the g-m-m generated Makefile (makefile: enabled: true) and move
custom project-specific targets into the verbatim section. Version ldflags
are now managed via golang.ldflags in Makefile.maker.yaml.

Custom targets preserved in verbatim: manifests, test, fmt, vet, kustomize,
build-local, run, docker-build, docker-push, docker-push-mac, install-crd,
uninstall-crd, deploy, undeploy, generate-helm-chart.

Targets superseded by g-m-m: build-all, generate, controller-gen, envtest,
install-go-licence-detector, check-dependency-licenses, build/cover.out,
golint/lint, help.

Note: install/uninstall (CRD operations) renamed to install-crd/uninstall-crd
to avoid conflict with g-m-m's install target (binary install).
- manifests: add install-controller-gen as prerequisite
- test: add install-setup-envtest as prerequisite
- controllers/util.go: use slices.Contains (modernize)
- pkg/disco/designate.go: use maps.Copy (modernize)
- hack/kustomize-to-helm.go: use any instead of interface{} (modernize)
- pkg/clientutil/client.go: remove unused //nolint:errcheck directive
- api/v1/record_webhook.go: fix goimports
vendor/ is gitignored and not committed, so CI builds fail when
go-makefile-maker auto-detects the local vendor/ directory and
adds -mod vendor to GO_BUILDFLAGS. Delete vendor/ before running
g-m-m so it generates without the vendor flag.
- Replace /* Copyright YEAR SAP SE */ block comments with SPDX headers
  (// SPDX-FileCopyrightText / // SPDX-License-Identifier) in Go files
- Add SPDX headers to Go files that had no copyright info
- Run reuse annotate to add SPDX headers to non-Go files (YAML, Markdown,
  Dockerfile, etc.)
- Add REUSE.toml entries for files reuse cannot annotate inline
  (PROJECT, .helmignore, config.env, boilerplate.go.txt)
- Add reuse.annotations to Makefile.maker.yaml to preserve these entries
  across future go-makefile-maker runs
@github-actions
Copy link
Copy Markdown

Merging this branch will not change overall coverage

Impacted Packages Coverage Δ 🤖
github.com/sapcc/disco 0.00% (ø)
github.com/sapcc/disco/api/v1 1.30% (ø)
github.com/sapcc/disco/controllers 0.00% (ø)
github.com/sapcc/disco/hack 0.00% (ø)
github.com/sapcc/disco/pkg/clientutil 0.00% (ø)
github.com/sapcc/disco/pkg/disco 0.00% (ø)
github.com/sapcc/disco/pkg/util 0.00% (ø)
github.com/sapcc/disco/pkg/version 0.00% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/sapcc/disco/api/v1/doc.go 0.00% (ø) 0 0 0
github.com/sapcc/disco/api/v1/groupversion_info.go 0.00% (ø) 0 0 0
github.com/sapcc/disco/api/v1/record_types.go 100.00% (ø) 1 1 0
github.com/sapcc/disco/api/v1/record_webhook.go 0.00% (ø) 11 0 11
github.com/sapcc/disco/api/v1/zz_generated.deepcopy.go 0.00% (ø) 65 0 65
github.com/sapcc/disco/controllers/ingress_shim_controller.go 0.00% (ø) 51 0 51
github.com/sapcc/disco/controllers/record_controller.go 0.00% (ø) 108 0 108
github.com/sapcc/disco/controllers/service_shim_controller.go 0.00% (ø) 53 0 53
github.com/sapcc/disco/controllers/util.go 0.00% (ø) 9 (-1) 0 9 (-1)
github.com/sapcc/disco/hack/kustomize-to-helm.go 0.00% (ø) 0 0 0
github.com/sapcc/disco/main.go 0.00% (ø) 0 0 0
github.com/sapcc/disco/pkg/clientutil/client.go 0.00% (ø) 27 0 27
github.com/sapcc/disco/pkg/clientutil/error.go 0.00% (ø) 3 0 3
github.com/sapcc/disco/pkg/disco/constants.go 0.00% (ø) 0 0 0
github.com/sapcc/disco/pkg/disco/designate.go 0.00% (ø) 72 (-1) 0 72 (-1)
github.com/sapcc/disco/pkg/util/fqdn.go 0.00% (ø) 3 0 3
github.com/sapcc/disco/pkg/version/version.go 0.00% (ø) 0 0 0

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/sapcc/disco/api/v1/webhook_suite_test.go
  • github.com/sapcc/disco/controllers/suite_test.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant