diff --git a/scripts/rcstack/rcstack b/scripts/rcstack/rcstack index 0e01aaa..08a4ef6 100755 --- a/scripts/rcstack/rcstack +++ b/scripts/rcstack/rcstack @@ -242,7 +242,7 @@ rcstack_init_usage() { # :flag.usage printf " %s\n" "--stage STAGE (repeatable)" - printf " specify one or more stages to run\n" + printf " specify one or more stages to run, e.g --force --stage\n bootstrap_v1_docker_install\n" echo # :flag.usage @@ -951,7 +951,7 @@ rcstack_cli_usage() { printf " %s run a custom command on top of docker image from RhodeCode\n" "cmd " printf " %s ishell attached to running RhodeCode instance\n" "ishell " printf " %s print out stored docker image version\n" "image-info " - printf " %s set version to .runtime.env file\n" "set-runtime-image " + printf " %s set version to .runtime.env file\n" "set-image " printf " %s get current docker info\n" "docker-info " printf " %s force upgrade docker\n" "docker-upgrade " printf " %s CLI for Redis\n" "redis " @@ -1111,13 +1111,50 @@ rcstack_cli_image_info_usage() { } # :command.usage -rcstack_cli_set_runtime_image_usage() { +rcstack_cli_set_image_usage() { if [[ -n $long_usage ]]; then - printf "rcstack cli set-runtime-image - set version to .runtime.env file\n" + printf "rcstack cli set-image - set version to .runtime.env file\n" echo else - printf "rcstack cli set-runtime-image - set version to .runtime.env file\n" + printf "rcstack cli set-image - set version to .runtime.env file\n" + echo + + fi + + printf "%s\n" "Usage:" + printf " rcstack cli set-image VERSION\n" + printf " rcstack cli set-image --help | -h\n" + echo + + # :command.long_usage + if [[ -n $long_usage ]]; then + printf "%s\n" "Options:" + + # :command.usage_fixed_flags + printf " %s\n" "--help, -h" + printf " Show this help\n" + echo + + # :command.usage_args + printf "%s\n" "Arguments:" + + # :argument.usage + printf " %s\n" "VERSION" + printf " Version of docker image to set e.g '5.0.0'\n" + echo + + fi +} + +# :command.usage +deprecated_cli_set_runtime_image_usage() { + if [[ -n $long_usage ]]; then + printf "rcstack cli set-runtime-image - DEPRECATED - use 'set-image' instead\n" + echo + + else + printf "rcstack cli set-runtime-image - DEPRECATED - use 'set-image' instead\n" echo fi @@ -1144,6 +1181,10 @@ rcstack_cli_set_runtime_image_usage() { printf " Version of docker image to set e.g '5.0.0'\n" echo + # :command.footer + printf "DEPRECATED - This command is deprecated, use 'set-image' instead\n" + echo + fi } @@ -4218,8 +4259,8 @@ rcstack_cli_image_info_command() { } # :command.function -rcstack_cli_set_runtime_image_command() { - # src/cli_set_runtime_image_command.sh +rcstack_cli_set_image_command() { + # src/cli_set_image_command.sh set_ver=${args[version]} .env --file $RUNTIME_ENV @@ -4228,6 +4269,13 @@ rcstack_cli_set_runtime_image_command() { .env set RC_VERSION=$set_ver echo "New version set to $set_ver" +} + +# :command.function +deprecated_cli_set_runtime_image_command() { + # src/cli_set_runtime_image_command.sh + echo "$(red DEPRECATED: Use 'cli set-image' instead)" >&2 + rcstack_cli_set_image_command "$@" } @@ -6533,10 +6581,17 @@ rcstack_cli_parse_requirements() { shift $# ;; + set-image) + action="set-image" + shift + rcstack_cli_set_image_parse_requirements "$@" + shift $# + ;; + set-runtime-image) action="set-runtime-image" shift - rcstack_cli_set_runtime_image_parse_requirements "$@" + deprecated_cli_set_runtime_image_parse_requirements "$@" shift $# ;; @@ -6868,13 +6923,69 @@ rcstack_cli_image_info_parse_requirements() { } # :command.parse_requirements -rcstack_cli_set_runtime_image_parse_requirements() { +rcstack_cli_set_image_parse_requirements() { + # :command.fixed_flags_filter + while [[ $# -gt 0 ]]; do + case "${1:-}" in + --help | -h) + long_usage=yes + rcstack_cli_set_image_usage + exit + ;; + + *) + break + ;; + + esac + done + + # :command.command_filter + action="cli set-image" + + # :command.parse_requirements_while + while [[ $# -gt 0 ]]; do + key="$1" + case "$key" in + + -?*) + printf "invalid option: %s\n" "$key" >&2 + exit 1 + ;; + + *) + # :command.parse_requirements_case + # :command.parse_requirements_case_simple + if [[ -z ${args['version']+x} ]]; then + + args['version']=$1 + shift + else + printf "invalid argument: %s\n" "$key" >&2 + exit 1 + fi + + ;; + + esac + done + + # :command.required_args_filter + if [[ -z ${args['version']+x} ]]; then + printf "missing required argument: VERSION\nusage: rcstack cli set-image VERSION\n" >&2 + exit 1 + fi + +} + +# :command.parse_requirements +deprecated_cli_set_runtime_image_parse_requirements() { # :command.fixed_flags_filter while [[ $# -gt 0 ]]; do case "${1:-}" in --help | -h) long_usage=yes - rcstack_cli_set_runtime_image_usage + deprecated_cli_set_runtime_image_usage exit ;; @@ -7766,7 +7877,7 @@ rcstack__completions_parse_requirements() { # :command.initialize initialize() { - version="5.12.0" + version="5.13.0" long_usage='' set -e @@ -7779,7 +7890,7 @@ initialize() { # src/initialize.sh - rc_image_ver=5.0.2 + rc_image_ver=5.0.3 rhodecode_default_config_path=config/_shared/rhodecode.ini vcsserver_default_config_path=config/_shared/vcsserver.ini @@ -7970,7 +8081,8 @@ run() { "cli cmd") rcstack_cli_cmd_command ;; "cli ishell") rcstack_cli_ishell_command ;; "cli image-info") rcstack_cli_image_info_command ;; - "cli set-runtime-image") rcstack_cli_set_runtime_image_command ;; + "cli set-image") rcstack_cli_set_image_command ;; + "cli set-runtime-image") deprecated_cli_set_runtime_image_command ;; "cli docker-info") rcstack_cli_docker_info_command ;; "cli docker-upgrade") rcstack_cli_docker_upgrade_command ;; "cli redis") rcstack_cli_redis_command ;; diff --git a/templates/runtime.env.tmpl b/templates/runtime.env.tmpl index 8907324..012eb17 100644 --- a/templates/runtime.env.tmpl +++ b/templates/runtime.env.tmpl @@ -4,7 +4,7 @@ TZ="UTC" # Version of docker image to deploy and run -# to set a custom version run ./rcstack cli set-runtime-image VER (e.g 5.0.0) +# to set a custom version run ./rcstack cli set-image VER (e.g 5.0.0) RC_VERSION=stable # Select RhodeCode edition ce (free community), or ee (paid/enterprise)