Add global --skip-check / --skip-update commands

This commit is contained in:
3wc 2021-01-01 18:56:38 +02:00
parent 9a17817cc8
commit a6e287977d
2 changed files with 13 additions and 12 deletions

View File

@ -15,6 +15,8 @@
- Use Docker-in-Docker (dind), and `dind-bats-kcov` Docker image, for `make test` ([1600b6277fbbffc4c6de1e4ba799c7bbe72ec6a0](https://git.autonomic.zone/coop-cloud/abra/commit/1600b6277fbbffc4c6de1e4ba799c7bbe72ec6a0))
- Add built-in documentation using `abra help <subcommand>...`, see [#50](https://git.autonomic.zone/coop-cloud/abra/issues/50)
- `version` subcommand [e6b24fe](https://git.autonomic.zone/coop-cloud/abra/commit/e6b24fe)
- Global `--skip-update` / `--skip-check` options to make things quicker,
[37e8b00](https://git.autonomic.zone/coop-cloud/abra/commit/37e8b00)
# abra 0.4.1 (2020-12-24)

23
abra
View File

@ -41,6 +41,8 @@ Options:
-e, --env=<path> Environment variables to load
-h, --help Show this message and exit
-s, --stack=<stack> Name of the target stack
-C, --skip-check Don't verify app variables
-U, --skip-update Don't pull latest app definitions
See 'abra help <subcommands>...' to read about a specific subcommand.
"
@ -349,7 +351,9 @@ require_app_latest() {
success "Fetched app configuration via Git"
fi
cd "$APP_DIR" && git pull > /dev/null 2>&1
if [ "$abra___skip_update" = "false" ]; then
cd "$APP_DIR" && git pull > /dev/null 2>&1
fi
}
# FIXME 3wc: update or remove
@ -678,9 +682,6 @@ help_app_deploy (){
Deploy app <domain> to the configured server.
OPTIONS
--skip-check Don't check whether app definition is up-to-date first
POWERED BY
docker stack deploy -c compose.yml <app>"
}
@ -691,10 +692,6 @@ sub_app_deploy (){
require_app_latest "$TYPE"
if [ "$abra___skip_check" == "false" ]; then
sub_app_check
fi
echo "About to deploy:"
echo " Server: $(tput setaf 4)${SERVER}$(tput sgr0)"
if [ "${COMPOSE_FILE/:/}" == "${COMPOSE_FILE}" ]; then
@ -797,12 +794,14 @@ Make sure that all an app's required variables are set."
}
sub_app_check (){
if [ "$abra___skip_check" = "true" ]; then
return 0
fi
load_instance
load_instance_env
#APP_ENV=$(grep -v '^#' "$ENV_FILE" | sed 's/^.* \([^=]\+\)=.*/\1/' | sort)
APP_ENV=$(grep -v '^#' "$ENV_FILE" | cut -d' ' -f2 | cut -d'=' -f1 | sort)
#STACK_ENV=$(grep -v '^#' "$APP_DIR/.env.sample" | sed 's/^.* \([^=]\+\)=.*/\1/' | sort)
STACK_ENV=$(grep -v '^#' "$APP_DIR/.env.sample" | cut -d' ' -f2 | cut -d'=' -f1 | sort)
# Only show "1", items in STACK_ENV which aren't in APP_ENV
@ -1357,8 +1356,8 @@ abra() {
abra__secret_ abra__version_ abra__data_ abra___user abra__host_ \
abra__type_ abra__port_ abra__user_ abra__service_ abra__src_ abra__dst_ \
abra___server abra___domain abra___force abra___pass \
abra___auto abra___status abra___no_tty abra___skip_check \
abra__subcommands_ abra___app_name
abra___auto abra___status abra___no_tty abra___app_name \
abra__subcommands_ abra___skip_update abra___skip_check
if ! type tput > /dev/null 2>&1; then
tput() {