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
versionmaker:
@echo "version maker"
# dependency to run gem pkg manger
sudo apt-get install rubygems
@echo "-----version maker-----"
bash ./scripts/version_maker.sh
.PHONY: push

View File

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