From 2090935c17d6e359334a37017863bbeda1305abf Mon Sep 17 00:00:00 2001 From: Kishen V Date: Wed, 29 Nov 2023 12:02:50 +0530 Subject: [PATCH] Makefile command addition for go version update and add CAPI badge Update mdbook version and add target to sub-Makefile Update badges, align images Add make command to update go version across files Add verify-go-version target --- Dockerfile | 3 +- Makefile | 53 ++++++++++++++++++++++++++++++------ README.md | 24 ++++++++++++++-- docs/book/theme/favicon.png | Bin 0 -> 2375 bytes hack/ccm/Dockerfile | 3 +- hack/ccm/Makefile | 8 ++++++ hack/version.sh | 4 +-- versions.mk | 2 +- 8 files changed, 80 insertions(+), 17 deletions(-) create mode 100644 docs/book/theme/favicon.png diff --git a/Dockerfile b/Dockerfile index f5bc5e4942..6532973b7a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,8 @@ # limitations under the License. # Build the manager binary -FROM --platform=${BUILDPLATFORM} golang:1.20.12 as toolchain +ARG golang_image +FROM --platform=${BUILDPLATFORM} ${golang_image} as toolchain # Run this with docker build --build_arg $(go env GOPROXY) to override the goproxy ARG goproxy=https://proxy.golang.org,direct diff --git a/Makefile b/Makefile index d7cc390b63..6c4030fb45 100644 --- a/Makefile +++ b/Makefile @@ -18,13 +18,13 @@ ROOT_DIR_RELATIVE := . include $(ROOT_DIR_RELATIVE)/common.mk -GO_VERSION ?= 1.20.12 - # Image URL to use all building/pushing image targets IMG ?= controller:latest # Produce CRDs that work back to Kubernetes 1.11 (no version conversion) CRD_OPTIONS ?= "crd:crdVersions=v1" +SHELL=/bin/bash + # Directories. REPO_ROOT := $(shell git rev-parse --show-toplevel) ARTIFACTS ?= $(REPO_ROOT)/_artifacts @@ -56,12 +56,16 @@ STAGING_BUCKET ?= artifacts.k8s-staging-capi-ibmcloud.appspot.com BUCKET ?= $(STAGING_BUCKET) PROD_REGISTRY := registry.k8s.io/capi-ibmcloud REGISTRY ?= $(STAGING_REGISTRY) -RELEASE_TAG ?= $(shell git describe --abbrev=0 2>/dev/null) +RELEASE_TAG ?= $(shell git describe --always --abbrev=0 2>/dev/null) PULL_BASE_REF ?= $(RELEASE_TAG) # PULL_BASE_REF will be provided by Prow RELEASE_ALIAS_TAG ?= $(PULL_BASE_REF) RELEASE_DIR := out OUTPUT_TYPE ?= type=registry +# Go +GO_VERSION ?=1.20.12 +GO_CONTAINER_IMAGE ?= golang:$(GO_VERSION) + # kind CAPI_KIND_CLUSTER_NAME ?= capi-test @@ -281,7 +285,7 @@ $(ARTIFACTS): .PHONY: build-toolchain build-toolchain: ## Build the toolchain - docker build --target toolchain -t $(TOOLCHAIN_IMAGE) . + docker build --target toolchain --build-arg golang_image=$(GO_CONTAINER_IMAGE) -t $(TOOLCHAIN_IMAGE) . .PHONY: list-staging-releases list-staging-releases: ## List staging images for image promotion @@ -416,7 +420,7 @@ ensure-buildx: .PHONY: docker-build docker-build: docker-pull-prerequisites ensure-buildx ## Build the docker image for controller-manager - docker buildx build --platform linux/$(ARCH) --output=$(OUTPUT_TYPE) --pull --build-arg LDFLAGS="$(LDFLAGS)" -t $(CORE_CONTROLLER_IMG)-$(ARCH):$(TAG) . + docker buildx build --platform linux/$(ARCH) --output=$(OUTPUT_TYPE) --pull --build-arg golang_image=$(GO_CONTAINER_IMAGE) --build-arg LDFLAGS="$(LDFLAGS)" -t $(CORE_CONTROLLER_IMG)-$(ARCH):$(TAG) . .PHONY: docker-pull-prerequisites docker-pull-prerequisites: @@ -425,7 +429,7 @@ docker-pull-prerequisites: .PHONY: e2e-image e2e-image: docker-pull-prerequisites ensure-buildx - docker buildx build --platform linux/$(ARCH) --load --tag=$(CORE_CONTROLLER_ORIGINAL_IMG):e2e . + docker buildx build --platform linux/$(ARCH) --load --build-arg golang_image=$(GO_CONTAINER_IMAGE) --tag=$(CORE_CONTROLLER_ORIGINAL_IMG):e2e . $(MAKE) set-manifest-image MANIFEST_IMG=$(CORE_CONTROLLER_ORIGINAL_IMG):e2e TARGET_RESOURCE="./config/default/manager_image_patch.yaml" $(MAKE) set-manifest-pull-policy PULL_POLICY=Never TARGET_RESOURCE="./config/default/manager_pull_policy.yaml" @@ -451,8 +455,8 @@ docker-build-%: .PHONY: docker-build-core-image docker-build-core-image: ensure-buildx ## Build the multiarch core docker image - docker buildx build --builder capibm --platform $(BUILDX_PLATFORMS) --output=$(OUTPUT_TYPE) \ - --pull --build-arg ldflags="$(LDFLAGS)" \ + docker buildx build --builder capibm --platform $(BUILDX_PLATFORMS) --output=$(OUTPUT_TYPE) \ + --pull --build-arg golang_image=$(GO_CONTAINER_IMAGE) --build-arg ldflags="$(LDFLAGS)" \ -t $(CORE_CONTROLLER_IMG):$(TAG) . ## -------------------------------------- @@ -483,7 +487,7 @@ define checkdiff git --no-pager diff --name-only FETCH_HEAD endef -ALL_VERIFY_CHECKS = boilerplate shellcheck modules gen conversions +ALL_VERIFY_CHECKS = boilerplate shellcheck modules gen conversions go-version .PHONY: verify verify: $(addprefix verify-,$(ALL_VERIFY_CHECKS)) ## Run all verify-* targets @@ -539,6 +543,17 @@ verify-security: ## Verify code and images for vulnerabilities exit 1; \ fi + +SUBMAKEFILE_GO_VERSION=$(shell grep "GO_VERSION" -m1 hack/ccm/Makefile | cut -d '=' -f2 ) +.SILENT: +.PHONY: verify-go-version +verify-go-version: ## Confirms the version of go used in Makefiles are uniform +ifeq ($(strip $(SUBMAKEFILE_GO_VERSION)), $(strip $(GO_VERSION))) + echo "Versions are uniform across Makefile, the go-version used is $(GO_VERSION)" +else + echo "Versions are different across Makefiles. Please ensure to keep them uniform." +endif + ## -------------------------------------- ## Cleanup / Verification ## -------------------------------------- @@ -600,3 +615,23 @@ kind-cluster: ## Create a new kind cluster designed for development with Tilt go-version: ## Print the go version we use to compile our binaries and images @echo $(GO_VERSION) + +## -------------------------------------- +## Documentation and Publishing +## -------------------------------------- + +.PHONY: serve +serve: ## Build the CAPIBM book and serve it locally to validate changes in documentation. + $(MAKE) -C docs/book/ serve + +## -------------------------------------- +## Update Go Version +## -------------------------------------- +.PHONY: update-go +update-go: ## Update Go version across files: Usage make update-go VERSION=X.YY.ZZ- Use only if you know what you're doing. +ifndef VERSION + echo "VERSION not set. Usage: make update-go VERSION=X.YY.ZZ" +else + sed -i '' "s/GO_VERSION ?=[[:digit:]].[[:digit:]]\{1,\}.[[:digit:]]\{1,\}/GO_VERSION ?=$(VERSION)/" hack/ccm/Makefile + echo "Updated go version to $(VERSION) in Makefile" +endif diff --git a/README.md b/README.md index f95bba5fb1..11247cb02f 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,28 @@ -[![LICENSE](https://img.shields.io/badge/license-apache2.0-green.svg)](https://sigs.k8s.io/cluster-api-provider-ibmcloud/blob/master/LICENSE) -![GitHub release (latest by date)](https://img.shields.io/github/v/release/kubernetes-sigs/cluster-api-provider-ibmcloud?label=version) -[![Go Report Card](https://goreportcard.com/badge/sigs.k8s.io/cluster-api-provider-ibmcloud)](https://goreportcard.com/report/sigs.k8s.io/cluster-api-provider-ibmcloud) # Kubernetes Cluster API Provider IBM Cloud (CAPIBM) +

Powered by IBM Cloud +

+ +

+ + + + + + + + + + + + + + + +

+ ------ diff --git a/docs/book/theme/favicon.png b/docs/book/theme/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..67280ebe983be7c6cb25619c7a7dc8b9654903a9 GIT binary patch literal 2375 zcmY*bdpwhEAHSKL;~}TSV^)zv+tBN{VPcLWQ#m)oFf+zxL$5<2hje&|a#;3Y59QDS zMN~>6hgLm|P?AK#Dl{IacdEDE_qsp#eSPom_j`SR*YEn{{@huIT0Qg5hrAz}rEF1u4 z0sz4L5&$SuO76HL1i~SLmtzP91Lz8{I3O$}4}b(nNN@oeL_p*l1^_{lV1QUczf_j+ zPZi7p{lZ(ud%iAnf)H=wVK15&#>G4+iVVdEM+Fj~ab(Jt0YJo=3m}<5!-M0<5s_5$ zI3(no!(4#3Xcz?i%|as~Azqk6;Db>y1h6p_4uwN3CBa}YA|^P*9BYgIv0U(mgoM#( z6muAi!C*icM$o93P?&+4nHdaj2s1R?FL3Oq#z)fdar+~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;dn zs*rNL+*XLusvBdTvSeEgHd7~VpGz=Fdq}rJ_+FRxR9d`u-qh7U31(K}VSCu$yRaBZ%PoPiBp(~-J= zLJP-foGO@|j5l>(m0~2uwmQx2C)7x$1m^oqB~!YYJx6P|>qSm7!z){O0qwhMJ+eA$ zSoNphedR%V*iFzE!@1m#jEIg$xoCHp8m~kA_3?s!?a}LrVxRHPdqt9C$D51T`TSzp voXA|%ZRUJeUZ5$B{w95RvAbn+b?QD)nWi$z5>jl~`p/dev/null); then + if GIT_VERSION=$(git describe --always --abbrev=14 --match "v[0-9]*" 2>/dev/null); then # This translates the "git describe" to an actual semver.org # compatible semantic version that looks something like this: # v1.1.0-alpha.0.6+84c76d1142ea4d @@ -71,7 +71,7 @@ version::get_version_vars() { fi fi - GIT_RELEASE_TAG=$(git describe --abbrev=0 --tags) + GIT_RELEASE_TAG=$(git describe --always --abbrev=0 --tags) GIT_RELEASE_COMMIT=$(git rev-list -n 1 "${GIT_RELEASE_TAG}") } diff --git a/versions.mk b/versions.mk index 3b2fe096b6..b3da096bff 100644 --- a/versions.mk +++ b/versions.mk @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -MDBOOK_VERSION := v0.4.5 +MDBOOK_VERSION := v0.4.37