Skip to content

Commit eb58da6

Browse files
authored
Merge pull request #1129 from rabbitmq/govulncheck
Add govulncheck to makefile.
2 parents 22f7974 + df7738f commit eb58da6

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

.github/workflows/pr.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ jobs:
1515
runs-on: ubuntu-latest
1616
container: us.gcr.io/cf-rabbitmq-for-k8s-bunny/rabbitmq-for-kubernetes-ci
1717
steps:
18+
- name: Install Go
19+
uses: actions/setup-go@v2
20+
with:
21+
go-version: ${{ env.GO_VERSION }}
1822
- name: Check out code into the Go module directory
1923
uses: actions/checkout@v2
2024
- name: Unit tests

Makefile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ $(KUBEBUILDER_ASSETS):
2424
kubebuilder-assets: $(KUBEBUILDER_ASSETS)
2525

2626
.PHONY: unit-tests
27-
unit-tests: install-tools $(KUBEBUILDER_ASSETS) generate fmt vet manifests ## Run unit tests
27+
unit-tests: install-tools $(KUBEBUILDER_ASSETS) generate fmt vet vuln manifests ## Run unit tests
2828
ginkgo -r --randomize-all api/ internal/ pkg/
2929

3030
.PHONY: integration-tests
31-
integration-tests: install-tools $(KUBEBUILDER_ASSETS) generate fmt vet manifests ## Run integration tests
31+
integration-tests: install-tools $(KUBEBUILDER_ASSETS) generate fmt vet vuln manifests ## Run integration tests
3232
ginkgo -r controllers/
3333

3434
manifests: install-tools ## Generate manifests e.g. CRD, RBAC etc.
@@ -53,13 +53,17 @@ fmt:
5353
vet:
5454
go vet ./...
5555

56+
# Run govulncheck against code
57+
vuln:
58+
govulncheck ./...
59+
5660
# Generate code & docs
5761
generate: install-tools api-reference
5862
controller-gen object:headerFile=./hack/NOTICE.go.txt paths=./api/...
5963
controller-gen object:headerFile=./hack/NOTICE.go.txt paths=./internal/status/...
6064

6165
# Build manager binary
62-
manager: generate fmt vet
66+
manager: generate fmt vet vuln
6367
go mod download
6468
go build -o bin/manager main.go
6569

@@ -80,7 +84,7 @@ destroy: ## Cleanup all controller artefacts
8084
kustomize build config/rbac/ | kubectl delete --ignore-not-found=true -f -
8185
kustomize build config/namespace/base/ | kubectl delete --ignore-not-found=true -f -
8286

83-
run: generate manifests fmt vet install deploy-namespace-rbac just-run ## Run operator binary locally against the configured Kubernetes cluster in ~/.kube/config
87+
run: generate manifests fmt vet vuln install deploy-namespace-rbac just-run ## Run operator binary locally against the configured Kubernetes cluster in ~/.kube/config
8488

8589
just-run: ## Just runs 'go run main.go' without regenerating any manifests or deploying RBACs
8690
KUBECONFIG=${HOME}/.kube/config OPERATOR_NAMESPACE=$(K8S_OPERATOR_NAMESPACE) go run ./main.go -metrics-bind-address 127.0.0.1:9782 --zap-devel $(OPERATOR_ARGS)
@@ -182,6 +186,7 @@ docker-registry-secret: check-env-docker-credentials
182186
install-tools:
183187
go mod download
184188
grep _ tools/tools.go | awk -F '"' '{print $$2}' | xargs -t go install
189+
go install "golang.org/x/vuln/cmd/govulncheck@latest"
185190

186191
check-env-docker-repo: check-env-registry-server
187192
ifndef OPERATOR_IMAGE

0 commit comments

Comments
 (0)