Skip to content

Instantly share code, notes, and snippets.

@simbo1905
Created April 12, 2019 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simbo1905/4562926d3d370b171b05364ed985612d to your computer and use it in GitHub Desktop.
Save simbo1905/4562926d3d370b171b05364ed985612d to your computer and use it in GitHub Desktop.
md5 hash secrets to detect when to bounce apps
#!/bin/bash
oc get secrets | md5sum > /tmp/secrets.md5
#!/bin/bash
SECRETS_MD5_OLD=$(</tmp/secrets.md5)
SECRETS_MD5_NEW=$(oc get secrets | md5sum)
if [ "$SECRETS_MD5_NEW" != "$SECRETS_MD5_OLD" ]; then
echo "secrets have changed. bouncing apps."
oc rollout latest dc/appone -n env-demo-staging
oc rollout latest dc/apptwo -n env-demo-staging
oc rollout latest dc/appthree -n env-demo-staging
else
echo "secrets have NOT changed."
fi
cowsay "Secrets all done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment