Add "recipe" commands, rejig vendoring, vendor jq
This commit is contained in:
parent
47efae4e6c
commit
8b60ece3d4
329
abra
329
abra
@ -5,7 +5,6 @@ ABRA_DIR="${ABRA_DIR:-$HOME/.abra}"
|
|||||||
ABRA_VERSION="0.6.0"
|
ABRA_VERSION="0.6.0"
|
||||||
ABRA_BACKUP_DIR="${ABRA_BACKUP_DIR:-$ABRA_DIR/backups}"
|
ABRA_BACKUP_DIR="${ABRA_BACKUP_DIR:-$ABRA_DIR/backups}"
|
||||||
ABRA_VENDOR_DIR="$ABRA_DIR/vendor"
|
ABRA_VENDOR_DIR="$ABRA_DIR/vendor"
|
||||||
YQ="$ABRA_VENDOR_DIR/yq"
|
|
||||||
ABRA_APPS_JSON="${ABRA_DIR}/apps.json"
|
ABRA_APPS_JSON="${ABRA_DIR}/apps.json"
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
@ -36,6 +35,8 @@ Usage:
|
|||||||
abra [options] app <app> secret (rm|delete) (<secret>|--all) [--pass]
|
abra [options] app <app> secret (rm|delete) (<secret>|--all) [--pass]
|
||||||
abra [options] app <app> undeploy
|
abra [options] app <app> undeploy
|
||||||
abra [options] app <app> <command> [<args>...]
|
abra [options] app <app> <command> [<args>...]
|
||||||
|
abra [options] recipe ls
|
||||||
|
abra [options] recipe <recipe> versions
|
||||||
abra [options] server add <host> [<user>] [<port>]
|
abra [options] server add <host> [<user>] [<port>]
|
||||||
abra [options] server new <provider>
|
abra [options] server new <provider>
|
||||||
abra [options] server (list|ls)
|
abra [options] server (list|ls)
|
||||||
@ -161,15 +162,15 @@ eval "var_$1+=($value)"; else eval "var_$1=$value"; fi; return 0; fi; done
|
|||||||
return 1; }; stdout() { printf -- "cat <<'EOM'\n%s\nEOM\n" "$1"; }; stderr() {
|
return 1; }; stdout() { printf -- "cat <<'EOM'\n%s\nEOM\n" "$1"; }; stderr() {
|
||||||
printf -- "cat <<'EOM' >&2\n%s\nEOM\n" "$1"; }; error() {
|
printf -- "cat <<'EOM' >&2\n%s\nEOM\n" "$1"; }; error() {
|
||||||
[[ -n $1 ]] && stderr "$1"; stderr "$usage"; _return 1; }; _return() {
|
[[ -n $1 ]] && stderr "$1"; stderr "$usage"; _return 1; }; _return() {
|
||||||
printf -- "exit %d\n" "$1"; exit "$1"; }; set -e; trimmed_doc=${DOC:1:2162}
|
printf -- "exit %d\n" "$1"; exit "$1"; }; set -e; trimmed_doc=${DOC:1:2231}
|
||||||
usage=${DOC:40:1553}; digest=b3855
|
usage=${DOC:40:1622}; digest=22c5b
|
||||||
shorts=(-n -b -s -v -h -C -U -d -e '' '' '' '' '' '' '' '' '' '' '' '' '' '' '')
|
shorts=(-h -b -n -s -e -d -C -v -U '' '' '' '' '' '' '' '' '' '' '' '' '' '' '')
|
||||||
longs=(--no-prompt --branch --stack --verbose --help --skip-check --skip-update --debug --env --status --server --type --domain --app-name --pass --secrets --all --update --force --skip-version-check --volumes --no-tty --user --dev)
|
longs=(--help --branch --no-prompt --stack --env --debug --skip-check --verbose --skip-update --status --server --type --domain --app-name --pass --secrets --all --update --force --skip-version-check --volumes --no-tty --user --dev)
|
||||||
argcounts=(0 1 1 0 0 0 0 0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 1 0); node_0(){
|
argcounts=(0 1 0 1 1 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 0); node_0(){
|
||||||
switch __no_prompt 0; }; node_1(){ value __branch 1; }; node_2(){
|
switch __help 0; }; node_1(){ value __branch 1; }; node_2(){
|
||||||
value __stack 2; }; node_3(){ switch __verbose 3; }; node_4(){ switch __help 4
|
switch __no_prompt 2; }; node_3(){ value __stack 3; }; node_4(){ value __env 4
|
||||||
}; node_5(){ switch __skip_check 5; }; node_6(){ switch __skip_update 6; }
|
}; node_5(){ switch __debug 5; }; node_6(){ switch __skip_check 6; }; node_7(){
|
||||||
node_7(){ switch __debug 7; }; node_8(){ value __env 8; }; node_9(){
|
switch __verbose 7; }; node_8(){ switch __skip_update 8; }; node_9(){
|
||||||
switch __status 9; }; node_10(){ value __server 10; }; node_11(){
|
switch __status 9; }; node_10(){ value __server 10; }; node_11(){
|
||||||
value __type 11; }; node_12(){ value __domain 12; }; node_13(){
|
value __type 11; }; node_12(){ value __domain 12; }; node_13(){
|
||||||
value __app_name 13; }; node_14(){ switch __pass 14; }; node_15(){
|
value __app_name 13; }; node_14(){ switch __pass 14; }; node_15(){
|
||||||
@ -182,68 +183,71 @@ value _service_ a; }; node_27(){ value _src_ a; }; node_28(){ value _dst_ a; }
|
|||||||
node_29(){ value _backup_file_ a; }; node_30(){ value _args_ a true; }
|
node_29(){ value _backup_file_ a; }; node_30(){ value _args_ a true; }
|
||||||
node_31(){ value _secret_ a; }; node_32(){ value _version_ a; }; node_33(){
|
node_31(){ value _secret_ a; }; node_32(){ value _version_ a; }; node_33(){
|
||||||
value _cmd_ a; }; node_34(){ value _data_ a; }; node_35(){ value _command_ a; }
|
value _cmd_ a; }; node_34(){ value _data_ a; }; node_35(){ value _command_ a; }
|
||||||
node_36(){ value _host_ a; }; node_37(){ value _user_ a; }; node_38(){
|
node_36(){ value _recipe_ a; }; node_37(){ value _host_ a; }; node_38(){
|
||||||
value _port_ a; }; node_39(){ value _provider_ a; }; node_40(){
|
value _user_ a; }; node_39(){ value _port_ a; }; node_40(){ value _provider_ a
|
||||||
value _subcommands_ a true; }; node_41(){ _command app; }; node_42(){
|
}; node_41(){ value _subcommands_ a true; }; node_42(){ _command app; }
|
||||||
_command list; }; node_43(){ _command ls; }; node_44(){ _command new; }
|
node_43(){ _command list; }; node_44(){ _command ls; }; node_45(){ _command new
|
||||||
node_45(){ _command backup; }; node_46(){ _command deploy; }; node_47(){
|
}; node_46(){ _command backup; }; node_47(){ _command deploy; }; node_48(){
|
||||||
_command check; }; node_48(){ _command version; }; node_49(){ _command config; }
|
_command check; }; node_49(){ _command version; }; node_50(){ _command config; }
|
||||||
node_50(){ _command cp; }; node_51(){ _command logs; }; node_52(){ _command ps
|
node_51(){ _command cp; }; node_52(){ _command logs; }; node_53(){ _command ps
|
||||||
}; node_53(){ _command restore; }; node_54(){ _command rm; }; node_55(){
|
}; node_54(){ _command restore; }; node_55(){ _command rm; }; node_56(){
|
||||||
_command delete; }; node_56(){ _command run; }; node_57(){ _command rollback; }
|
_command delete; }; node_57(){ _command run; }; node_58(){ _command rollback; }
|
||||||
node_58(){ _command secret; }; node_59(){ _command generate; }; node_60(){
|
node_59(){ _command secret; }; node_60(){ _command generate; }; node_61(){
|
||||||
_command insert; }; node_61(){ _command undeploy; }; node_62(){ _command server
|
_command insert; }; node_62(){ _command undeploy; }; node_63(){ _command recipe
|
||||||
}; node_63(){ _command add; }; node_64(){ _command init; }; node_65(){
|
}; node_64(){ _command versions; }; node_65(){ _command server; }; node_66(){
|
||||||
_command apps; }; node_66(){ _command upgrade; }; node_67(){ _command doctor; }
|
_command add; }; node_67(){ _command init; }; node_68(){ _command apps; }
|
||||||
node_68(){ _command help; }; node_69(){ optional 0 1 2 3 4 5 6 7 8; }
|
node_69(){ _command upgrade; }; node_70(){ _command doctor; }; node_71(){
|
||||||
node_70(){ optional 69; }; node_71(){ either 42 43; }; node_72(){ required 71; }
|
_command help; }; node_72(){ optional 0 1 2 3 4 5 6 7 8; }; node_73(){
|
||||||
node_73(){ optional 9; }; node_74(){ optional 10; }; node_75(){ optional 11; }
|
optional 72; }; node_74(){ either 43 44; }; node_75(){ required 74; }
|
||||||
node_76(){ required 70 41 72 73 74 75; }; node_77(){ optional 12; }; node_78(){
|
node_76(){ optional 9; }; node_77(){ optional 10; }; node_78(){ optional 11; }
|
||||||
optional 13; }; node_79(){ optional 14; }; node_80(){ optional 15; }; node_81(){
|
node_79(){ required 73 42 75 76 77 78; }; node_80(){ optional 12; }; node_81(){
|
||||||
required 70 41 44 74 77 78 79 80 24; }; node_82(){ either 26 16; }; node_83(){
|
optional 13; }; node_82(){ optional 14; }; node_83(){ optional 15; }; node_84(){
|
||||||
required 82; }; node_84(){ required 70 41 25 45 83; }; node_85(){ optional 17; }
|
required 73 42 45 77 80 81 82 83 24; }; node_85(){ either 26 16; }; node_86(){
|
||||||
node_86(){ optional 18; }; node_87(){ optional 19; }; node_88(){
|
required 85; }; node_87(){ required 73 42 25 46 86; }; node_88(){ optional 17; }
|
||||||
required 70 41 25 46 85 86 87; }; node_89(){ required 70 41 25 47; }; node_90(){
|
node_89(){ optional 18; }; node_90(){ optional 19; }; node_91(){
|
||||||
required 70 41 25 48; }; node_91(){ required 70 41 25 49; }; node_92(){
|
required 73 42 25 47 88 89 90; }; node_92(){ required 73 42 25 48; }; node_93(){
|
||||||
required 70 41 25 50 27 28; }; node_93(){ optional 26; }; node_94(){
|
required 73 42 25 49; }; node_94(){ required 73 42 25 50; }; node_95(){
|
||||||
required 70 41 25 51 93; }; node_95(){ required 70 41 25 52; }; node_96(){
|
required 73 42 25 51 27 28; }; node_96(){ optional 26; }; node_97(){
|
||||||
required 70 41 25 53 83; }; node_97(){ either 54 55; }; node_98(){ required 97
|
required 73 42 25 52 96; }; node_98(){ required 73 42 25 53; }; node_99(){
|
||||||
}; node_99(){ optional 20; }; node_100(){ required 70 41 25 98 99 80; }
|
required 73 42 25 54 86; }; node_100(){ either 55 56; }; node_101(){
|
||||||
node_101(){ optional 29; }; node_102(){ required 70 41 25 53 26 101; }
|
required 100; }; node_102(){ optional 20; }; node_103(){
|
||||||
node_103(){ optional 21; }; node_104(){ optional 22; }; node_105(){ oneormore 30
|
required 73 42 25 101 102 83; }; node_104(){ optional 29; }; node_105(){
|
||||||
}; node_106(){ required 70 41 25 56 103 104 26 105; }; node_107(){
|
required 73 42 25 54 26 104; }; node_106(){ optional 21; }; node_107(){
|
||||||
required 70 41 25 57 26; }; node_108(){ required 31 32; }; node_109(){
|
optional 22; }; node_108(){ oneormore 30; }; node_109(){
|
||||||
either 108 16; }; node_110(){ required 109; }; node_111(){ optional 33; }
|
required 73 42 25 57 106 107 26 108; }; node_110(){ required 73 42 25 58 26; }
|
||||||
node_112(){ required 70 41 25 58 59 110 111 79; }; node_113(){
|
node_111(){ required 31 32; }; node_112(){ either 111 16; }; node_113(){
|
||||||
required 70 41 25 58 60 31 32 34 79; }; node_114(){ either 31 16; }; node_115(){
|
required 112; }; node_114(){ optional 33; }; node_115(){
|
||||||
required 114; }; node_116(){ required 70 41 25 58 98 115 79; }; node_117(){
|
required 73 42 25 59 60 113 114 82; }; node_116(){
|
||||||
required 70 41 25 61; }; node_118(){ optional 105; }; node_119(){
|
required 73 42 25 59 61 31 32 34 82; }; node_117(){ either 31 16; }; node_118(){
|
||||||
required 70 41 25 35 118; }; node_120(){ optional 37; }; node_121(){ optional 38
|
required 117; }; node_119(){ required 73 42 25 59 101 118 82; }; node_120(){
|
||||||
}; node_122(){ required 70 62 63 36 120 121; }; node_123(){ required 70 62 44 39
|
required 73 42 25 62; }; node_121(){ optional 108; }; node_122(){
|
||||||
}; node_124(){ required 70 62 72; }; node_125(){ required 70 62 36 54; }
|
required 73 42 25 35 121; }; node_123(){ required 73 63 44; }; node_124(){
|
||||||
node_126(){ required 70 62 36 64; }; node_127(){ required 70 62 36 65 73; }
|
required 73 63 36 64; }; node_125(){ optional 38; }; node_126(){ optional 39; }
|
||||||
node_128(){ optional 23; }; node_129(){ required 70 66 128; }; node_130(){
|
node_127(){ required 73 65 66 37 125 126; }; node_128(){ required 73 65 45 40; }
|
||||||
required 70 48; }; node_131(){ required 70 67; }; node_132(){ oneormore 40; }
|
node_129(){ required 73 65 75; }; node_130(){ required 73 65 37 55; }
|
||||||
node_133(){ optional 132; }; node_134(){ required 70 68 133; }; node_135(){
|
node_131(){ required 73 65 37 67; }; node_132(){ required 73 65 37 68 76; }
|
||||||
required 70; }; node_136(){
|
node_133(){ optional 23; }; node_134(){ required 73 69 133; }; node_135(){
|
||||||
either 76 81 84 88 89 90 91 92 94 95 96 100 102 106 107 112 113 116 117 119 122 123 124 125 126 127 129 130 131 134 135
|
required 73 49; }; node_136(){ required 73 70; }; node_137(){ oneormore 41; }
|
||||||
}; node_137(){ required 136; }; cat <<<' docopt_exit() {
|
node_138(){ optional 137; }; node_139(){ required 73 71 138; }; node_140(){
|
||||||
[[ -n $1 ]] && printf "%s\n" "$1" >&2; printf "%s\n" "${DOC:40:1553}" >&2
|
required 73; }; node_141(){
|
||||||
exit 1; }'; unset var___no_prompt var___branch var___stack var___verbose \
|
either 79 84 87 91 92 93 94 95 97 98 99 103 105 109 110 115 116 119 120 122 123 124 127 128 129 130 131 132 134 135 136 139 140
|
||||||
var___help var___skip_check var___skip_update var___debug var___env \
|
}; node_142(){ required 141; }; cat <<<' docopt_exit() {
|
||||||
|
[[ -n $1 ]] && printf "%s\n" "$1" >&2; printf "%s\n" "${DOC:40:1622}" >&2
|
||||||
|
exit 1; }'; unset var___help var___branch var___no_prompt var___stack \
|
||||||
|
var___env var___debug var___skip_check var___verbose var___skip_update \
|
||||||
var___status var___server var___type var___domain var___app_name var___pass \
|
var___status var___server var___type var___domain var___app_name var___pass \
|
||||||
var___secrets var___all var___update var___force var___skip_version_check \
|
var___secrets var___all var___update var___force var___skip_version_check \
|
||||||
var___volumes var___no_tty var___user var___dev var__type_ var__app_ \
|
var___volumes var___no_tty var___user var___dev var__type_ var__app_ \
|
||||||
var__service_ var__src_ var__dst_ var__backup_file_ var__args_ var__secret_ \
|
var__service_ var__src_ var__dst_ var__backup_file_ var__args_ var__secret_ \
|
||||||
var__version_ var__cmd_ var__data_ var__command_ var__host_ var__user_ \
|
var__version_ var__cmd_ var__data_ var__command_ var__recipe_ var__host_ \
|
||||||
var__port_ var__provider_ var__subcommands_ var_app var_list var_ls var_new \
|
var__user_ var__port_ var__provider_ var__subcommands_ var_app var_list var_ls \
|
||||||
var_backup var_deploy var_check var_version var_config var_cp var_logs var_ps \
|
var_new var_backup var_deploy var_check var_version var_config var_cp var_logs \
|
||||||
var_restore var_rm var_delete var_run var_rollback var_secret var_generate \
|
var_ps var_restore var_rm var_delete var_run var_rollback var_secret \
|
||||||
var_insert var_undeploy var_server var_add var_init var_apps var_upgrade \
|
var_generate var_insert var_undeploy var_recipe var_versions var_server \
|
||||||
var_doctor var_help; parse 137 "$@"; local prefix=${DOCOPT_PREFIX:-''}
|
var_add var_init var_apps var_upgrade var_doctor var_help; parse 142 "$@"
|
||||||
unset "${prefix}__no_prompt" "${prefix}__branch" "${prefix}__stack" \
|
local prefix=${DOCOPT_PREFIX:-''}; unset "${prefix}__help" "${prefix}__branch" \
|
||||||
"${prefix}__verbose" "${prefix}__help" "${prefix}__skip_check" \
|
"${prefix}__no_prompt" "${prefix}__stack" "${prefix}__env" "${prefix}__debug" \
|
||||||
"${prefix}__skip_update" "${prefix}__debug" "${prefix}__env" \
|
"${prefix}__skip_check" "${prefix}__verbose" "${prefix}__skip_update" \
|
||||||
"${prefix}__status" "${prefix}__server" "${prefix}__type" "${prefix}__domain" \
|
"${prefix}__status" "${prefix}__server" "${prefix}__type" "${prefix}__domain" \
|
||||||
"${prefix}__app_name" "${prefix}__pass" "${prefix}__secrets" "${prefix}__all" \
|
"${prefix}__app_name" "${prefix}__pass" "${prefix}__secrets" "${prefix}__all" \
|
||||||
"${prefix}__update" "${prefix}__force" "${prefix}__skip_version_check" \
|
"${prefix}__update" "${prefix}__force" "${prefix}__skip_version_check" \
|
||||||
@ -251,24 +255,24 @@ unset "${prefix}__no_prompt" "${prefix}__branch" "${prefix}__stack" \
|
|||||||
"${prefix}_type_" "${prefix}_app_" "${prefix}_service_" "${prefix}_src_" \
|
"${prefix}_type_" "${prefix}_app_" "${prefix}_service_" "${prefix}_src_" \
|
||||||
"${prefix}_dst_" "${prefix}_backup_file_" "${prefix}_args_" \
|
"${prefix}_dst_" "${prefix}_backup_file_" "${prefix}_args_" \
|
||||||
"${prefix}_secret_" "${prefix}_version_" "${prefix}_cmd_" "${prefix}_data_" \
|
"${prefix}_secret_" "${prefix}_version_" "${prefix}_cmd_" "${prefix}_data_" \
|
||||||
"${prefix}_command_" "${prefix}_host_" "${prefix}_user_" "${prefix}_port_" \
|
"${prefix}_command_" "${prefix}_recipe_" "${prefix}_host_" "${prefix}_user_" \
|
||||||
"${prefix}_provider_" "${prefix}_subcommands_" "${prefix}app" "${prefix}list" \
|
"${prefix}_port_" "${prefix}_provider_" "${prefix}_subcommands_" \
|
||||||
"${prefix}ls" "${prefix}new" "${prefix}backup" "${prefix}deploy" \
|
"${prefix}app" "${prefix}list" "${prefix}ls" "${prefix}new" "${prefix}backup" \
|
||||||
"${prefix}check" "${prefix}version" "${prefix}config" "${prefix}cp" \
|
"${prefix}deploy" "${prefix}check" "${prefix}version" "${prefix}config" \
|
||||||
"${prefix}logs" "${prefix}ps" "${prefix}restore" "${prefix}rm" \
|
"${prefix}cp" "${prefix}logs" "${prefix}ps" "${prefix}restore" "${prefix}rm" \
|
||||||
"${prefix}delete" "${prefix}run" "${prefix}rollback" "${prefix}secret" \
|
"${prefix}delete" "${prefix}run" "${prefix}rollback" "${prefix}secret" \
|
||||||
"${prefix}generate" "${prefix}insert" "${prefix}undeploy" "${prefix}server" \
|
"${prefix}generate" "${prefix}insert" "${prefix}undeploy" "${prefix}recipe" \
|
||||||
"${prefix}add" "${prefix}init" "${prefix}apps" "${prefix}upgrade" \
|
"${prefix}versions" "${prefix}server" "${prefix}add" "${prefix}init" \
|
||||||
"${prefix}doctor" "${prefix}help"
|
"${prefix}apps" "${prefix}upgrade" "${prefix}doctor" "${prefix}help"
|
||||||
eval "${prefix}"'__no_prompt=${var___no_prompt:-false}'
|
|
||||||
eval "${prefix}"'__branch=${var___branch:-}'
|
|
||||||
eval "${prefix}"'__stack=${var___stack:-}'
|
|
||||||
eval "${prefix}"'__verbose=${var___verbose:-false}'
|
|
||||||
eval "${prefix}"'__help=${var___help:-false}'
|
eval "${prefix}"'__help=${var___help:-false}'
|
||||||
eval "${prefix}"'__skip_check=${var___skip_check:-false}'
|
eval "${prefix}"'__branch=${var___branch:-}'
|
||||||
eval "${prefix}"'__skip_update=${var___skip_update:-false}'
|
eval "${prefix}"'__no_prompt=${var___no_prompt:-false}'
|
||||||
eval "${prefix}"'__debug=${var___debug:-false}'
|
eval "${prefix}"'__stack=${var___stack:-}'
|
||||||
eval "${prefix}"'__env=${var___env:-}'
|
eval "${prefix}"'__env=${var___env:-}'
|
||||||
|
eval "${prefix}"'__debug=${var___debug:-false}'
|
||||||
|
eval "${prefix}"'__skip_check=${var___skip_check:-false}'
|
||||||
|
eval "${prefix}"'__verbose=${var___verbose:-false}'
|
||||||
|
eval "${prefix}"'__skip_update=${var___skip_update:-false}'
|
||||||
eval "${prefix}"'__status=${var___status:-false}'
|
eval "${prefix}"'__status=${var___status:-false}'
|
||||||
eval "${prefix}"'__server=${var___server:-}'
|
eval "${prefix}"'__server=${var___server:-}'
|
||||||
eval "${prefix}"'__type=${var___type:-}'
|
eval "${prefix}"'__type=${var___type:-}'
|
||||||
@ -294,6 +298,7 @@ fi; eval "${prefix}"'_secret_=${var__secret_:-}'
|
|||||||
eval "${prefix}"'_version_=${var__version_:-}'
|
eval "${prefix}"'_version_=${var__version_:-}'
|
||||||
eval "${prefix}"'_cmd_=${var__cmd_:-}'; eval "${prefix}"'_data_=${var__data_:-}'
|
eval "${prefix}"'_cmd_=${var__cmd_:-}'; eval "${prefix}"'_data_=${var__data_:-}'
|
||||||
eval "${prefix}"'_command_=${var__command_:-}'
|
eval "${prefix}"'_command_=${var__command_:-}'
|
||||||
|
eval "${prefix}"'_recipe_=${var__recipe_:-}'
|
||||||
eval "${prefix}"'_host_=${var__host_:-}'
|
eval "${prefix}"'_host_=${var__host_:-}'
|
||||||
eval "${prefix}"'_user_=${var__user_:-}'
|
eval "${prefix}"'_user_=${var__user_:-}'
|
||||||
eval "${prefix}"'_port_=${var__port_:-}'
|
eval "${prefix}"'_port_=${var__port_:-}'
|
||||||
@ -319,6 +324,8 @@ eval "${prefix}"'secret=${var_secret:-false}'
|
|||||||
eval "${prefix}"'generate=${var_generate:-false}'
|
eval "${prefix}"'generate=${var_generate:-false}'
|
||||||
eval "${prefix}"'insert=${var_insert:-false}'
|
eval "${prefix}"'insert=${var_insert:-false}'
|
||||||
eval "${prefix}"'undeploy=${var_undeploy:-false}'
|
eval "${prefix}"'undeploy=${var_undeploy:-false}'
|
||||||
|
eval "${prefix}"'recipe=${var_recipe:-false}'
|
||||||
|
eval "${prefix}"'versions=${var_versions:-false}'
|
||||||
eval "${prefix}"'server=${var_server:-false}'
|
eval "${prefix}"'server=${var_server:-false}'
|
||||||
eval "${prefix}"'add=${var_add:-false}'
|
eval "${prefix}"'add=${var_add:-false}'
|
||||||
eval "${prefix}"'init=${var_init:-false}'
|
eval "${prefix}"'init=${var_init:-false}'
|
||||||
@ -327,25 +334,25 @@ eval "${prefix}"'upgrade=${var_upgrade:-false}'
|
|||||||
eval "${prefix}"'doctor=${var_doctor:-false}'
|
eval "${prefix}"'doctor=${var_doctor:-false}'
|
||||||
eval "${prefix}"'help=${var_help:-false}'; local docopt_i=1
|
eval "${prefix}"'help=${var_help:-false}'; local docopt_i=1
|
||||||
[[ $BASH_VERSION =~ ^4.3 ]] && docopt_i=2; for ((;docopt_i>0;docopt_i--)); do
|
[[ $BASH_VERSION =~ ^4.3 ]] && docopt_i=2; for ((;docopt_i>0;docopt_i--)); do
|
||||||
declare -p "${prefix}__no_prompt" "${prefix}__branch" "${prefix}__stack" \
|
declare -p "${prefix}__help" "${prefix}__branch" "${prefix}__no_prompt" \
|
||||||
"${prefix}__verbose" "${prefix}__help" "${prefix}__skip_check" \
|
"${prefix}__stack" "${prefix}__env" "${prefix}__debug" "${prefix}__skip_check" \
|
||||||
"${prefix}__skip_update" "${prefix}__debug" "${prefix}__env" \
|
"${prefix}__verbose" "${prefix}__skip_update" "${prefix}__status" \
|
||||||
"${prefix}__status" "${prefix}__server" "${prefix}__type" "${prefix}__domain" \
|
"${prefix}__server" "${prefix}__type" "${prefix}__domain" \
|
||||||
"${prefix}__app_name" "${prefix}__pass" "${prefix}__secrets" "${prefix}__all" \
|
"${prefix}__app_name" "${prefix}__pass" "${prefix}__secrets" "${prefix}__all" \
|
||||||
"${prefix}__update" "${prefix}__force" "${prefix}__skip_version_check" \
|
"${prefix}__update" "${prefix}__force" "${prefix}__skip_version_check" \
|
||||||
"${prefix}__volumes" "${prefix}__no_tty" "${prefix}__user" "${prefix}__dev" \
|
"${prefix}__volumes" "${prefix}__no_tty" "${prefix}__user" "${prefix}__dev" \
|
||||||
"${prefix}_type_" "${prefix}_app_" "${prefix}_service_" "${prefix}_src_" \
|
"${prefix}_type_" "${prefix}_app_" "${prefix}_service_" "${prefix}_src_" \
|
||||||
"${prefix}_dst_" "${prefix}_backup_file_" "${prefix}_args_" \
|
"${prefix}_dst_" "${prefix}_backup_file_" "${prefix}_args_" \
|
||||||
"${prefix}_secret_" "${prefix}_version_" "${prefix}_cmd_" "${prefix}_data_" \
|
"${prefix}_secret_" "${prefix}_version_" "${prefix}_cmd_" "${prefix}_data_" \
|
||||||
"${prefix}_command_" "${prefix}_host_" "${prefix}_user_" "${prefix}_port_" \
|
"${prefix}_command_" "${prefix}_recipe_" "${prefix}_host_" "${prefix}_user_" \
|
||||||
"${prefix}_provider_" "${prefix}_subcommands_" "${prefix}app" "${prefix}list" \
|
"${prefix}_port_" "${prefix}_provider_" "${prefix}_subcommands_" \
|
||||||
"${prefix}ls" "${prefix}new" "${prefix}backup" "${prefix}deploy" \
|
"${prefix}app" "${prefix}list" "${prefix}ls" "${prefix}new" "${prefix}backup" \
|
||||||
"${prefix}check" "${prefix}version" "${prefix}config" "${prefix}cp" \
|
"${prefix}deploy" "${prefix}check" "${prefix}version" "${prefix}config" \
|
||||||
"${prefix}logs" "${prefix}ps" "${prefix}restore" "${prefix}rm" \
|
"${prefix}cp" "${prefix}logs" "${prefix}ps" "${prefix}restore" "${prefix}rm" \
|
||||||
"${prefix}delete" "${prefix}run" "${prefix}rollback" "${prefix}secret" \
|
"${prefix}delete" "${prefix}run" "${prefix}rollback" "${prefix}secret" \
|
||||||
"${prefix}generate" "${prefix}insert" "${prefix}undeploy" "${prefix}server" \
|
"${prefix}generate" "${prefix}insert" "${prefix}undeploy" "${prefix}recipe" \
|
||||||
"${prefix}add" "${prefix}init" "${prefix}apps" "${prefix}upgrade" \
|
"${prefix}versions" "${prefix}server" "${prefix}add" "${prefix}init" \
|
||||||
"${prefix}doctor" "${prefix}help"; done; }
|
"${prefix}apps" "${prefix}upgrade" "${prefix}doctor" "${prefix}help"; done; }
|
||||||
# docopt parser above, complete command for generating this parser is `docopt.sh abra`
|
# docopt parser above, complete command for generating this parser is `docopt.sh abra`
|
||||||
|
|
||||||
PROGRAM_NAME=$(basename "$0")
|
PROGRAM_NAME=$(basename "$0")
|
||||||
@ -435,6 +442,30 @@ require_consent_for_update() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require_docker_version (){
|
||||||
|
get_servers
|
||||||
|
|
||||||
|
MIN_DOCKER_VERSION=19
|
||||||
|
|
||||||
|
SERVERS+=("default")
|
||||||
|
|
||||||
|
for SERVER in "${SERVERS[@]}"; do
|
||||||
|
SERVER="${SERVER##*/}" # basename
|
||||||
|
host=$(docker context inspect "$SERVER" -f "{{.Endpoints.docker.Host}}" 2>/dev/null)
|
||||||
|
if [[ -n "$host" ]]; then
|
||||||
|
major_version=$(DOCKER_CONTEXT="$SERVER" docker version --format "{{.Server.Version}}" | cut -d'.' -f1 2>/dev/null)
|
||||||
|
if [[ "$major_version" -lt "$MIN_DOCKER_VERSION" ]]; then
|
||||||
|
error "This tool requires Docker v${MIN_DOCKER_VERSION} or greater. Please upgrade your Docker installation on $SERVER"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
debug "Docker version on $SERVER is sufficient (v${major_version})"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
###### Download and update data
|
||||||
|
|
||||||
require_apps_json() {
|
require_apps_json() {
|
||||||
# Ensure we have the latest copy of apps.json
|
# Ensure we have the latest copy of apps.json
|
||||||
apps_url="https://abra-apps.cloud.autonomic.zone"
|
apps_url="https://abra-apps.cloud.autonomic.zone"
|
||||||
@ -534,6 +565,10 @@ vendor_binary() {
|
|||||||
local BINARY="${REPO##*/}"
|
local BINARY="${REPO##*/}"
|
||||||
local RELEASE_URL="$REPO/releases/download/${VERSION}/${FILE}"
|
local RELEASE_URL="$REPO/releases/download/${VERSION}/${FILE}"
|
||||||
|
|
||||||
|
# Make the path to the binary available as a similarly-named variable, e.g.
|
||||||
|
# yq -> $YQ
|
||||||
|
export "${BINARY^^}=$ABRA_VENDOR_DIR/$BINARY"
|
||||||
|
|
||||||
if [ -f "$ABRA_DIR/vendor/$BINARY" ]; then
|
if [ -f "$ABRA_DIR/vendor/$BINARY" ]; then
|
||||||
debug "$BINARY is already vendored"
|
debug "$BINARY is already vendored"
|
||||||
return
|
return
|
||||||
@ -542,51 +577,44 @@ vendor_binary() {
|
|||||||
case $(uname -m) in
|
case $(uname -m) in
|
||||||
x86_64)
|
x86_64)
|
||||||
warning "Attempting to download the $BINARY binary from $RELEASE_URL into $ABRA_VENDOR_DIR"
|
warning "Attempting to download the $BINARY binary from $RELEASE_URL into $ABRA_VENDOR_DIR"
|
||||||
wget -qO "$ABRA_VENDOR_DIR/$BINARY" "$RELEASE_URL" && chmod +x "$ABRA_VENDOR_DIR/$BINARY"
|
|
||||||
success "$BINARY is now vendored ☮"
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
error "Unable to automatically vendor $BINARY, you'll have to manually manage this.\n
|
error "Unable to automatically vendor $BINARY, you'll have to manually manage this.\n
|
||||||
Please see $REPO and place the $BINARY binary in $ABRA_VENDOR_DIR."
|
Please see $REPO and place the $BINARY binary in $ABRA_VENDOR_DIR."
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
wget -qO "$ABRA_VENDOR_DIR/$BINARY" "$RELEASE_URL" && chmod +x "$ABRA_VENDOR_DIR/$BINARY"
|
||||||
|
success "$BINARY is now vendored ☮"
|
||||||
}
|
}
|
||||||
|
|
||||||
require_jq() {
|
require_jq() {
|
||||||
vendor_binary "https://github.com/stedolan/jq/" "jq-1.6" "jq-linux64"
|
vendor_binary "https://github.com/stedolan/jq" "jq-1.6" "jq-linux64"
|
||||||
}
|
}
|
||||||
|
|
||||||
require_yq() {
|
require_yq() {
|
||||||
vendor_binary "https://github.com/mikefarah/yq" "v4.6.1" "yq_linux_amd64"
|
vendor_binary "https://github.com/mikefarah/yq" "v4.6.1" "yq_linux_amd64"
|
||||||
}
|
}
|
||||||
|
|
||||||
require_docker_version (){
|
|
||||||
get_servers
|
|
||||||
|
|
||||||
MIN_DOCKER_VERSION=19
|
|
||||||
|
|
||||||
SERVERS+=("default")
|
|
||||||
|
|
||||||
for SERVER in "${SERVERS[@]}"; do
|
|
||||||
SERVER="${SERVER##*/}" # basename
|
|
||||||
host=$(docker context inspect "$SERVER" -f "{{.Endpoints.docker.Host}}" 2>/dev/null)
|
|
||||||
if [[ -n "$host" ]]; then
|
|
||||||
major_version=$(DOCKER_CONTEXT="$SERVER" docker version --format "{{.Server.Version}}" | cut -d'.' -f1 2>/dev/null)
|
|
||||||
if [[ "$major_version" -lt "$MIN_DOCKER_VERSION" ]]; then
|
|
||||||
error "This tool requires Docker v${MIN_DOCKER_VERSION} or greater. Please upgrade your Docker installation on $SERVER"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
debug "Docker version on $SERVER is sufficient (v${major_version})"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# FIXME 3wc: update or remove
|
# FIXME 3wc: update or remove
|
||||||
if [ -z "$ABRA_ENV" ] && [ -f .env ] && type direnv > /dev/null 2>&1 && ! direnv status | grep -q 'Found RC allowed true'; then
|
if [ -z "$ABRA_ENV" ] && [ -f .env ] && type direnv > /dev/null 2>&1 && ! direnv status | grep -q 'Found RC allowed true'; then
|
||||||
error "direnv is blocked, run direnv allow"
|
error "direnv is blocked, run direnv allow"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
###### Parse apps.json
|
||||||
|
|
||||||
|
get_recipes() {
|
||||||
|
require_jq
|
||||||
|
|
||||||
|
mapfile -t RECIPES < <($JQ -r ". | keys | .[]" "$ABRA_APPS_JSON" | sort)
|
||||||
|
}
|
||||||
|
|
||||||
|
get_recipe_versions() {
|
||||||
|
require_jq
|
||||||
|
|
||||||
|
mapfile -t RECIPE_VERSIONS < <($JQ -r ".${abra__recipe_}.versions | keys | .[]" "$ABRA_APPS_JSON" | sort)
|
||||||
|
}
|
||||||
|
|
||||||
###### Run-time loading
|
###### Run-time loading
|
||||||
|
|
||||||
load_abra_sh() {
|
load_abra_sh() {
|
||||||
@ -1196,13 +1224,14 @@ _abra_backup_mysql() {
|
|||||||
|
|
||||||
###### .. app deploy
|
###### .. app deploy
|
||||||
help_app_deploy (){
|
help_app_deploy (){
|
||||||
echo "abra [options] app <app> deploy [--update]
|
echo "abra [options] app <app> deploy [--update] [--force] [--skip-version-check]
|
||||||
|
|
||||||
Deploy app <app> to the configured server.
|
Deploy app <app> to the configured server.
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
--update Consent to deploying an updated app version
|
--update Consent to deploying an updated app version
|
||||||
--force Force a deployment regardless of state
|
--force Force a deployment regardless of state
|
||||||
|
--skip-version-check Don't try and detect deployed version
|
||||||
|
|
||||||
POWERED BY
|
POWERED BY
|
||||||
docker stack deploy -c compose.yml <app>"
|
docker stack deploy -c compose.yml <app>"
|
||||||
@ -1759,6 +1788,58 @@ sub_app_cp() {
|
|||||||
docker cp ${CP_ARGS}
|
docker cp ${CP_ARGS}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# abra recipe ..
|
||||||
|
#######################################
|
||||||
|
|
||||||
|
###### .. recipe ls
|
||||||
|
help_recipe_ls (){
|
||||||
|
help_recipe_list
|
||||||
|
}
|
||||||
|
|
||||||
|
sub_recipe_ls() {
|
||||||
|
sub_recipe_list
|
||||||
|
}
|
||||||
|
|
||||||
|
help_recipe_list() {
|
||||||
|
echo "abra [options] recipe (list|ls)
|
||||||
|
|
||||||
|
List all available recipes."
|
||||||
|
}
|
||||||
|
|
||||||
|
sub_recipe_list() {
|
||||||
|
get_recipes
|
||||||
|
|
||||||
|
printf "%s delicious recipes:\n" "${#RECIPES[@]}"
|
||||||
|
printf '%s\n' "${RECIPES[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
###### .. recipe <recipe> versions
|
||||||
|
|
||||||
|
help_recipe_versions() {
|
||||||
|
echo "abra [options] recipe versions
|
||||||
|
|
||||||
|
Show all available versions of <recipe>."
|
||||||
|
}
|
||||||
|
|
||||||
|
sub_recipe_versions() {
|
||||||
|
get_recipe_versions "$abra__recipe_"
|
||||||
|
|
||||||
|
printf "%s thrilling versions of $abra__recipe_:\n" "${#RECIPE_VERSIONS[@]}"
|
||||||
|
|
||||||
|
for version in "${RECIPE_VERSIONS[@]}"; do
|
||||||
|
recipe_version_data=$($JQ -r ".${abra__recipe_}.versions.\"${version}\"" "$ABRA_APPS_JSON")
|
||||||
|
mapfile -t services < <(echo "$recipe_version_data" | $JQ -r ". | keys | .[]" -)
|
||||||
|
printf '%s:\n' "$version"
|
||||||
|
for service in "${services[@]}"; do
|
||||||
|
image=$(echo "$recipe_version_data" | $JQ -r ".$service.image" -)
|
||||||
|
tag=$(echo "$recipe_version_data" | $JQ -r ".$service.tag" -)
|
||||||
|
digest=$(echo "$recipe_version_data" | $JQ -r ".$service.digest" -)
|
||||||
|
printf ' - %s (%s:%s, %s)\n' "$service" "$image" "$tag" "$digest"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# abra server ..
|
# abra server ..
|
||||||
#######################################
|
#######################################
|
||||||
@ -2046,7 +2127,7 @@ abra() {
|
|||||||
abra___skip_check abra__backup_file_ abra___verbose abra___debug \
|
abra___skip_check abra__backup_file_ abra___verbose abra___debug \
|
||||||
abra___help abra___branch abra___volumes abra__provider_ abra___type \
|
abra___help abra___branch abra___volumes abra__provider_ abra___type \
|
||||||
abra___dev abra___update abra___no_prompt abra___force \
|
abra___dev abra___update abra___no_prompt abra___force \
|
||||||
abra___skip_version_check
|
abra___skip_version_check abra__recipe_
|
||||||
|
|
||||||
if ! type tput > /dev/null 2>&1; then
|
if ! type tput > /dev/null 2>&1; then
|
||||||
tput() {
|
tput() {
|
||||||
|
Loading…
Reference in New Issue
Block a user