Skip to content

Instantly share code, notes, and snippets.

@tkuchiki
Created November 12, 2015 11:36
Show Gist options
  • Save tkuchiki/f8d4ba7cffca974cd2a7 to your computer and use it in GitHub Desktop.
Save tkuchiki/f8d4ba7cffca974cd2a7 to your computer and use it in GitHub Desktop.
Stretcher の Rollback script
$ ./rollback_stretcher.sh
 1) deploy-20151112-191452.yml  14) deploy-20151029-215027.yml
 2) deploy-20151112-191236.yml  15) deploy-20151028-182546.yml
 3) deploy-20151112-190934.yml  16) deploy-20151028-175655.yml
 4) deploy-20151112-190820.yml  17) deploy-20151028-175201.yml
 5) deploy-20151112-190421.yml  18) deploy-20151028-174909.yml
 6) deploy-20151112-190254.yml  19) deploy-20151028-174155.yml
 7) deploy-20151112-190127.yml  20) deploy-20151028-171838.yml
 8) deploy-20151112-190018.yml  21) deploy-20151022-191616.yml
 9) deploy-20151112-185832.yml  22) deploy-20151022-143736.yml
10) deploy-20151112-185441.yml  23) deploy-20151022-143011.yml
11) deploy-20151112-185341.yml  24) deploy-20151022-142645.yml
12) deploy-20151112-185242.yml  25) deploy-20151022-141728.yml
13) deploy-20151110-162450.yml  26) deploy-20151022-140614.yml
Select manifest (quit q or Ctrl-C) : 1
Event ID: 7a5e80c5-27aa-973e-3328-b7093a91439f
#!/bin/bash
CONSUL_EVENT="deploy"
BUCKET="xxx-stretcher-files"
S3_BASE="s3://${BUCKET}"
MANIFESTS=$(aws s3 ls ${S3_BASE} --output text | grep \.yml$ | awk '{print $NF}' | sort | tac | tail -n +2)
PS3="Select manifest (quit q or Ctrl-C) : "
select M in $MANIFESTS; do
if [ "${REPLY}" = "q" ]; then
echo "Exit from system"
exit 0
fi
if [ -n "${M}" ]; then
ID=$(basename ${M} .yml)
MANIFEST="${S3_BASE}/${M}"
break
else
echo "Invalid number"
continue
fi
done
consul event -name "${CONSUL_EVENT}" "${MANIFEST}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment