Skip to content

Commit

Permalink
Add script to check tool versions
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosedp committed Sep 13, 2024
1 parent f672860 commit fac21b5
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ help: ## Display this help.
print-%: ## Print any variable from the Makefile. Use as `make print-VARIABLE`
@echo $($*)

.PHONY: check-versions
check-versions: ## Check versions of tools
@./hack/check_versions.sh

##@ Development

.PHONY: manifests
Expand Down Expand Up @@ -370,7 +374,7 @@ testenv-teardown: ## Teardown the test environment (KIND cluster)
kind delete cluster --name test-operator > /dev/null 2>&1

.PHONY: dist
dist: bundle olm-validate podman-crossbuild ## Build manifests and container images, pushing them to the registry
dist: check-versions bundle olm-validate podman-crossbuild ## Build manifests and container images, pushing them to the registry
@sed -i -e 's|v[0-9]*\.[0-9]*\.[0-9]*|v$(VERSION)|g' Readme.md

.PHONY: clean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ metadata:
categories: Networking
certified: "false"
containerImage: quay.io/carlosedp/lbconfig-operator:v0.5.0
createdAt: "2024-09-13T13:44:58Z"
createdAt: "2024-09-13T20:01:51Z"
description: The LBConfig Operator, manages the configuration of External Load
Balancer instances (on third-party equipment) and creates VIPs and IP Pools
dynamically via API.
Expand Down
57 changes: 57 additions & 0 deletions hack/check_versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash

# This script checks the latest versions of the tools used in the project
# listed in the Makefile

# Check if the Makefile exists
if [ ! -f Makefile ]; then
echo "Makefile not found"
exit 1
fi

# Get the list of tools from the Makefile
# ENVTEST_K8S_VERSION
# KUSTOMIZE_VERSION
# CONTROLLER_TOOLS_VERSION
# OPERATOR_SDK_VERSION
# OLM_VERSION
# KIND_VERSION

# Get the latest version of the tools
echo "Checking the latest versions of the tools used in the project"
# Golang version
GOLANGVERSION=$(curl -s https://go.dev/VERSION?m=text | head -1)

# ENVTEST_K8S_VERSION
ENVTEST_K8S_VERSION=$(curl -s https://api.github.com/repos/kubernetes/kubernetes/releases/latest | jq -r .tag_name | sed 's/^v//')

# KUSTOMIZE_VERSION
KUSTOMIZE_VERSION=$(curl -s https://api.github.com/repos/kubernetes-sigs/kustomize/releases/latest | jq -r .tag_name | sed 's/^kustomize\///')

# CONTROLLER_TOOLS_VERSION
CONTROLLER_TOOLS_VERSION=$(curl -s https://api.github.com/repos/kubernetes-sigs/controller-tools/releases/latest | jq -r .tag_name)

# OPERATOR_SDK_VERSION
OPSDKVERSION=$(curl -s https://api.github.com/repos/operator-framework/operator-sdk/releases/latest | jq -r .tag_name)

# OLM_VERSION
OLMVER=$(curl -s https://api.github.com/repos/operator-framework/operator-lifecycle-manager/releases/latest | jq -r .tag_name | sed 's/^v//')

# KIND_VERSION
KINDVERSION=$(curl -s https://api.github.com/repos/kubernetes-sigs/kind/releases/latest | jq -r .tag_name)

# Print current versions from the Makefile and the latest versions
CURRGO=$(grep "go" go.mod | head -1 | awk '{print $2}')
echo "Golang version: $CURRGO -> $GOLANGVERSION"
CURRK8S=$(grep "ENVTEST_K8S_VERSION" Makefile | awk -F= '{print $2}' | grep -v '^$' | head -1)
echo "K8S_VERSION: $CURRK8S -> $ENVTEST_K8S_VERSION"
CURRKUST=$(grep "KUSTOMIZE_VERSION" Makefile | awk -F= '{print $2}' | grep -v '^$' | head -1)
echo "KUSTOMIZE_VERSION: $CURRKUST -> $KUSTOMIZE_VERSION"
CURRCT=$(grep "CONTROLLER_TOOLS_VERSION" Makefile | awk -F= '{print $2}' | grep -v '^$' | head -1)
echo "CONTROLLER_TOOLS_VERSION: $CURRCT -> $CONTROLLER_TOOLS_VERSION"
CURROPSDK=$(grep "OPERATOR_SDK_VERSION" Makefile | awk -F= '{print $2}' | grep -v '^$' | head -1)
echo "OPERATOR_SDK_VERSION: $CURROPSDK -> $OPSDKVERSION"
CURROLM=$(grep "OLM_VERSION" Makefile | awk -F= '{print $2}' | grep -v '^$' | head -1)
echo "OLM_VERSION: $CURROLM -> $OLMVER"
CURRKIND=$(grep "KIND_VERSION" Makefile | awk -F= '{print $2}' | grep -v '^$' | head -1)
echo "KIND_VERSION: $CURRKIND -> $KINDVERSION"

0 comments on commit fac21b5

Please sign in to comment.