Skip to content

Commit

Permalink
Check if all files are encrypted before making a push
Browse files Browse the repository at this point in the history
  • Loading branch information
89luca89 committed Dec 8, 2016
1 parent 6a9e01f commit fc468d1
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions utils/checkin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,23 @@ args=$4
make_tenant=$5

# Check if files are already encrypted; if so, exit gracefully because there is nothing to do
status=`grep AES256 ~/.appflow/tenant/$tenant/$env/inventory > /dev/null; echo $?`
if [ $status -eq 0 ]; then
echo "Files are already encrpyted, nothing to do."
false;
exit 1;
fi
FILES=`find ~/.appflow/tenant/$tenant/$env/`
ENC=true
for f in $FILES; do
if [ -f $f ]; then
status=`grep AES256 $f > /dev/null; echo $?`
if [ $status -eq 0 ]; then
echo "Files are already encrpyted, nothing to do."
else
ENC=false
fi
fi
done
find ~/.appflow/tenant/$tenant/$env -type f -exec md5sum {} > /tmp/.appflow-$USER/$tenant/appflow-$env-md5-new \;
changed_files=`(diff /tmp/.appflow-$USER/$tenant/appflow-$env-md5 /tmp/.appflow-$USER/$tenant/appflow-$env-md5-new | cut -d " " -f 4 | grep "/" | sort | uniq )`
make encrypt tenant=$make_tenant env=$env
if [ $ENC == false ]; then
make encrypt tenant=$make_tenant env=$env
fi
echo $changed_files | tr ' ' '\n' | xargs git -C ~/.appflow/tenant/$tenant add
git -C ~/.appflow/tenant/$tenant commit -m "Auto commit"
git -C ~/.appflow/tenant/$tenant push
Expand Down

1 comment on commit fc468d1

@ivomarino
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@89luca89 we get an issue on atlantis with this script:
utils/checkin.sh: 28: [: false: unexpected operator

Please sign in to comment.