Commit Graph

33 Commits

Author SHA1 Message Date
Ashley Davis
216f95f563
add install for controller-gen and other "gen" tools
k8s codegen tools are a bit of a special case; this is explained in a
comment.

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-03-05 17:18:50 +00:00
Ashley Davis
ccd03ccdd9
Remove outdated, duplicated comment in Makefile
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-03-05 17:05:31 +00:00
Ashley Davis
bc070dfff0
add checks for required binaries in environment
this helps with better error messages for end users

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-03-05 17:05:22 +00:00
Ashley Davis
e22f30420b
add target for boilerplate verification in CI presubmits
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-03-05 16:37:26 +00:00
Ashley Davis
89d7742c56
add verify-errexit target to ci presubmits
Also modifies the script to run without bazel, and tweaks it so that
it'll detect errors in itself too.

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-03-05 16:37:26 +00:00
Maël Valais
b150828a5b make: bin/release-version needs to be rebuilt every time
We use FORCE instead of .PHONY because this is a real file that can be
used as a prerequisite. If we were to use .PHONY, then the file's
timestamp would not be used to check whether targets should be rebuilt,
and they would get constantly rebuilt.

Signed-off-by: Maël Valais <mael@vls.dev>
2022-02-25 17:30:48 +01:00
Maël Valais
a85b1abd37 make: work around the multiple copies of each binaries with hard links
Signed-off-by: Maël Valais <mael@vls.dev>
2022-02-25 17:07:44 +01:00
Maël Valais
6e6667acac make: make sure bin/scratch/build-context/* are intermediate
That should make so 'make' removes these intermediate files.

Signed-off-by: Maël Valais <mael@vls.dev>
2022-02-25 17:06:55 +01:00
Maël Valais
2b252b30ad make: explain why we have the "build-context" dir
Signed-off-by: Maël Valais <mael@vls.dev>
2022-02-25 16:38:53 +01:00
Maël Valais
b33c50342c make: fix "release-version" description
Signed-off-by: Maël Valais <mael@vls.dev>
2022-02-25 16:38:53 +01:00
Maël Valais
6e5bf073c2 make: explain why the target "bin/release-version" exists
Signed-off-by: Maël Valais <mael@vls.dev>
2022-02-25 16:38:53 +01:00
Maël Valais
ac16285f2e make: asthetic, fix the spacing between targets
Signed-off-by: Maël Valais <mael@vls.dev>
2022-02-25 16:38:53 +01:00
Maël Valais
c09dbb07e4 make: speed up 'docker build' with separate dir contexts
Previously, we had one .dockerignore that would do its best to only have
the binaries and licenses copied into the Docker (or nerdctl, or
buildah). Unfortunately, that meant it had to copy all of bin/server and
bin/cmctl, which could become quite large (I measured 1.6 GB).

Instead of relying on a single .dockerignore file, we copy the licenses
and binaries into a "scratch context" directory. The downside is that
all the binaries are in two different places (bin/server and
bin/scratch/containers). Note that we can't use symlinks because Docker
won't dereference them.

Signed-off-by: Maël Valais <mael@vls.dev>
2022-02-25 16:38:53 +01:00
Maël Valais
3f7bac6ad3 make: rebuild images when a different commit is checked out
When switching branches, the Go files may not change. But since the
images contain the commit hash, e.g.:

  cert-manager-controller-amd64:v1.7.0-beta.0-142-gfc0819af6

It is surprising when trying to deploy to Kind: the git commit that is
checked out does not match the commit hash of the image.

To avoid confusion, I added bin/release-version that gets updated only
when the currently checked out commit changes.

Signed-off-by: Maël Valais <mael@vls.dev>
2022-02-25 16:38:53 +01:00
Ashley Davis
dadb2aa8a2
log latest known tag when prepping integration tests
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-02-18 16:43:37 +00:00
Ashley Davis
a57110c6bb
Add targets for unit and integration tests in make
These lean heavily on `go test` for everything possible.

Also adds setup for versionchecker test in make, and a script for
extracting CRDs from templated rendered YAML files

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-02-17 14:48:57 +00:00
Ashley Davis
5972243f3e
add gotestsum, a tool for prettier log output
can also do junit xml output if we care about that

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-02-17 14:48:56 +00:00
Ashley Davis
75cabf5d42
add more Makefile "prelude" entries
inspired by https://clarkgrubb.com/makefile-style-guide

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-02-17 14:48:44 +00:00
jetstack-bot
d55ca17456
Merge pull request #4854 from maelvls/makefile-changes
make/Makefile: fix message when CMREL_KEY isn't set
2022-02-15 20:05:54 +00:00
Maël Valais
9df26703dd make -f make/Makefile helm chart now includes templates/crds.yaml
Signed-off-by: Maël Valais <mael@vls.dev>
2022-02-15 17:52:16 +01:00
Maël Valais
75b49ab641 make: fix message when CMREL_KEY isn't set
Double quotes are not interpreted by make, which meant that the variable
CMREL_KEY was set to '""' and was never empty, which means the $(error
...) block was never interpreted.

Signed-off-by: Maël Valais <mael@vls.dev>
2022-02-15 11:50:36 +01:00
Ashley Davis
3a055cc2f5
rename all uses of github.com/jetstack/cert-manager
This was done by running the following command twice:

 ```bash
 grep -Ri "github.com/jetstack/cert-manager" . | \
 cut -d":" -f1 | \
 sort | \
 uniq | \
 xargs sed -i
 "s/github.com\/jetstack\/cert-manager/github.com\/cert-manager\/cert-manager/"
 ```

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-02-02 09:08:31 +00:00
Ashley Davis
74841280ed
add kubebuilder tools in make for integration tests
Note that darwin/arm64 has to be special cased currently because of a
lack of official support for that platform in upstream etcd and
kube-apiserver. We instead install the amd64 versions, which is what
we did for bazel.

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-01-17 12:04:53 +00:00
Ashley Davis
ad998b35f8
Allow helm chart verification in both bazel + make
This slightly modifies our existing helm chart verification script to
accept the location of a tarball containing the chart we're verifying.

That in turn allows us to more generally use the script for both
validating the chart we build using make and the chart we build using
bazel.

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-01-10 18:02:14 +00:00
Ashley Davis
168b47f1b0
install ginkgo version from go.mod, rather than explicit ver
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-01-06 16:53:36 +00:00
Ashley Davis
80648321f8
add install for ginkgo, used for e2e tests
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-01-06 14:06:29 +00:00
Ashley Davis
1b3ac23659
add goimports verification and skeleton ci presubmit check
CI check will be built upon as Make is improved to reach testing partiy
with bazel

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-01-05 15:28:38 +00:00
Ashley Davis
b2e63dbed3
bump base images
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-01-04 14:49:15 +00:00
jetstack-bot
dcae27d09b
Merge pull request #4680 from SgtCoDFish/toolchecks
make: Don't write tools if hash doesn't match
2021-12-22 08:32:16 +00:00
Ashley Davis
5a261d789a
move checksum verification to tool target over temp target (#4678)
when on temp target, the object being verified will still be written and
so a second invocation of `make tools` will succeed and install an
unverified version

For more information see attached issue

Fixes #4678

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-12-20 14:39:59 +00:00
Ashley Davis
ef26e7974e
always embed version number into temporary downloaded tools artifacts
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-12-20 14:35:40 +00:00
Ashley Davis
9efd933c40
add a specific link to the LICENSES file in the repo
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-12-17 15:23:50 +00:00
Ashley Davis
32d716654a
Add a makefile flow for building artifacts
Includes targets for:

- all "server" binaries, for all arches
- all containers for all server binaries for all arches
- all client binaries (kubectl plugin / cmctl) for all arches
- the cert-manager helm chart + signature
- the cert-manager static manifests + CRDs
- tools which bazel would download, with checksum verification
- (commented out) a signed SHA256SUM file for client binaries

Upgrades from the bazel flow include that:

- we use OS-specific base images rather than just using amd64 everywhere
- we easily add support for signing artifacts at build time
- we add ".exe" to the end of windows executables
- we add a zip file for windows executables, for easier consumption
- we concatenate YAML files more robustly
- staging a full release should be much faster
- hopefully, it's easier to change things!
- licenses are trimmed down to reduce bloat in images (the license
  bundle was 1.4MB in size alone)

Changes from the bazel flow include:

- containers no longer have a symlink to the binary at an unusual
  path, but instead just have the binary at a more predictable path
  (e.g. /app/cmd/webhook/webhook instead of
  /app/cmd/webhook/webhook.runfiles/com_github_jetstack_cert_manager/cmd/webhook/webhook_/webhook)

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-12-15 09:54:15 +00:00