mirror of
https://github.com/prometheus-operator/prometheus-operator.git
synced 2025-04-08 18:14:14 +00:00
rename lint
to po-lint
As discussed in https://github.com/coreos/prometheus-operator/pull/2938 the binary name `lint` is too generic if used outside of the docker image. So it's been renamed to `po-lint`.
This commit is contained in:
parent
a382ba5486
commit
6449c04eef
5 changed files with 14 additions and 14 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,5 +1,5 @@
|
|||
/operator
|
||||
/lint
|
||||
/po-lint
|
||||
/prometheus-config-reloader
|
||||
.build/
|
||||
*~
|
||||
|
|
|
@ -4,15 +4,15 @@ This document describes how to use the standalone linting tool to validate your
|
|||
|
||||
## Getting linter
|
||||
|
||||
To use the linter either get it with `go get -u github.com/coreos/prometheus-operator/cmd/lint` and executable is `$GOPATH/bin/lint`, or use the container image from `quay.io/coreos/prometheus-operator-lint` and executable is `/bin/lint`.
|
||||
To use the linter either get it with `go get -u github.com/coreos/prometheus-operator/cmd/po-lint` and executable is `$GOPATH/bin/po-lint`, or use the container image from `quay.io/coreos/prometheus-operator-lint` and executable is `/bin/po-lint`.
|
||||
|
||||
## Using linter
|
||||
|
||||
The `lint` executable takes a list of yaml files to check as command arguments. It will output any errors to stderr and returns with exit code `1` on errors, `0` otherwise.
|
||||
The `po-lint` executable takes a list of yaml files to check as command arguments. It will output any errors to stderr and returns with exit code `1` on errors, `0` otherwise.
|
||||
|
||||
## Example
|
||||
|
||||
Here is an example script to lint a `src` sub-directory full of Prometheus Operator CRD files with ether local `lint` or Dockerized version:
|
||||
Here is an example script to lint a `src` sub-directory full of Prometheus Operator CRD files with ether local `po-lint` or Dockerized version:
|
||||
|
||||
```sh
|
||||
#!/bin/sh
|
||||
|
@ -21,12 +21,12 @@ LINTER="quay.io/coreos/prometheus-operator-lint"
|
|||
SCRIPT=$(basename "$0")
|
||||
|
||||
lint_files() {
|
||||
if [ -x "$(command -v lint)" ]; then
|
||||
if [ -x "$(command -v po-lint)" ]; then
|
||||
echo "Linting '${2}' files in directory '${1}'..."
|
||||
had_errors=0
|
||||
for file in $(find "${1}" -name "${2}"); do
|
||||
echo "${file}"
|
||||
lint "${file}"
|
||||
po-lint "${file}"
|
||||
retval=$?
|
||||
if [ $retval -ne 0 ]; then
|
||||
had_errors=1
|
||||
|
|
12
Makefile
12
Makefile
|
@ -62,7 +62,7 @@ clean:
|
|||
############
|
||||
|
||||
.PHONY: build
|
||||
build: $(BINDATA_TARGET) operator prometheus-config-reloader k8s-gen lint
|
||||
build: $(BINDATA_TARGET) operator prometheus-config-reloader k8s-gen po-lint
|
||||
|
||||
.PHONY: operator
|
||||
operator:
|
||||
|
@ -72,9 +72,9 @@ operator:
|
|||
prometheus-config-reloader:
|
||||
$(GO_BUILD_RECIPE) -o $@ cmd/$@/main.go
|
||||
|
||||
.PHONY: lint
|
||||
lint:
|
||||
$(GO_BUILD_RECIPE) -o lint cmd/lint/main.go
|
||||
.PHONY: po-lint
|
||||
po-lint:
|
||||
$(GO_BUILD_RECIPE) -o po-lint cmd/po-lint/main.go
|
||||
|
||||
DEEPCOPY_TARGET := pkg/apis/monitoring/v1/zz_generated.deepcopy.go
|
||||
$(DEEPCOPY_TARGET): $(CONTROLLER_GEN_BINARY)
|
||||
|
@ -138,11 +138,11 @@ image: .hack-operator-image .hack-prometheus-config-reloader-image .hack-lint-im
|
|||
docker build -t $(REPO_PROMETHEUS_CONFIG_RELOADER):$(TAG) -f cmd/prometheus-config-reloader/Dockerfile .
|
||||
touch $@
|
||||
|
||||
.hack-lint-image: cmd/lint/Dockerfile lint
|
||||
.hack-lint-image: cmd/po-lint/Dockerfile po-lint
|
||||
# Create empty target file, for the sole purpose of recording when this target
|
||||
# was last executed via the last-modification timestamp on the file. See
|
||||
# https://www.gnu.org/software/make/manual/make.html#Empty-Targets
|
||||
docker build -t $(REPO_PROMETHEUS_OPERATOR_LINT):$(TAG) -f cmd/lint/Dockerfile .
|
||||
docker build -t $(REPO_PROMETHEUS_OPERATOR_LINT):$(TAG) -f cmd/po-lint/Dockerfile .
|
||||
touch $@
|
||||
|
||||
##############
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FROM quay.io/prometheus/busybox:latest
|
||||
|
||||
ADD lint /bin/lint
|
||||
ADD po-lint /bin/po-lint
|
||||
|
||||
USER nobody
|
||||
|
||||
ENTRYPOINT ["/bin/lint"]
|
||||
ENTRYPOINT ["/bin/po-lint"]
|
Loading…
Add table
Reference in a new issue