Guest User

Untitled

a guest
Feb 22nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. function aws-vault() {
  2. local aws_vault_cmd=$(which aws-vault)
  3.  
  4. if [ -z "${aws_vault_cmd}" ]; then
  5. echo "aws-vault is not on your path you do not have it installed"
  6. exit 1
  7. fi
  8. case "$1" in
  9. exec)
  10. local action=$1
  11. shift 1
  12. local profile=$1
  13. shift 1
  14. local options="--assume-role-ttl=1h --session-ttl=4h"
  15. #${aws_vault_cmd} ${action} ${profile} ${options} -- $@
  16. ${aws_vault_cmd} ${action} ${profile} ${options} $@
  17. ;;
  18. *)
  19. ${aws_vault_cmd} $@
  20. ;;
  21. esac
  22. }
  23.  
  24. # Nubis docker specific function
  25. function nubis-build() {
  26. if [ -z "${1}" ]; then echo "Usage: $FUNCNAME <docker image name>"; exit 1; fi
  27.  
  28. local docker_image=$1
  29. shift 1
  30. local args=$@
  31.  
  32. echo "Running on profile: $(cat ~/.docker.env | grep AWS_VAULT | cut -f2 -d "=")"
  33. docker_cmd="docker run -u "${UID}:$(id -g)" --interactive --tty --env-file $(echo ~)/.docker.env -v "$PWD:/nubis/data" -e "GIT_COMMIT_SHA=$(git rev-parse HEAD)""
  34. ${docker_cmd} ${docker_image} ${args} build
  35. # FIXME: won't be able to do other things like debug
  36. #if [ ! -z "${args}" ]; then
  37. # ${docker_cmd} ${docker_image} ${args} build
  38. #else
  39. # ${docker_cmd} ${docker_image}
  40. #fi
  41. }
  42.  
  43. # untested :)
  44. function nubis-deploy() {
  45. if [ -z "${1}" ]; then echo "Usage: $FUNCNAME <docker image name>"; exit 1; fi
  46.  
  47. local docker_image=$1
  48. shift 1
  49. local args=$@
  50. echo "Running on profile: $(cat ~/.docker.env | grep AWS_VAULT | cut -f2 -d "=")"
  51. docker run --interactive --tty --env-file $(echo ~)/.docker.env -v $PWD:/nubis/data ${docker_image} ${args}
  52.  
  53. }
Add Comment
Please, Sign In to add comment