@@ -18,6 +18,8 @@ ROOT_DIR_RELATIVE := .
18
18
19
19
include $(ROOT_DIR_RELATIVE ) /common.mk
20
20
21
+ GO_VERSION ?= 1.20.10
22
+
21
23
# Image URL to use all building/pushing image targets
22
24
IMG ?= controller:latest
23
25
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
@@ -46,6 +48,8 @@ MOCKGEN := $(TOOLS_BIN_DIR)/mockgen
46
48
CONTROLLER_GEN := $(TOOLS_BIN_DIR ) /controller-gen
47
49
CONVERSION_VERIFIER := $(TOOLS_BIN_DIR ) /conversion-verifier
48
50
SETUP_ENVTEST := $(TOOLS_BIN_DIR ) /setup-envtest
51
+ GOVULNCHECK := $(TOOLS_BIN_DIR ) /govulncheck
52
+ TRIVY := $(TOOLS_BIN_DIR ) /trivy
49
53
50
54
STAGING_REGISTRY ?= gcr.io/k8s-staging-capi-ibmcloud
51
55
STAGING_BUCKET ?= artifacts.k8s-staging-capi-ibmcloud.appspot.com
@@ -513,6 +517,27 @@ verify-gen: generate ## Verfiy go generated files are up to date
513
517
verify-conversions : $(CONVERSION_VERIFIER ) # # Verifies expected API conversion are in place
514
518
$(CONVERSION_VERIFIER )
515
519
520
+ .PHONY : verify-container-images
521
+ verify-container-images : $(TRIVY ) # # Verify container images
522
+ TRACE=$(TRACE ) ./hack/verify-container-images.sh
523
+
524
+ .PHONY : verify-govulncheck
525
+ verify-govulncheck : $(GOVULNCHECK ) # # Verify code for vulnerabilities
526
+ $(GOVULNCHECK ) ./... && R1=$$? || R1=$$? ; \
527
+ $(GOVULNCHECK ) -C " $( TOOLS_DIR) " ./... && R2=$$? || R2=$$? ; \
528
+ if [ " $$ R1" -ne " 0" ] || [ " $$ R2" -ne " 0" ]; then \
529
+ exit 1; \
530
+ fi
531
+
532
+ .PHONY : verify-security
533
+ verify-security : # # Verify code and images for vulnerabilities
534
+ $(MAKE ) verify-container-images && R1=$$? || R1=$$? ; \
535
+ $(MAKE ) verify-govulncheck && R2=$$? || R2=$$? ; \
536
+ if [ " $$ R1" -ne " 0" ] || [ " $$ R2" -ne " 0" ]; then \
537
+ echo " Check for vulnerabilities failed! There are vulnerabilities to be fixed" ; \
538
+ exit 1; \
539
+ fi
540
+
516
541
# # --------------------------------------
517
542
# # Cleanup / Verification
518
543
# # --------------------------------------
@@ -544,6 +569,10 @@ clean-temporary: ## Remove all temporary files and folders
544
569
clean-release : # # Remove the release folder
545
570
rm -rf $(RELEASE_DIR )
546
571
572
+ .PHONY : clean-release-git
573
+ clean-release-git : # # Restores the git files usually modified during a release
574
+ git restore ./* manager_image_patch.yaml ./* manager_pull_policy.yaml
575
+
547
576
.PHONY : clean-generated-conversions
548
577
clean-generated-conversions : # # Remove files generated by conversion-gen from the mentioned dirs
549
578
(IFS=' ,' ; for i in $( SRC_DIRS) ; do find $$ i -type f -name ' zz_generated.conversion*' -exec rm -f {} \; ; done)
@@ -562,3 +591,11 @@ clean-kind: ## Cleans up the kind cluster with the name $CAPI_KIND_CLUSTER_NAME
562
591
kind-cluster : # # Create a new kind cluster designed for development with Tilt
563
592
hack/kind-install.sh
564
593
594
+ # # --------------------------------------
595
+ # # Helpers
596
+ # # --------------------------------------
597
+
598
+ # #@ helpers:
599
+
600
+ go-version : # # Print the go version we use to compile our binaries and images
601
+ @echo $(GO_VERSION )
0 commit comments