Skip to content

Commit f13f359

Browse files
committed
Remove vuln from unit-tests
There is little value in running vuln in unit-tests. When it complains, it complains about CVEs in your local Go version, which is not the same Go binary that will build in CI (we use stable and oldstable). The target `git-commit-sha` was a no-op. The logic to determine whether to add a `-` at the end of the commit SHA was broken, it was always chosing to add a `-`. Now the `GIT_COMMIT` is always the HEAD commit SHA + `-dev` suffix. Signed-off-by: Aitor Perez Cedres <[email protected]>
1 parent 09c2f56 commit f13f359

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

Makefile

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,27 @@ $(KUBEBUILDER_ASSETS):
5151

5252
.PHONY: unit-tests
5353
unit-tests::install-tools ## Run unit tests
54-
unit-test::$(KUBEBUILDER_ASSETS)
55-
unit-test::generate
56-
unit-test::fmt
57-
unit-test::vet
58-
unit-test::vuln
59-
unit-test::manifests
60-
unit-test::just-unit-tests
54+
unit-tests::$(KUBEBUILDER_ASSETS)
55+
unit-tests::generate
56+
unit-tests::fmt
57+
unit-tests::vet
58+
unit-tests::manifests
59+
unit-tests::just-unit-tests
6160

6261
.PHONY: just-unit-tests
6362
just-unit-tests:
6463
ginkgo -r --randomize-all api/ internal/ rabbitmqclient/
6564

6665
.PHONY: integration-tests
67-
integration-tests: install-tools $(KUBEBUILDER_ASSETS) generate fmt vet manifests ## Run integration tests. Use GINKGO_EXTRA="-some-arg" to append arguments to 'ginkgo run'
68-
ginkgo -r --randomize-all -p $(GINKGO_EXTRA) controllers/
69-
70-
just-integration-tests: $(KUBEBUILDER_ASSETS) vet
66+
integration-tests::install-tools ## Run integration tests. Use GINKGO_EXTRA="-some-arg" to append arguments to 'ginkgo run'
67+
integration-tests::$(KUBEBUILDER_ASSETS)
68+
integration-tests::generate
69+
integration-tests::fmt
70+
integration-tests::vet
71+
integration-tests::manifests
72+
integration-tests::just-integration-tests
73+
74+
just-integration-tests: $(KUBEBUILDER_ASSETS)
7175
ginkgo --randomize-all -r -p $(GINKGO_EXTRA) controllers/
7276

7377
local-tests: unit-tests integration-tests ## Run all local tests (unit & integration)
@@ -169,7 +173,9 @@ ifndef DOCKER_REGISTRY_SECRET
169173
$(error DOCKER_REGISTRY_SECRET is undefined: Name of Kubernetes secret in which to store the Docker registry username and password)
170174
endif
171175

172-
docker-build-dev: check-env-docker-repo git-commit-sha
176+
GIT_COMMIT=$(shell git rev-parse --short HEAD)-dev
177+
178+
docker-build-dev: check-env-docker-repo
173179
$(BUILD_KIT) buildx build --build-arg=GIT_COMMIT=$(GIT_COMMIT) -t $(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):$(GIT_COMMIT) .
174180
$(BUILD_KIT) push $(DOCKER_REGISTRY_SERVER)/$(OPERATOR_IMAGE):$(GIT_COMMIT)
175181

@@ -178,13 +184,6 @@ docker-registry-secret: check-env-docker-credentials operator-namespace
178184
@kubectl -n $(K8S_OPERATOR_NAMESPACE) create secret docker-registry $(DOCKER_REGISTRY_SECRET) --docker-server='$(DOCKER_REGISTRY_SERVER)' --docker-username="$$DOCKER_REGISTRY_USERNAME" --docker-password="$$DOCKER_REGISTRY_PASSWORD" || true
179185
@kubectl -n $(K8S_OPERATOR_NAMESPACE) patch serviceaccount messaging-topology-operator -p '{"imagePullSecrets": [{"name": "$(DOCKER_REGISTRY_SECRET)"}]}'
180186

181-
git-commit-sha:
182-
ifeq ("", git diff --stat)
183-
GIT_COMMIT=$(shell git rev-parse --short HEAD)
184-
else
185-
GIT_COMMIT=$(shell git rev-parse --short HEAD)-
186-
endif
187-
188187
check-env-registry-server:
189188
ifndef DOCKER_REGISTRY_SERVER
190189
$(error DOCKER_REGISTRY_SERVER is undefined: URL of docker registry containing the Operator image (e.g. registry.my-company.com))

0 commit comments

Comments
 (0)