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

fix: optimization part copyright and ignoring files #319

Closed
wants to merge 6 commits into from

Conversation

cubxxw
Copy link
Contributor

@cubxxw cubxxw commented Apr 22, 2023

feat: cross compilation, make a great low coupling design to the whole architecture of makefile

feat: cross compilation, make a great low coupling design to the whole architecture of makefile
fix: optimization part copyright and ignoring files

Closes #305

Guys, this is a big project and I'm glad to see the first big framework design
Its features include:

  • uses a low-coupling design
  • contains a large number of commonly used tools
  • New catalog design
  • Use golangci for code detection and automatic repair
  • Supports unit coverage (actions can be improved in future CICD designs)
  • More detailed help information
  • Better developer experience
    ...

DOTO: All basic objects have been tested with no problems 🎯

📑 Description

Read the proposal #305 for the Makefile design

✅ Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

More help information

help

❯ make help

Usage: make <TARGETS> <OPTIONS> ...

Targets:

  all                          Run all the build steps
  build                        Build binaries by default
  tidy                         tidy go.mod
  deploy                       Deploy k8sgpt
  undeploy                     Undeploy k8sgpt
  docker-build                 Build docker image
  fmt                          Run go fmt against code.
  vet                          Run go vet against code.
  lint                         Check syntax and styling of go sources.
  tools                        Install dependent tools.
  style                        Code style -> fmt,vet,lint
  test                         Run unit test.
  cover                        Run unit test with coverage
  verify-copyright             Verify the license headers for all files.
  add-license                  Add copyright ensure source code files have license headers.
  imports                      task to automatically handle import packages in Go files using goimports tool
  clean                        Remove all files that are created by building.
  help                         Show this help info.
  help-all                     Show all help details info.


Options:

  DEBUG            Whether or not to generate debug symbols. Default is 0.

  BINS             Binaries to build. Default is all binaries under cmd.
                   This option is available when using: make {build}(.multiarch)
                   Example: make build BINS="k8sgpt"

  PLATFORMS        Platform to build for. Default is linux_arm64 and linux_amd64.
                   This option is available when using: make {build}.multiarch
                   Example: make build.multiarch PLATFORMS="linux_arm64 linux_amd64"

  V                Set to 1 enable verbose build. Default is 0.

help-all

❯ make help-all
  go.build                            Build binaries by default
  go.deploy                           Deploy k8sgpt
  go.undeploy                         Undeploy k8sgpt
  go.docker-build                     Build docker image
  go.imports                          task to automatically handle import packages in Go files using goimports tool
  go.lint                             Run the golangci-lint
  go.test                             Run unit test
  go.cover                            Run unit test with coverage
  copyright.help                      Show copyright help
  go.clean                            Clean all builds
---------------------------------------------------------------------------------
  copyright.verify                    Validate boilerplate headers for assign files
  copyright.add                       Add the boilerplate headers for all files
  copyright.help                      Show copyright help
---------------------------------------------------------------------------------
  tools.install                       Install a must tools
  tools.install.%                     Install a single tool in $GOBIN/
  tools.verify.%                      Check if a tool is installed and install it
  install.golangci-lint               Install golangci-lint
  install.goimports                   Install goimports, used to format go source files
  install.addlicense                  Install addlicense, used to add license header to source files
  install.conversion-gen              Install conversion-gen, used to generate conversion functions
  install.ginkgo                      Install ginkgo to run a single test or set of tests
  install.kube-score                  Install kube-score, used to check kubernetes yaml files
  Install go-gitlint                  Install go-gitlint, used to check git commit message
  install.gsemver                     Install gsemver, used to generate semver
  install.git-chglog                  Install git-chglog, used to generate changelog
  install.github-release              Install github-release, used to create github release
  install.gvm                         Install gvm, gvm is a Go version manager, built on top of the official go tool.
  install.coscli                      Install coscli. COSCLI is a command line tool for Tencent Cloud Object Storage (COS)
  install.coscmd                      Install coscmd, used to upload files to Tencent Cloud Object Storage (COS)
  install.golines                     Install golines, used to format long lines
  install.go-mod-outdated             Install go-mod-outdated, used to check outdated dependencies
  install.mockgen                     Install mockgen, used to generate mock functions
  install.gotests                     Install gotests, used to generate test functions
  install.protoc-gen-go               Install protoc-gen-go, used to generate go source files from protobuf files
  install.cfssl                       Install cfssl, used to generate certificates
  install.depth                       Install depth, used to check dependency tree
  install.go-callvis                  Install go-callvis, used to visualize call graph
  install.gothanks                    Install gothanks, used to thank go dependencies
  install.richgo                      Install richgo
  install.rts                         Install rts
  install.codegen                     Install code generator, used to generate code
  tools.help                          Display help information about the tools package
---------------------------------------------------------------------------------

Usage: make <TARGETS> <OPTIONS> ...

Targets:

  all                          Run all the build steps
  build                        Build binaries by default
  tidy                         tidy go.mod
  deploy                       Deploy k8sgpt
  undeploy                     Undeploy k8sgpt
  docker-build                 Build docker image
  fmt                          Run go fmt against code.
  vet                          Run go vet against code.
  lint                         Check syntax and styling of go sources.
  tools                        Install dependent tools.
  style                        Code style -> fmt,vet,lint
  test                         Run unit test.
  cover                        Run unit test with coverage
  verify-copyright             Verify the license headers for all files.
  add-license                  Add copyright ensure source code files have license headers.
  imports                      task to automatically handle import packages in Go files using goimports tool
  clean                        Remove all files that are created by building.
  help                         Show this help info.
  help-all                     Show all help details info.


Options:

  DEBUG            Whether or not to generate debug symbols. Default is 0.

  BINS             Binaries to build. Default is all binaries under cmd.
                   This option is available when using: make {build}(.multiarch)
                   Example: make build BINS="k8sgpt"

  PLATFORMS        Platform to build for. Default is linux_arm64 and linux_amd64.
                   This option is available when using: make {build}.multiarch
                   Example: make build.multiarch PLATFORMS="linux_arm64 linux_amd64"

  V                Set to 1 enable verbose build. Default is 0.

Make example:

# make -j nproc build                                            Run tidy gen add-copyright format lint cover build concurrently
# make verify-license                                            Verify the license headers for all files
# make install.deepcopy-gen                                      Install deepcopy-gen tools if the license is missing
# make build BINS=k8sgpt V=1 DEBUG=1                             Build debug binaries for only horizon app
# make build.multiarch PLATFORMS="linux_arm64 linux_amd64" V=1   Build binaries for both platforms

Ariables:

  DEBUG: 0
  BINS:
  PLATFORMS: linux_amd64 linux_arm64
  V:

⚠️ I will continue to maintain and optimize the Makefile and CICD actions flow in the future

@cubxxw cubxxw requested review from a team as code owners April 22, 2023 04:04
Makefile Outdated
SHELL := /bin/bash
DIRS=$(shell ls)
GO=go
VERSION_PACKAGE=github.com/k8sgpt-ai/k8sgpt/version
Copy link
Member

Choose a reason for hiding this comment

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

The version is currently stored here .release-please-manifest.json I would advise against us keeping multiple sources of truth

Copy link
Contributor

@thschue thschue left a comment

Choose a reason for hiding this comment

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

Thank you for this contribution! For me it feels like, there are lots of things included which are not needed in the project (ginkgo, gsemver, conversion-gen, ...). Although I like the structure, I would appreciate it if you only add the things which are present in the current codebase and the things you describe in your PR description, and in the best case in separate PRs.

@cubxxw
Copy link
Contributor Author

cubxxw commented Apr 24, 2023

Thank you for this contribution! For me it feels like, there are lots of things included which are not needed in the project (ginkgo, gsemver, conversion-gen, ...). Although I like the structure, I would appreciate it if you only add the things which are present in the current codebase and the things you describe in your PR description, and in the best case in separate PRs.

ok, I understand our philosophy, in fact I hope that tools will bring a lot of help to CICD, whether we should take it step by step, I will adjust it

@cubxxw
Copy link
Contributor Author

cubxxw commented Apr 24, 2023

The code part is the copyright handling of the Makefile, next time I will split it into multiple PRS, but this PR split is a bit cumbersome, if not necessary.

@cubxxw cubxxw requested a review from a team as a code owner April 26, 2023 13:42
@cubxxw cubxxw force-pushed the backup branch 2 times, most recently from d9e1009 to ba4b3f2 Compare May 3, 2023 05:14
cubxxw added 2 commits May 5, 2023 00:39
…e architecture of makefile

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>

fix: optimization part copyright and ignoring files

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>

fix: optimization part copyright and ignoring files

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>

fix: Some unnecessary tools are removed

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>
Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>

format: fixed go lint issues

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>

format: fixed go lint issues

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>
@cubxxw
Copy link
Contributor Author

cubxxw commented May 5, 2023

@AlexsJones I did not modify the core code, just added part of the copyright, but golintCI did not pass, which made me very helpless, this should be the problem solved by the previous code maintainer, what do you think? I hope I can skip golangci and merge it.

@AlexsJones
Copy link
Member

I will re-review the code shortly with this in mind

@AlexsJones AlexsJones closed this Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

feature: Provide a better development experience
3 participants