From 81ebf9b924552d18e6d210869069764809f57ad9 Mon Sep 17 00:00:00 2001 From: Eamonn Mansour <47121388+eamansour@users.noreply.github.com> Date: Tue, 11 Jun 2024 14:49:37 +0100 Subject: [PATCH] Add set-version script for the ecosystem helm chart and bump to 0.34.1 (#32) * Add set-version script for the ecosystem helm chart Signed-off-by: Eamonn Mansour <47121388+eamansour@users.noreply.github.com> * Bump ecosystem chart to 0.34.1 Signed-off-by: Eamonn Mansour <47121388+eamansour@users.noreply.github.com> * Capture spaces Signed-off-by: Eamonn Mansour <47121388+eamansour@users.noreply.github.com> --------- Signed-off-by: Eamonn Mansour <47121388+eamansour@users.noreply.github.com> --- .gitignore | 4 +- charts/ecosystem/Chart.yaml | 2 +- charts/ecosystem/values.yaml | 2 +- set-version.sh | 104 +++++++++++++++++++++++++++++++++++ 4 files changed, 109 insertions(+), 3 deletions(-) create mode 100755 set-version.sh diff --git a/.gitignore b/.gitignore index 75ec3f0..612b3a5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -.vscode/* \ No newline at end of file +.DS_Store +.vscode/* +temp/ \ No newline at end of file diff --git a/charts/ecosystem/Chart.yaml b/charts/ecosystem/Chart.yaml index b23c51d..5331d54 100644 --- a/charts/ecosystem/Chart.yaml +++ b/charts/ecosystem/Chart.yaml @@ -11,4 +11,4 @@ type: application # home: "galasa.dev" # -version: "0.34.0" \ No newline at end of file +version: "0.34.1" \ No newline at end of file diff --git a/charts/ecosystem/values.yaml b/charts/ecosystem/values.yaml index cd59f2c..77d8f8b 100644 --- a/charts/ecosystem/values.yaml +++ b/charts/ecosystem/values.yaml @@ -13,7 +13,7 @@ externalHostname: "example.com" # The version of Galasa you want to run with, it is better that you do not use "latest" to ensure # all the components are running the same version and a controlled upgrade can be performed # -galasaVersion: "0.34.0" +galasaVersion: "0.34.1" # # # The container registry the Galasa images can be found in diff --git a/set-version.sh b/set-version.sh new file mode 100755 index 0000000..87c42f1 --- /dev/null +++ b/set-version.sh @@ -0,0 +1,104 @@ +#! /usr/bin/env bash + +# +# Copyright contributors to the Galasa project +# +# SPDX-License-Identifier: EPL-2.0 +# + +#----------------------------------------------------------------------------------------- +# +# Objectives: Sets the version number of this component. +# +# Environment variable over-rides: +# None +# +#----------------------------------------------------------------------------------------- + +# Where is this script executing from ? +BASEDIR=$(dirname "$0");pushd $BASEDIR 2>&1 >> /dev/null ;BASEDIR=$(pwd);popd 2>&1 >> /dev/null +export ORIGINAL_DIR=$(pwd) + +cd "${BASEDIR}/.." +WORKSPACE_DIR=$(pwd) + +#----------------------------------------------------------------------------------------- +# +# Set Colors +# +#----------------------------------------------------------------------------------------- +bold=$(tput bold) +underline=$(tput sgr 0 1) +reset=$(tput sgr0) +red=$(tput setaf 1) +green=$(tput setaf 76) +white=$(tput setaf 7) +tan=$(tput setaf 202) +blue=$(tput setaf 25) + +#----------------------------------------------------------------------------------------- +# +# Headers and Logging +# +#----------------------------------------------------------------------------------------- +underline() { printf "${underline}${bold}%s${reset}\n" "$@" ;} +h1() { printf "\n${underline}${bold}${blue}%s${reset}\n" "$@" ;} +h2() { printf "\n${underline}${bold}${white}%s${reset}\n" "$@" ;} +debug() { printf "${white}%s${reset}\n" "$@" ;} +info() { printf "${white}➜ %s${reset}\n" "$@" ;} +success() { printf "${green}✔ %s${reset}\n" "$@" ;} +error() { printf "${red}✖ %s${reset}\n" "$@" ;} +warn() { printf "${tan}➜ %s${reset}\n" "$@" ;} +bold() { printf "${bold}%s${reset}\n" "$@" ;} +note() { printf "\n${underline}${bold}${blue}Note:${reset} ${blue}%s${reset}\n" "$@" ;} + + +#----------------------------------------------------------------------------------------- +# Functions +#----------------------------------------------------------------------------------------- +function usage { + h1 "Syntax" + cat << EOF +set-version.sh [OPTIONS] +Options are: +-v | --version xxx : Mandatory. Set the ecosystem Helm chart's version number to something explicitly. + For example '--version 0.35.0' +EOF +} + +#----------------------------------------------------------------------------------------- +# Process parameters +#----------------------------------------------------------------------------------------- +component_version="" + +while [ "$1" != "" ]; do + case $1 in + -v | --version ) shift + export component_version=$1 + ;; + -h | --help ) usage + exit + ;; + * ) error "Unexpected argument $1" + usage + exit 1 + esac + shift +done + +if [[ -z $component_version ]]; then + error "Missing mandatory '--version' argument." + usage + exit 1 +fi + +temp_dir=$BASEDIR/temp/version_bump +mkdir -p $temp_dir + +# Ecosystem Chart.yaml +cat $BASEDIR/charts/ecosystem/Chart.yaml | sed "s/version:.*/version: \"$component_version\"/1" > $temp_dir/Chart.yaml +cp $temp_dir/Chart.yaml $BASEDIR/charts/ecosystem/Chart.yaml + +# Ecosystem values.yaml +cat $BASEDIR/charts/ecosystem/values.yaml | sed "s/galasaVersion:.*/galasaVersion: \"$component_version\"/1" > $temp_dir/values.yaml +cp $temp_dir/values.yaml $BASEDIR/charts/ecosystem/values.yaml