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 kind=$kind
elif [ $kind == "ChartServiceVersion" ]; then # check if kind is chaosexperiment or ChartServiceVersion
newversion=$spec_version if [[ $kind == "ChaosExperiment" ]]; then
fi newversion=$metadata_version
elif [[ $kind == "ChartServiceVersion" ]]; then
newversion=$spec_version
fi
# if version is interger or float (semversion) echo $newversion
sudo python scripts/validate_version.py $newversion # if version is interger or float (semversion)
sudo python scripts/validate_version.py $newversion
if [ $? == 0 ]; then if [[ $? == 0 ]]; then
temp=$(echo ${file::-18}) temp=$(echo ${file::-18})
if [ $kind == "ChartServiceVersion" ]; then if [[ $kind == "ChartServiceVersion" ]]; then
# echo $temp # echo $temp
oldversionfile=$temp'.yaml' oldversionfile=$temp'.yaml'
echo $oldversionfile echo $oldversionfile
eval $(yaml $oldversionfile) eval $(yaml $oldversionfile)
oldversion=$spec_version echo $?
echo $oldversion if [[ $? == 0 ]]; then
oldversion=$spec_version
echo $oldversion
`sed -i "s/[[:alnum:]]*$oldversion/$newversion/" $oldversionfile` `sed -i "s/$oldversion/$newversion/" $oldversionfile` &&
`sed -i -e "s/version:[[:space:]]*$oldversion/version: {{ VERSION }}/" $file` `sed -i "s/version:[[:space:]]*$newversion/version: {{ VERSION }}/" $file`
fi
elif [ $kind == "ChaosExperiment" ]; then elif [ $kind == "ChaosExperiment" ]; then
# echo $temp # echo $temp
oldversionfile=$temp'.version.yaml' oldversionfile=$temp'.version.yaml'
echo $oldversionfile echo $oldversionfile
eval $(yaml $oldversionfile) eval $(yaml $oldversionfile)
oldversion=$metadata_version if [[ $? == 0 ]]; then
echo $oldversion oldversion=$metadata_version
echo $oldversion
`sed -i "s/$oldversion/$newversion/" $oldversionfile` `sed -i "s/$oldversion/$newversion/" $oldversionfile`
`sed -i "s/version:[[:space:]]*$oldversion/version: {{ VERSION }}/" $file` `sed -i "s/version:[[:space:]]*$newversion/version: {{ VERSION }}/" $file`
fi
fi
fi fi
fi fi
done done