|
6 | 6 | #
|
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0
|
8 | 8 | #
|
9 |
| -# Unless required by applicable law or agreed to in writing, software |
| 9 | +# Unless requiè by applicable law or agreed to in writing, software |
10 | 10 | # distributed under the License is distributed on an "AS IS" BASIS,
|
11 | 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 | 12 | # See the License for the specific language governing permissions and
|
@@ -164,6 +164,11 @@ GOLANGCI_LINT_VER := $(shell cat .github/workflows/pr-golangci-lint.yaml | grep
|
164 | 164 | GOLANGCI_LINT := $(abspath $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER))
|
165 | 165 | GOLANGCI_LINT_PKG := github.com/golangci/golangci-lint/cmd/golangci-lint
|
166 | 166 |
|
| 167 | +GOVULNCHECK_BIN := govulncheck |
| 168 | +GOVULNCHECK_VER := v1.0.0 |
| 169 | +GOVULNCHECK := $(abspath $(TOOLS_BIN_DIR)/$(GOVULNCHECK_BIN)-$(GOVULNCHECK_VER)) |
| 170 | +GOVULNCHECK_PKG := golang.org/x/vuln/cmd/govulncheck |
| 171 | + |
167 | 172 | CONVERSION_VERIFIER_BIN := conversion-verifier
|
168 | 173 | CONVERSION_VERIFIER := $(abspath $(TOOLS_BIN_DIR)/$(CONVERSION_VERIFIER_BIN))
|
169 | 174 |
|
@@ -653,6 +658,25 @@ verify-tiltfile: ## Verify Tiltfile format
|
653 | 658 | verify-container-images: ## Verify container images
|
654 | 659 | TRACE=$(TRACE) ./hack/verify-container-images.sh
|
655 | 660 |
|
| 661 | +.PHONY: verify-govulncheck |
| 662 | +verify-govulncheck: $(GOVULNCHECK) ## Verify code for vulnerabilities |
| 663 | + $(GOVULNCHECK) ./... && R1=$$? || R1=$$?; \ |
| 664 | + $(GOVULNCHECK) -C "$(TOOLS_DIR)" ./... && R2=$$? || R2=$$?; \ |
| 665 | + $(GOVULNCHECK) -C "$(TEST_DIR)" ./... && R3=$$? || R3=$$?; \ |
| 666 | + if [ "$$R1" -ne "0" ] || [ "$$R2" -ne "0" ] || [ "$$R3" -ne "0" ]; then \ |
| 667 | + exit 1; \ |
| 668 | + fi |
| 669 | + |
| 670 | + |
| 671 | +.PHONY: verify-security |
| 672 | +verify-security: ## Verify code and images for vulnerabilities |
| 673 | + $(MAKE) verify-container-images && R1=$$? || R1=$$?; \ |
| 674 | + $(MAKE) verify-govulncheck && R2=$$? || R2=$$?; \ |
| 675 | + if [ "$$R1" -ne "0" ] || [ "$$R2" -ne "0" ]; then \ |
| 676 | + echo "Check for vulnerabilities failed! There are vulnerability to be fixed"; \ |
| 677 | + exit 1; \ |
| 678 | + fi |
| 679 | + |
656 | 680 | ## --------------------------------------
|
657 | 681 | ## Binaries
|
658 | 682 | ## --------------------------------------
|
@@ -1249,6 +1273,9 @@ $(GINKGO_BIN): $(GINKGO) ## Build a local copy of ginkgo.
|
1249 | 1273 | .PHONY: $(GOLANGCI_LINT_BIN)
|
1250 | 1274 | $(GOLANGCI_LINT_BIN): $(GOLANGCI_LINT) ## Build a local copy of golangci-lint.
|
1251 | 1275 |
|
| 1276 | +.PHONY: $(GOVULNCHECK_BIN) |
| 1277 | +$(GOVULNCHECK_BIN): $(GOVULNCHECK) ## Build a local copy of govulncheck. |
| 1278 | + |
1252 | 1279 | $(CONTROLLER_GEN): # Build controller-gen from tools folder.
|
1253 | 1280 | GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(CONTROLLER_GEN_PKG) $(CONTROLLER_GEN_BIN) $(CONTROLLER_GEN_VER)
|
1254 | 1281 |
|
@@ -1300,6 +1327,9 @@ $(GINKGO): # Build ginkgo from tools folder.
|
1300 | 1327 | $(GOLANGCI_LINT): # Build golangci-lint from tools folder.
|
1301 | 1328 | GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(GOLANGCI_LINT_PKG) $(GOLANGCI_LINT_BIN) $(GOLANGCI_LINT_VER)
|
1302 | 1329 |
|
| 1330 | +$(GOVULNCHECK): # Build govulncheck. |
| 1331 | + GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(GOVULNCHECK_PKG) $(GOVULNCHECK_BIN) $(GOVULNCHECK_VER) |
| 1332 | + |
1303 | 1333 | ## --------------------------------------
|
1304 | 1334 | ## Helpers
|
1305 | 1335 | ## --------------------------------------
|
|
0 commit comments