Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group Makefile targets #3192

Merged
merged 1 commit into from Feb 14, 2022
Merged

Conversation

Skarlso
Copy link
Contributor

@Skarlso Skarlso commented Feb 10, 2022

What type of PR is this?

/kind feature

What this PR does / why we need it:

A nicer Makefile help output:

➜  cluster-api-provider-aws git:(group_makefile) ✗ make

Usage:
  make <target>

Testing
  test                                      Run tests
  generate-test-flavors                     Generate test template flavors
  test-conformance                          Run clusterctl based conformance test on workload cluster (requires Docker).
  test-cover                                Run tests with code coverage and code generate  reports

Binaries
  binaries                                  Builds and installs all binaries
  manager-aws-infrastructure                Build manager binary.
  clusterawsadm                             Build clusterawsadm binary.

Linting
  lint                                      Lint codebase
  lint-fix                                  Lint the codebase and run auto-fixers if supported by the linter

Generate
  modules                                   Runs go mod to ensure proper vendoring.
  generate                                  Generate code
  generate-go-apis                          Runs Go related generate targets

Docker
  docker-build                              Build the docker image for controller-manager
  docker-push                               Push the docker image
  docker-push-core-manifest                 Push the fat manifest docker image.

Release
  list-staging-releases                     List staging images for image promotion
  release                                   Builds and push container images using the latest git tag for the commit.
  release-changelog                         Builds the changelog for a release
  release-binaries                          Builds the binaries to publish with a release
  release-staging                           Builds and push container images and manifests to the staging bucket.
  release-staging-nightly                   Tags and push container images to the staging bucket.
  upload-staging-artifacts                  Upload release artifacts to the staging bucket
  create-gh-release                         Create release on Github
  upload-gh-artifacts                       Upload artifacts to Github release
  release-templates                         Generate release templates

Cleanup / Verification
  clean                                     Remove all generated files
  clean-bin                                 Remove all generated binaries
  clean-temporary                           Remove all temporary files and folders
  serve-book                                Run a server with the documentation book
  clean-release                             Remove the release folder
  verify-conversions                        Verifies expected API conversion are in place
  verify-shellcheck                         Verify shell files
  clean-artifacts                           Remove the _artifacts directory

Help
  help                                      Display this help

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #3188

Special notes for your reviewer:

Checklist:

  • squashed commits
  • includes documentation
  • adds unit tests
  • adds or updates e2e tests

Release note:

Adding a nicer Makefile help output so it's easy to locate a certain target.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority labels Feb 10, 2022
@k8s-ci-robot
Copy link
Contributor

@Skarlso: This issue is currently awaiting triage.

If CAPA/CAPI contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 10, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @Skarlso. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Feb 10, 2022
@Skarlso
Copy link
Contributor Author

Skarlso commented Feb 10, 2022

@shivi28 👋 :)

These are the categories in the Makefile itself. I wanted to keep that as it is but I'm happy to reorder as needed. :)

@sedefsavas
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 10, 2022
@sedefsavas
Copy link
Contributor

sedefsavas commented Feb 10, 2022

It would be nice to make the categories look more like cluster-api, feel free to reorder as needed.

Usage:
  make <target>

Targets:

generate:
  generate                                       Run all generate-manifests-*, generate-go-deepcopy-* and generate-go-conversions-* targets
  generate-manifests                             Run all generate-manifests-* targets
  generate-manifests-core                        Generate manifests e.g. CRD, RBAC etc. for core
  generate-manifests-kubeadm-bootstrap           Generate manifests e.g. CRD, RBAC etc. for kubeadm bootstrap
  generate-manifests-kubeadm-control-plane       Generate manifests e.g. CRD, RBAC etc. for kubeadm control plane
  generate-go-deepcopy                           Run all generate-go-deepcopy-* targets
  generate-go-deepcopy-core                      Generate deepcopy go code for core
  generate-go-deepcopy-kubeadm-bootstrap         Generate deepcopy go code for kubeadm bootstrap
  generate-go-deepcopy-kubeadm-control-plane     Generate deepcopy go code for kubeadm control plane
  generate-go-conversions                        Run all generate-go-conversions-* targets
  generate-go-conversions-core                   Generate conversions go code for core
  generate-go-conversions-kubeadm-bootstrap      Generate conversions go code for kubeadm bootstrap
  generate-go-conversions-kubeadm-control-plane  Generate conversions go code for kubeadm control plane
  diagrams                                       Generate diagrams for *.plantuml files

lint and verify:
  modules                                        Run go mod tidy to ensure modules are up to date
  lint                                           Lint the codebase
  lint-fix                                       Lint the codebase and run auto-fixers if supported by the linter
  apidiff                                        Check for API differences
  format-tiltfile                                Format the Tiltfile
  verify                                         Run all verify-* targets
  verify-modules                                 Verify go modules are up to date
  verify-gen                                     Verfiy go generated files are up to date
  verify-conversions                             Verifies expected API conversion are in place
  verify-boilerplate                             Verify boilerplate text exists in each file
  verify-shellcheck                              Verify shell files
  verify-tiltfile                                Verify Tiltfile format
  verify-book-links                              Verify book links

build:
  clusterctl                                     Build the clusterctl binary
  managers                                       Run all manager-* targets
  manager-core                                   Build the core manager binary into the ./bin folder
  manager-kubeadm-bootstrap                      Build the kubeadm bootstrap manager binary into the ./bin folder
  manager-kubeadm-control-plane                  Build the kubeadm control plane manager binary into the ./bin folder
  docker-build                                   Run all docker-build-* targets
  docker-build-core                              Build the docker image for core controller manager
  docker-build-kubeadm-bootstrap                 Build the docker image for kubeadm bootstrap controller manager
  docker-build-kubeadm-control-plane             Build the docker image for kubeadm control plane controller manager
  e2e-framework                                  Builds the CAPI e2e framework

test:
  test                                           Run unit and integration tests
  test-e2e                                       Run the e2e tests
  test-junit                                     Run tests with verbose setting and generate a junit report
  test-cover                                     Run tests with code coverage and code generate reports
  test-verbose                                   Run tests with verbose settings
  serve-book                                     Build and serve the book with live-reloading enabled
  kind-cluster                                   Create a new kind cluster designed for testing with Tilt
  docker-build-e2e                               Rebuild all Cluster API provider images to be used in the e2e tests

release:
  release                                        Build and push container images using the latest git tag for the commit
  release-manifests                              Build the manifests to publish with a release
  release-manifests-dev                          Build the development manifests and copies them in the release folder
  release-binaries                               Build the binaries to publish with a release
  release-staging                                Build and push container images to the staging bucket
  release-staging-nightly                        Tag and push container images to the staging bucket. Example image tag: cluster-api-controller:nightly_main_20210121
  release-alias-tag                              Add the release alias tag to the last build tag
  docker-build-all                               Build all the architecture docker images
  docker-push                                    Push the docker images
  docker-push-all                                Push all the architecture docker images
  docker-push-manifest-core                      Push the multiarch manifest for the core docker images
  docker-push-manifest-kubeadm-bootstrap         Push the multiarch manifest for the the kubeadm bootstrap docker images
  docker-push-manifest-kubeadm-control-plane     Push the multiarch manifest for the the kubeadm control plane docker images

clean:
  clean                                          Remove all generated files
  clean-bin                                      Remove all generated binaries
  clean-book                                     Remove all generated GitBook files
  clean-release                                  Remove the release folder
  clean-release-git                              Restores the git files usually modified during a release
  clean-generated-conversions                    Remove files generated by conversion-gen from the mentioned dirs. Example SRC_DIRS="./api/v1alpha4"

hack/tools:
  controller-gen                                 Build a local copy of controller-gen
  conversion-gen                                 Build a local copy of conversion-gen
  conversion-verifier                            Build a local copy of conversion-verifier
  gotestsum                                      Build a local copy of gotestsum
  go-apidiff                                     Build a local copy of apidiff
  golangci-lint                                  Build a local copy of golangci-lint
  envsubst                                       Build a local copy of envsubst
  kustomize                                      Build a local copy of kustomize
  setup-envtest                                  Build a local copy of setup-envtest
  tilt-prepare                                   Build a local copy of tilt-prepare
  kpromo                                         Build a local copy of kpromo

Same category names, like instead of binaries --> build

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 10, 2022
@Skarlso
Copy link
Contributor Author

Skarlso commented Feb 10, 2022

@sedefsavas how about this:

➜  cluster-api-provider-aws git:(group_makefile) make

Usage:
  make <target>

generate:
  generate                                  Generate code
  generate-go-apis                          Runs Go related generate targets

list and verify:
  verify-conversions                        Verifies expected API conversion are in place
  verify-shellcheck                         Verify shell files

build:
  binaries                                  Builds and installs all binaries
  manager-aws-infrastructure                Build manager binary.
  clusterawsadm                             Build clusterawsadm binary.

lint:
  lint                                      Lint codebase
  lint-fix                                  Lint the codebase and run auto-fixers if supported by the linter

test:
  test                                      Run tests
  generate-test-flavors                     Generate test template flavors
  test-conformance                          Run clusterctl based conformance test on workload cluster (requires Docker).
  test-cover                                Run tests with code coverage and code generate  reports
  serve-book                                Run a server with the documentation book

release:
  list-staging-releases                     List staging images for image promotion
  release                                   Builds and push container images using the latest git tag for the commit.
  release-changelog                         Builds the changelog for a release
  release-binaries                          Builds the binaries to publish with a release
  release-staging                           Builds and push container images and manifests to the staging bucket.
  release-staging-nightly                   Tags and push container images to the staging bucket.
  upload-staging-artifacts                  Upload release artifacts to the staging bucket
  create-gh-release                         Create release on Github
  upload-gh-artifacts                       Upload artifacts to Github release
  release-templates                         Generate release templates

clean:
  clean                                     Remove all generated files
  clean-bin                                 Remove all generated binaries
  clean-temporary                           Remove all temporary files and folders
  clean-release                             Remove the release folder
  clean-artifacts                           Remove the _artifacts directory

tools:
  docker-build                              Build the docker image for controller-manager
  docker-push                               Push the docker image
  docker-push-core-manifest                 Push the fat manifest docker image.
  modules                                   Runs go mod to ensure proper vendoring.

help:
  help                                      Display this help

Makefile Outdated
echo "go module files are out of date"; exit 1; \
fi
.PHONY: docker-build
docker-build: docker-pull-prerequisites ## Build the docker image for controller-manager
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can go under build category?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I was on the fence about it since it's docker build. 😂

Makefile Outdated
echo verification of api conversions initiated
$(CONVERSION_VERIFIER)
.PHONY: docker-push
docker-push: ## Push the docker image
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can go under release category.

Makefile Outdated
.PHONY: docker-build
docker-build: docker-pull-prerequisites ## Build the docker image for controller-manager
docker build --build-arg ARCH=$(ARCH) --build-arg LDFLAGS="$(LDFLAGS)" . -t $(CORE_CONTROLLER_IMG)-$(ARCH):$(TAG)
##@ list and verify:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could combine with lint and add modules under it.

Makefile Outdated
verify-boilerplate:
-rm ./hack/tools/bin/*.sh
./hack/verify-boilerplate.sh
##@ tools:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need this IMO, everything under it has a suitable category.

@Skarlso
Copy link
Contributor Author

Skarlso commented Feb 11, 2022

I added some descriptions which where missing, therefore, they weren't in the help at all. That might have been maybe intentional? I can remove them if desired. Further, .build and .* targets aren't rendered by the help. I can fix that if desired, if not then ¯\_(ツ)_/¯

➜  cluster-api-provider-aws git:(group_makefile) ✗ make

Usage:
  make <target>

generate:
  generate                                  Generate code
  generate-go-apis                          Alias for .build/generate-go-apis
  defaulters                                Generate all Go types

lint and verify:
  modules                                   Runs go mod to ensure proper vendoring.
  lint                                      Lint codebase
  lint-fix                                  Lint the codebase and run auto-fixers if supported by the linter
  verify-boilerplate                        Verify boilerplate
  verify-modules                            Verify go modules integrity
  verify-conversions                        Verifies expected API conversion are in place
  verify-shellcheck                         Verify shell files
  verify-gen                                Verify generated files

build:
  binaries                                  Builds and installs all binaries
  managers                                  Alias for manager-aws-infrastructure
  manager-aws-infrastructure                Build manager binary
  clusterawsadm                             Build clusterawsadm binary
  docker-pull-prerequisites                 Build prerequisites using docker
  docker-build                              Build the docker image for controller-manager

test:
  test                                      Run tests
  generate-test-flavors                     Generate test template flavors
  test-conformance                          Run clusterctl based conformance test on workload cluster (requires Docker).
  test-cover                                Run tests with code coverage and code generate  reports
  serve-book                                Run a server with the documentation book

release:
  build-toolchain                           Build the toolchain
  check-github-token                        Check if the github token is set
  check-previous-release-tag                Check if the previous release tag is set
  check-release-tag                         Check if the release tag is set
  create-gh-release                         Create release on Github
  compiled-manifest                         Compile the manifest files
  docker-push                               Push the docker image
  docker-push-core-manifest                 Push the fat manifest docker image.
  docker-push-manifest                      Push the manifest image
  image-patch-source-manifest               Patch the source manifest
  image-patch-kustomization                 Alias for image-patch-kustomization-without-webhook
  image-patch-kustomization-without-webhook  Patch the image in the kustomization file
  image-patch-pull-policy                   Patch the pull policy
  list-staging-releases                     List staging images for image promotion
  list-image                                List images for RELEASE_TAG
  release                                   Builds and push container images using the latest git tag for the commit.
  release-policies                          Release policies
  release-manifests                         Release manifest files
  release-changelog                         Builds the changelog for a release
  release-binaries                          Builds the binaries to publish with a release
  release-binary                            Release binary
  release-staging                           Builds and push container images and manifests to the staging bucket.
  release-staging-nightly                   Tags and push container images to the staging bucket.
  release-templates                         Generate release templates
  upload-staging-artifacts                  Upload release artifacts to the staging bucket
  upload-gh-artifacts                       Upload artifacts to Github release
  staging-manifests                         Staging manifests

clean:
  clean                                     Remove all generated files
  clean-bin                                 Remove all generated binaries
  clean-temporary                           Remove all temporary files and folders
  clean-release                             Remove the release folder
  clean-artifacts                           Remove the _artifacts directory

help:
  help                                      Display this help

@Skarlso
Copy link
Contributor Author

Skarlso commented Feb 12, 2022

/retest

@Skarlso
Copy link
Contributor Author

Skarlso commented Feb 12, 2022

I just changed the makefile ordering, I don't think I messed with the tests. Unless, I accidentally deleted a make target maybe?

@Skarlso
Copy link
Contributor Author

Skarlso commented Feb 12, 2022

Yaaay, seems like the tests passed.

@shivi28
Copy link
Contributor

shivi28 commented Feb 12, 2022

Hey @Skarlso Thanks for the PR.
Yes tests were not failing because of your changes, there was some issue with test pipeline, it's been fixed now.

I have one suggestion, can we sort the categories command alphabetically. Wdyt?
eg

test:
  test                                      Run tests
  generate-test-flavors                     Generate test template flavors
  test-conformance                          Run clusterctl based conformance test on workload cluster (requires Docker).
  test-cover                                Run tests with code coverage and code generate  reports
  serve-book                                Run a server with the documentation book

can be re-written as

test:
  generate-test-flavors                     Generate test template flavors
  test                                      Run tests
  test-conformance                          Run clusterctl based conformance test on workload cluster (requires Docker).
  test-cover                                Run tests with code coverage and code generate  reports
  serve-book                                Run a server with the documentation book

Same we can do with others also.

@shivi28
Copy link
Contributor

shivi28 commented Feb 12, 2022

And once all changes are done, we can squash all the commits to single comment

@Skarlso
Copy link
Contributor Author

Skarlso commented Feb 12, 2022

@shivi28 sure, no problem.

@shivi28
Copy link
Contributor

shivi28 commented Feb 12, 2022

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 12, 2022
@sedefsavas sedefsavas added this to the v1.4.0 milestone Feb 14, 2022
@sedefsavas
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sedefsavas

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 14, 2022
@k8s-ci-robot k8s-ci-robot merged commit c30df60 into kubernetes-sigs:main Feb 14, 2022
@k8s-ci-robot k8s-ci-robot modified the milestones: v1.4.0, v1.x Feb 14, 2022
@Skarlso Skarlso deleted the group_makefile branch February 14, 2022 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modifying makefile in CAPA
4 participants