The IMAGE env variable is used by prow when building images, so it was
replacing what we would have expected to be the `prometheus-adapter`
image by the container image used to build the prometheus-adapter image.
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
Improve and cleanup container push rules to prepare for the move to the
official gcr.k8s.io registry.
As part of the improvements, I replaced the non cross platform busybox
image by gcr.io/distroless/static:latest which is platform agnostic.
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
As part of this commit, I upgraded the golang image used for building to
1.16 and consolidated how the docker-build rule was working. Previously,
it was failing in master's CI because the go modules were not downloaded
in the build image. To improve that, I replaced the combination of
docker run and docker build by a multi-stage Dockerfile responsible for
building the adapter and running it.
In addition to that, I removed the `_output` directory completely as it
wasn't really meaningful to have it anymore. I also removed the
`build-local-image` rule as it was a duplicate of the `docker-build`
rule with the only different of using a scratch base image.
Also, since all the base images that we are using by default are based
on busybox, I change the UID used in the image to 65534 which correspond
to the nobody user in busybox.
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
Travis seems to be having issues pulling deps, so we'll have to check in
the vendor directory and prevent the makefile from trying to regenerate
it normally.
This makes the makefile's build target have actual dependencies, so that
it only rebuilds any given adapter if that adapter's actual go files
have changed (yes, this is mostly redundant with Go 1.10, but it makes
working on read-only filesystems a bit nicer).
This adds `verify-gofmt` and `gofmt` make targets for quick go-fmting.
It also adds a `verify` target which verifies `gofmt` and the runs the
unit tests.
Travis now runs `make verify` instead of just `make test` as the tests.
This commit marks the phony targets in the Makefile as phony, following
good Makefile practices (for example, so we don't have have issues with
someone creating a file with a matching name in the future, etc).
This commit causes the `all` Makefile rule to trigger `build` instead
of `docker-build`. This allows people with convoluted setups that
involve `go build`-ing and `docker build`-ing on different machines (like
@directxman12) to not complain as much.
This commit adds a Makefile rule for installing the vendor directory.
Both the `build` and `docker-build` phony rules depend on the `vendor`
rule, which in turn depends on the `glide.lock` rule. This means that
any time the `glide.lock` file is updated, the vendor directory will be
re-installed.
The `build` Makefile target attempted to place the generated artifact in
`/build`, where it should have used a local directory instead. This
commit makes the directory configurable using the `OUT_DIR` argument,
and defaults it to ./_output