diff --git a/abra b/abra index 6cea232..977e14a 100755 --- a/abra +++ b/abra @@ -430,6 +430,7 @@ require_app_latest() { debug "Using $APP_DIR" if [ "$abra___skip_update" = "false" ]; then + debug "Pulling latest '$APP' definition via git" (cd "$APP_DIR" && git pull > /dev/null 2>&1) fi } @@ -467,8 +468,6 @@ load_abra_sh() { fi if [ -n "$abra__app_" ]; then - load_instance - load_instance_env require_app_latest "$TYPE" fi @@ -809,9 +808,6 @@ sub_app_new (){ ###### .. app backup sub_app_backup (){ - load_instance - load_instance_env - require_app_latest "$TYPE" # Add _ if it's defined @@ -829,9 +825,6 @@ sub_app_backup (){ ###### .. app restore sub_app_restore (){ - load_instance - load_instance_env - require_app_latest "$TYPE" FUNCTION="abra_restore_$abra__service_" @@ -925,9 +918,6 @@ POWERED BY } sub_app_deploy (){ - load_instance - load_instance_env - require_app_latest "$TYPE" CONSENT_TO_UPDATE=$abra___update @@ -1014,9 +1004,6 @@ POWERED BY } sub_app_undeploy (){ - load_instance - load_instance_env - warning "About to un-deploy $STACK_NAME from $SERVER" prompt_confirm @@ -1031,8 +1018,6 @@ Open the app configuration in \$EDITOR." } sub_app_config (){ - load_instance - if [ -z "$EDITOR" ]; then warning "\$EDITOR not set; which text editor would you like to use?" @@ -1073,9 +1058,6 @@ sub_app_check (){ return 0 fi - load_instance - load_instance_env - APP_ENV=$(grep -v '^#' "$ENV_FILE" | cut -d' ' -f2 | cut -d'=' -f1 | sort -u) STACK_ENV=$(grep -v '^#' "$APP_DIR/.env.sample" | cut -d' ' -f2 | cut -d'=' -f1 | sort -u) @@ -1105,9 +1087,6 @@ POWERED BY } sub_app_ps (){ - load_instance - load_instance_env - docker stack ps "$STACK_NAME" } @@ -1133,9 +1112,6 @@ OPTIONS } sub_app_delete (){ - load_instance - load_instance_env - if [ "$abra___force" != "true" ]; then warning "About to delete $ENV_FILE" prompt_confirm @@ -1181,9 +1157,6 @@ OPTIONS --pass Save the secret in \`pass\` as well" } sub_app_secret_insert() { - load_instance - load_instance_env - SECRET="$abra__secret_" VERSION="$abra__version_" PW="$abra__data_" @@ -1223,9 +1196,6 @@ OPTIONS } sub_app_secret_delete(){ - load_instance - load_instance_env - # if --all is provided then $abra__secret_ will be blank and this will work # auto-magically NAMES=$(docker secret ls --filter "name=${STACK_NAME}_${abra__secret_}" --format "{{.Name}}") @@ -1266,9 +1236,6 @@ OPTIONS } sub_app_secret_generate(){ - load_instance - load_instance_env - SECRET="$abra__secret_" VERSION="$abra__version_" LENGTH="$abra__length_" @@ -1333,9 +1300,6 @@ POWERED BY } sub_app_run(){ - load_instance - load_instance_env - if [ -n "$abra___user" ]; then RUN_USER="-u $abra___user" fi @@ -1354,7 +1318,7 @@ sub_app_run(){ exit fi - debug "Using Container ID ${CONTAINER}" + debug "Using container ID ${CONTAINER}" # 3wc: we want the "splitting" that shellcheck warns us about, so that -u and # $RUN_USER aren't treated as a single argument: @@ -1378,9 +1342,6 @@ POWERED BY } sub_app_rollback(){ - load_instance - load_instance_env - SERVICE="${abra__service_}" docker service rollback "${STACK_NAME}_${SERVICE}" @@ -1404,9 +1365,6 @@ POWERED BY } sub_app_logs (){ - load_instance - load_instance_env - SERVICE="${abra__service_}" if [ -z "$SERVICE" ]; then @@ -1456,9 +1414,6 @@ POWERED BY } sub_app_cp() { - load_instance - load_instance_env - SOURCE="${abra__src_}" DEST="${abra__dst_}" @@ -1481,7 +1436,7 @@ sub_app_cp() { exit fi - debug "Using Container ID ${CONTAINER}" + debug "Using container ID ${CONTAINER}" # Replace $SERVICE with $CONTAINER in the original args CP_ARGS=$(echo "$SOURCE $DEST" | sed "s/$SERVICE:/$CONTAINER:/") @@ -1762,6 +1717,11 @@ abra() { set +a fi + if [ -n "$abra__app_" ]; then + load_instance + load_instance_env + fi + load_abra_sh # Search for sub_* functions, and check if any of them matches enabled