Skip to content

chore: add more commands and refactor makefiles#113

Merged
arkodg merged 4 commits into
envoyproxy:mainfrom
Xunzhuo:chore-build
Jun 30, 2022
Merged

chore: add more commands and refactor makefiles#113
arkodg merged 4 commits into
envoyproxy:mainfrom
Xunzhuo:chore-build

Conversation

@Xunzhuo
Copy link
Copy Markdown
Member

@Xunzhuo Xunzhuo commented Jun 17, 2022

  • Refactor makefiles and add more useful commands
➜  gateway git:(chore-build) make help           
Envoy Gateway is an open source project for managing Envoy Proxy as a standalone or Kubernetes-based application gateway

Usage: make <Targets> <Options> ...

Targets:
  build             Build envoy-gateway for host platform. See Option PLATFORM and BINS.
  image             Build docker images for host platform. See Option PLATFORM and BINS.
  push              Push docker images to registry.
  build.multiarch   Build envoy-gateway for multiple platforms. See Option PLATFORMS and IMAGES.
  image.multiarch   Build docker images for multiple platforms. See Option PLATFORMS and IMAGES.
  push.multiarch    Push docker images for multiple platforms to registry.
  lint              Run all linter of code sources, including golint, yamllint and codespell.
  test              Run all Go test of code sources.
  format            Format codes style with mod tidy, gofmt and goimports.
  clean             Remove all files that are created by building.
  help              Show this help info.

Options:
  BINS         The binaries to build. Default is all of cmd.
               This option is available when using: make build/build.multiarch
               Example: make build BINS="envoy-gateway"
  IMAGES       Backend images to make. Default is all of cmds.
               This option is available when using: make image/image.multiarch/push/push.multiarch
               Example: make image.multiarch IMAGES="envoy-gateway"
  PLATFORM     The specified platform to build.
               This option is available when using: make build/image
               Example: make build BINS="envoy-gateway" PLATFORM="linux_amd64"
               Supported Platforms: linux_amd64 linux_arm64 darwin_amd64 darwin_arm64
  PLATFORMS    The multiple platforms to build.
               This option is available when using: make build.multiarch
               Example: make image.multiarch IMAGES="envoy-gateway" PLATFORMS="linux_amd64 linux_arm64"
               Default is "linux_amd64 linux_arm64 darwin_amd64 darwin_arm64".

Signed-off-by: Xunzhuo mixdeers@gmail.com

@Xunzhuo Xunzhuo requested a review from a team as a code owner June 17, 2022 09:29
Comment thread Makefile.targets.mk Outdated
Comment thread Makefile.targets.mk Outdated
@Xunzhuo Xunzhuo requested a review from arkodg June 20, 2022 05:14
Copy link
Copy Markdown
Contributor

@youngnick youngnick left a comment

Choose a reason for hiding this comment

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

I think this looks pretty good overall, just needs a little more explanation so that people understand how the dynamic target building works.

Comment thread Makefile.targets.mk Outdated
@Xunzhuo
Copy link
Copy Markdown
Member Author

Xunzhuo commented Jun 20, 2022

Hi @youngnick, thanks for your kind reviews, more comments have been added.

@Xunzhuo Xunzhuo force-pushed the chore-build branch 7 times, most recently from 4eb6395 to 9dec06e Compare June 20, 2022 07:53
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 20, 2022

Codecov Report

Merging #113 (a8c6e83) into main (884481c) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##              main      #113   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines            5         5           
=========================================
  Hits             5         5           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 884481c...a8c6e83. Read the comment docs.

@Xunzhuo Xunzhuo force-pushed the chore-build branch 4 times, most recently from e04a5fc to 2e86274 Compare June 20, 2022 08:24
@Xunzhuo Xunzhuo requested a review from youngnick June 20, 2022 10:02
@danehans danehans requested review from danehans and lizan and removed request for danehans June 20, 2022 15:59
Comment thread .github/workflows/build_and_test.yaml Outdated
Comment thread Makefile.targets.mk Outdated
@danehans
Copy link
Copy Markdown
Contributor

@Xunzhuo can you respond to the review comments so this PR can proceed?

@Xunzhuo
Copy link
Copy Markdown
Member Author

Xunzhuo commented Jun 28, 2022

@Xunzhuo can you respond to the review comments so this PR can proceed?

Okay, I will work on this today.

@danehans
Copy link
Copy Markdown
Contributor

@Xunzhuo the PR is now failing CI, PTAL.

@arkodg arkodg mentioned this pull request Jun 29, 2022
@Xunzhuo Xunzhuo force-pushed the chore-build branch 2 times, most recently from 21aee1a to 58f0e79 Compare June 29, 2022 07:29
@Xunzhuo
Copy link
Copy Markdown
Member Author

Xunzhuo commented Jun 30, 2022

Hi, CI has passed and reviews have been resolved. @arkodg

Comment thread .github/workflows/build_and_test.yaml Outdated
Comment thread tools/make/image.mk Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks like this wasn't reverted and bin/tmp is still being created

Copy link
Copy Markdown
Member Author

@Xunzhuo Xunzhuo Jun 30, 2022

Choose a reason for hiding this comment

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

How about deleting bin/tmp automatically after building image?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the previous steps were one liners so prefer it over this

Comment thread go.sum Outdated
Comment thread tools/make/image.mk Outdated
Signed-off-by: Xunzhuo <mixdeers@gmail.com>

update

Signed-off-by: Xunzhuo <mixdeers@gmail.com>
Comment thread .github/workflows/build_and_test.yaml Outdated
Signed-off-by: Xunzhuo <mixdeers@gmail.com>
arkodg
arkodg previously approved these changes Jun 30, 2022
Copy link
Copy Markdown
Contributor

@arkodg arkodg left a comment

Choose a reason for hiding this comment

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

LGTM, thanks !

Signed-off-by: Xunzhuo <mixdeers@gmail.com>
@arkodg arkodg merged commit 80b78e5 into envoyproxy:main Jun 30, 2022
arkodg pushed a commit to arkodg/gateway that referenced this pull request Jun 30, 2022
* re add the kube make targets that were accidently
removed as part of envoyproxy#113

* rm implementation for image.multiarch, which needs work

* rm Makefile.targets.mk and reuse tools/make/common.mk

* move top level targets to the right makefiles

* move `make help` strings closer to the target

```
Envoy Gateway is an open source project for managing Envoy Proxy as a standalone or Kubernetes-based application gateway

Usage: make <Targets> <Options> ...

Targets:

Usage:
  make <target>

Golang
  build            Build envoy-gateway for host platform. See Option PLATFORM and BINS.
  test             Run all Go test of code sources.
  format           Format codes style with mod tidy, gofmt and goimports.
  clean            Remove all files that are created during builds.

Image
  image            Build docker images for host platform. See Option PLATFORM and BINS.
  push             Push docker images to registry.

Lint
  lint             Run all linter of code sources, including golint, yamllint and codespell.

Kubernetes Development
  manifests        Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
  generate         Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
  kube-test        Run Kubernetes provider tests.

Kubernetes Deployment
  kube-install     Install CRDs into the Kubernetes cluster specified in ~/.kube/config.
  kube-uninstall   Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.

Kubernetes Build Dependencies
  kustomize        Download kustomize locally if necessary.
  controller-gen   Download controller-gen locally if necessary.
  envtest          Download envtest-setup locally if necessary.

Options:
  BINS         The binaries to build. Default is all of cmd.
               This option is available when using: make build/build.multiarch
               Example: make build BINS="envoy-gateway"
  IMAGES       Backend images to make. Default is all of cmds.
               This option is available when using: make image/image.multiarch/push/push.multiarch
               Example: make image.multiarch IMAGES="envoy-gateway"
  PLATFORM     The specified platform to build.
               This option is available when using: make build/image
               Example: make build BINS="envoy-gateway" PLATFORM="linux_amd64"
               Supported Platforms: linux_amd64 linux_arm64 darwin_amd64 darwin_arm64
  PLATFORMS    The multiple platforms to build.
               This option is available when using: make build.multiarch
               Example: make image.multiarch IMAGES="envoy-gateway" PLATFORMS="linux_amd64 linux_arm64"
               Default is "linux_amd64 linux_arm64 darwin_amd64 darwin_arm64".
```

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
arkodg added a commit that referenced this pull request Jun 30, 2022
* re add the kube make targets that were accidently
removed as part of #113

* rm implementation for image.multiarch, which needs work

* rm Makefile.targets.mk and reuse tools/make/common.mk

* move top level targets to the right makefiles

* move `make help` strings closer to the target

```
Envoy Gateway is an open source project for managing Envoy Proxy as a standalone or Kubernetes-based application gateway

Usage: make <Targets> <Options> ...

Targets:

Usage:
  make <target>

Golang
  build            Build envoy-gateway for host platform. See Option PLATFORM and BINS.
  test             Run all Go test of code sources.
  format           Format codes style with mod tidy, gofmt and goimports.
  clean            Remove all files that are created during builds.

Image
  image            Build docker images for host platform. See Option PLATFORM and BINS.
  push             Push docker images to registry.

Lint
  lint             Run all linter of code sources, including golint, yamllint and codespell.

Kubernetes Development
  manifests        Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
  generate         Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
  kube-test        Run Kubernetes provider tests.

Kubernetes Deployment
  kube-install     Install CRDs into the Kubernetes cluster specified in ~/.kube/config.
  kube-uninstall   Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.

Kubernetes Build Dependencies
  kustomize        Download kustomize locally if necessary.
  controller-gen   Download controller-gen locally if necessary.
  envtest          Download envtest-setup locally if necessary.

Options:
  BINS         The binaries to build. Default is all of cmd.
               This option is available when using: make build/build.multiarch
               Example: make build BINS="envoy-gateway"
  IMAGES       Backend images to make. Default is all of cmds.
               This option is available when using: make image/image.multiarch/push/push.multiarch
               Example: make image.multiarch IMAGES="envoy-gateway"
  PLATFORM     The specified platform to build.
               This option is available when using: make build/image
               Example: make build BINS="envoy-gateway" PLATFORM="linux_amd64"
               Supported Platforms: linux_amd64 linux_arm64 darwin_amd64 darwin_arm64
  PLATFORMS    The multiple platforms to build.
               This option is available when using: make build.multiarch
               Example: make image.multiarch IMAGES="envoy-gateway" PLATFORMS="linux_amd64 linux_arm64"
               Default is "linux_amd64 linux_arm64 darwin_amd64 darwin_arm64".
```

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
LukeShu added a commit that referenced this pull request Jul 6, 2022
…ions

This was dropped in 80b78e5 AKA
#113

Signed-off-by: Luke Shumaker <lukeshu@datawire.io>
LukeShu added a commit that referenced this pull request Jul 8, 2022
…ions

This was dropped in 80b78e5 AKA
#113

Signed-off-by: Luke Shumaker <lukeshu@datawire.io>
LukeShu added a commit that referenced this pull request Jul 13, 2022
* .gitignore: Begone with pointless **/

Entries in .gitignore aren't rooted unless they start with "/", so a
leading "**/" is pointless.

Signed-off-by: Luke Shumaker <lukeshu@datawire.io>

* build-sys: Turn off intermediate file removal

Signed-off-by: Luke Shumaker <lukeshu@datawire.io>

* build-sys: Don't use recursive Make

Arko had trouble with this, because variables were being used before they
were defined.  In order to make those errors easy to debug, I tacked on
--warn-undefined-variables so that these things get called out.

Signed-off-by: Luke Shumaker <lukeshu@datawire.io>

* build-sys: Don't hide what commands are running

Signed-off-by: Luke Shumaker <lukeshu@datawire.io>

* .github: Refactor a bit, splitting things up

Signed-off-by: Luke Shumaker <lukeshu@datawire.io>

* build-sys, .github: Have CI use the combined `make lint`

Rather tha calling each individually.

Signed-off-by: Luke Shumaker <lukeshu@datawire.io>

* build-sys: make lint: Restore integration with GitHub Actions annotations

This was dropped in 80b78e5 AKA
#113

Signed-off-by: Luke Shumaker <lukeshu@datawire.io>

* build-sys: Introduce tools.mk to manage required tools

Signed-off-by: Luke Shumaker <lukeshu@datawire.io>

* build-sys: Begone with MAKE_IN_DOCKER

Signed-off-by: Luke Shumaker <lukeshu@datawire.io>
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.

6 participants