added check after eval

Signed-off-by: rajdas <mail.rajdas@gmail.com>
This commit is contained in:
rajdas
2019-09-26 13:12:47 +05:30
parent 4ce7befb70
commit 554751160f
2 changed files with 39 additions and 33 deletions

View File

@@ -3,9 +3,7 @@
.PHONY: versionmaker .PHONY: versionmaker
versionmaker: versionmaker:
@echo "version maker" @echo "-----version maker-----"
# dependency to run gem pkg manger
sudo apt-get install rubygems
bash ./scripts/version_maker.sh bash ./scripts/version_maker.sh
.PHONY: push .PHONY: push

View File

@@ -28,45 +28,53 @@ files=$(echo $FIND_CMD | tr " " "\n")
for file in $files for file in $files
do do
# get the latest version from the template file # get the latest version from the template file
eval $(yaml $file) eval $(yaml $file)
kind=$kind
# check if kind is chaosexperiment or ChartServiceVersion if [[ $? == 0 ]]; then
if [ $kind == "ChaosExperiment" ]; then
newversion=$metadata_version
elif [ $kind == "ChartServiceVersion" ]; then
newversion=$spec_version
fi
# if version is interger or float (semversion) kind=$kind
sudo python scripts/validate_version.py $newversion # check if kind is chaosexperiment or ChartServiceVersion
if [[ $kind == "ChaosExperiment" ]]; then
newversion=$metadata_version
elif [[ $kind == "ChartServiceVersion" ]]; then
newversion=$spec_version
fi
if [ $? == 0 ]; then echo $newversion
temp=$(echo ${file::-18}) # if version is interger or float (semversion)
if [ $kind == "ChartServiceVersion" ]; then sudo python scripts/validate_version.py $newversion
# echo $temp
oldversionfile=$temp'.yaml'
echo $oldversionfile
eval $(yaml $oldversionfile)
oldversion=$spec_version if [[ $? == 0 ]]; then
echo $oldversion temp=$(echo ${file::-18})
if [[ $kind == "ChartServiceVersion" ]]; then
# echo $temp
oldversionfile=$temp'.yaml'
echo $oldversionfile
eval $(yaml $oldversionfile)
`sed -i "s/[[:alnum:]]*$oldversion/$newversion/" $oldversionfile` echo $?
`sed -i -e "s/version:[[:space:]]*$oldversion/version: {{ VERSION }}/" $file` if [[ $? == 0 ]]; then
oldversion=$spec_version
echo $oldversion
elif [ $kind == "ChaosExperiment" ]; then `sed -i "s/$oldversion/$newversion/" $oldversionfile` &&
# echo $temp `sed -i "s/version:[[:space:]]*$newversion/version: {{ VERSION }}/" $file`
oldversionfile=$temp'.version.yaml' fi
echo $oldversionfile
eval $(yaml $oldversionfile)
oldversion=$metadata_version elif [ $kind == "ChaosExperiment" ]; then
echo $oldversion # echo $temp
oldversionfile=$temp'.version.yaml'
echo $oldversionfile
eval $(yaml $oldversionfile)
`sed -i "s/$oldversion/$newversion/" $oldversionfile` if [[ $? == 0 ]]; then
`sed -i "s/version:[[:space:]]*$oldversion/version: {{ VERSION }}/" $file` oldversion=$metadata_version
echo $oldversion
`sed -i "s/$oldversion/$newversion/" $oldversionfile`
`sed -i "s/version:[[:space:]]*$newversion/version: {{ VERSION }}/" $file`
fi
fi
fi fi
fi fi
done done