Skip to content

Commit

Permalink
Makefile command addition for go version update and add CAPI badge
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kishen-v committed Feb 1, 2024
1 parent d027371 commit 3c7d54e
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 8 deletions.
44 changes: 42 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ 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
Expand Down Expand Up @@ -56,7 +58,7 @@ 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
Expand Down Expand Up @@ -483,7 +485,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
Expand Down Expand Up @@ -539,6 +541,26 @@ verify-security: ## Verify code and images for vulnerabilities
exit 1; \
fi

.SILENT:
.PHONY: verify-go-version
verify-go-version: ## Confirms the availability of minor/patch release.
available_version=$$(curl -s "https://go.dev/dl/?mode=json" | jq ".[1].version" | tr -d '"'| cut -c 3- ); \
avl_minor_patch_version=$$(echo $$available_version | awk -F'.' '{print $$(NF-1),$$(NF)}'); \
IFS=' ' read -r available_minor available_patch <<< "$$avl_minor_patch_version"; \
current_minor_patch_version=$$(echo $(GO_VERSION)| awk -F'.' '{print $$(NF-1),$$(NF)}'); \
IFS=' ' read -r current_minor current_patch <<< "$$current_minor_patch_version"; \
if [ $$current_minor -le $$available_minor ]; then \
if [ $$current_patch -lt $$available_patch ] || [ $$current_minor -lt $$available_minor ]; then \
echo "::warning ::Update GO_VERSION to $$available_version"; \
echo "$$available_version is available on go.dev, the version in Makefile is $(GO_VERSION)".; \
echo "Consider bumping the version, run \"make update-go VERSION=$$available_version\" to update across all files."; \
else \
echo "Golang version is up to date."; \
fi \
else \
echo "Golang version is up to date."; \
fi

## --------------------------------------
## Cleanup / Verification
## --------------------------------------
Expand Down Expand Up @@ -600,3 +622,21 @@ 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-version VERSION=X.YY.ZZ
sed -i '' "s/GO_VERSION ?= [[:digit:]].[[:digit:]]\{1,\}.[[:digit:]]\{1,\}/GO_VERSION ?= ${VERSION}/" Makefile
sed -i '' "s/FROM golang\:[[:digit:]].[[:digit:]]\{1,\}.[[:digit:]]\{1,\} AS ccm-builder/FROM golang\:$(VERSION) AS ccm-builder/" hack/ccm/Dockerfile
sed -i '' "s/FROM --platform=\$${BUILDPLATFORM\} golang\:[[:digit:]].[[:digit:]]\{1,\}.[[:digit:]]\{1,\} as toolchain/FROM --platform=\$${BUILDPLATFORM\} golang\:${VERSION} as toolchain/" Dockerfile
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

<p align="center">
<a href="https://github.com/kubernetes-sigs/cluster-api"><img src="https://github.com/kubernetes/kubernetes/raw/master/logo/logo.png" width="100"></a><a href="https://www.ibm.com/cloud/"><img hspace="90px" src="./docs/images/ibm-cloud.svg" alt="Powered by IBM Cloud" height="100"></a>
</p>

<p align="center">
<!-- Go Doc reference -->
<a href="https://godoc.org/sigs.k8s.io/cluster-api-provider-ibmcloud">
<img src="https://godoc.org/sigs.k8s.io/cluster-api-provider-ibmcloud?status.svg"></a>
<!-- CAPIBM Version -->
<a href="https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/releases/latest">
<img src="https://img.shields.io/github/v/release/kubernetes-sigs/cluster-api-provider-ibmcloud?label=version"></a>
<!-- Go Reportcard -->
<a href="https://goreportcard.com/report/sigs.k8s.io/cluster-api-provider-ibmcloud">
<img src="https://goreportcard.com/badge/sigs.k8s.io/cluster-api-provider-ibmcloud"></a>
<!-- K8s - ClusterAPI Provider IBM Cloud slack channel -->
<a href="http://slack.k8s.io/">
<img src="https://img.shields.io/badge/join%20slack-%20%23cluster--api--ibmcloud-brightgreen"></a>
<!-- License information -->
<a href="https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/blob/main/LICENSE">
<img src="https://img.shields.io/badge/license-apache2.0-green.svg"></a>
</p>


------

Expand Down
Binary file added docs/book/theme/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions hack/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ version::get_version_vars() {

# stolen from k8s.io/hack/lib/version.sh
# Use git describe to find the version based on annotated tags.
if GIT_VERSION=$(git describe --abbrev=14 --match "v[0-9]*" 2>/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
Expand Down Expand Up @@ -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}")
}

Expand Down
2 changes: 1 addition & 1 deletion versions.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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.36

0 comments on commit 3c7d54e

Please sign in to comment.