|
|
#!/usr/bin/env bash
|
|
|
# This script was generated by bashly 1.0.8 (https://bashly.dannyb.co)
|
|
|
# Modifying it manually is not recommended
|
|
|
|
|
|
# :wrapper.bash3_bouncer
|
|
|
if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then
|
|
|
printf "bash version 4 or higher is required\n" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
# :command.master_script
|
|
|
|
|
|
# :command.version_command
|
|
|
version_command() {
|
|
|
echo "$version"
|
|
|
}
|
|
|
|
|
|
# :command.usage
|
|
|
dev_tools_usage() {
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "dev-tools - CLI for various dev-tools operation on the stack\n"
|
|
|
echo
|
|
|
|
|
|
else
|
|
|
printf "dev-tools - CLI for various dev-tools operation on the stack\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
|
|
|
printf "%s\n" "Usage:"
|
|
|
printf " dev-tools COMMAND\n"
|
|
|
printf " dev-tools [COMMAND] --help | -h\n"
|
|
|
printf " dev-tools --version | -v\n"
|
|
|
echo
|
|
|
# :command.usage_commands
|
|
|
printf "%s\n" "dev-env Commands:"
|
|
|
printf " %s run bash console for vcsserver\n" "vcs "
|
|
|
printf " %s run bash console for rhodecode-ee\n" "ee "
|
|
|
printf " %s run bash console for rhodecode-ce\n" "ce "
|
|
|
printf " %s run bash console for rhodecode-celery\n" "celery "
|
|
|
printf " %s run celery instance on top of mounted source code, e.g ./dev-tools celeryd&\n" "celeryd "
|
|
|
printf " %s run bash console for rhodecode-ssh\n" "ssh "
|
|
|
printf " %s run sshd instance for rhodecode-ssh\n" "sshd "
|
|
|
printf " %s run bash console for rhodecode-ssh\n" "svn "
|
|
|
printf " %s run sshd instance for rhodecode-ssh\n" "svnd "
|
|
|
printf " %s run bash console for rhodecode-tools-ce\n" "tools "
|
|
|
printf " %s create dev env required to run vcsserver and rhodecode\n" "dev-env "
|
|
|
echo
|
|
|
printf "%s\n" "Cleanup Commands:"
|
|
|
printf " %s clears docker images\n" "prune "
|
|
|
printf " %s clears docker images and system cache, full cleanup. Be cautious !\n" "prune-all "
|
|
|
echo
|
|
|
printf "%s\n" "CLI generation Commands:"
|
|
|
printf " %s pull latest image of bashly\n" "cli-generate-pull "
|
|
|
printf " %s print out help about bashly\n" "cli-generate-help "
|
|
|
printf " %s set the version for rcstack\n" "stack-cli-version "
|
|
|
printf " %s run a ./rcstack generation script\n" "cli-generate-rc "
|
|
|
printf " %s run a ./dev-tools generation script\n" "cli-generate-dev "
|
|
|
echo
|
|
|
printf "%s\n" "Build Commands:"
|
|
|
printf " %s Fetch Artifacts to run installer based build\n" "get-build-artifacts"
|
|
|
printf " %s Build RhodeCode image from installer, ./dev-tools get-build-artifacts initially\n" "build-installer "
|
|
|
printf " %s Fetch RhodeCode sources, store in .source dir to run a source-based builds\n" "get-build-source "
|
|
|
printf " %s Build RhodeCode image from source, requires ./dev-tools get-build-source initially\n" "build-source "
|
|
|
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
|
|
|
printf " %s\n" "--version, -v"
|
|
|
printf " Show version number\n"
|
|
|
echo
|
|
|
|
|
|
# :command.footer
|
|
|
printf "RhodeCode Inc 2024\n\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
# :command.usage
|
|
|
dev_tools_vcs_usage() {
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "dev-tools vcs - run bash console for vcsserver\n"
|
|
|
echo
|
|
|
|
|
|
else
|
|
|
printf "dev-tools vcs - run bash console for vcsserver\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
|
|
|
printf "Alias: v\n"
|
|
|
echo
|
|
|
|
|
|
printf "%s\n" "Usage:"
|
|
|
printf " dev-tools vcs\n"
|
|
|
printf " dev-tools vcs --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
|
|
|
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
# :command.usage
|
|
|
dev_tools_ee_usage() {
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "dev-tools ee - run bash console for rhodecode-ee\n"
|
|
|
echo
|
|
|
|
|
|
else
|
|
|
printf "dev-tools ee - run bash console for rhodecode-ee\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
|
|
|
printf "Alias: e\n"
|
|
|
echo
|
|
|
|
|
|
printf "%s\n" "Usage:"
|
|
|
printf " dev-tools ee\n"
|
|
|
printf " dev-tools ee --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
|
|
|
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
# :command.usage
|
|
|
dev_tools_ce_usage() {
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "dev-tools ce - run bash console for rhodecode-ce\n"
|
|
|
echo
|
|
|
|
|
|
else
|
|
|
printf "dev-tools ce - run bash console for rhodecode-ce\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
|
|
|
printf "Alias: c\n"
|
|
|
echo
|
|
|
|
|
|
printf "%s\n" "Usage:"
|
|
|
printf " dev-tools ce\n"
|
|
|
printf " dev-tools ce --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
|
|
|
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
# :command.usage
|
|
|
dev_tools_celery_usage() {
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "dev-tools celery - run bash console for rhodecode-celery\n"
|
|
|
echo
|
|
|
|
|
|
else
|
|
|
printf "dev-tools celery - run bash console for rhodecode-celery\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
|
|
|
printf "%s\n" "Usage:"
|
|
|
printf " dev-tools celery [OPTIONS]\n"
|
|
|
printf " dev-tools celery --help | -h\n"
|
|
|
echo
|
|
|
|
|
|
# :command.long_usage
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "%s\n" "Options:"
|
|
|
|
|
|
# :command.usage_flags
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--workdir WORKDIR"
|
|
|
printf " workdir to run the pip install -e on top of can be ce or ee only\n"
|
|
|
printf " Default: /home/rhodecode/rhodecode-enterprise-ce\n"
|
|
|
echo
|
|
|
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--cmd CMD"
|
|
|
printf " cmd script to run, this is on host machine, relative to $WORKSPACE_HOME\n"
|
|
|
printf " Default: .dev-env/cmd-celery.sh\n"
|
|
|
echo
|
|
|
|
|
|
# :command.usage_fixed_flags
|
|
|
printf " %s\n" "--help, -h"
|
|
|
printf " Show this help\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
# :command.usage
|
|
|
dev_tools_celeryd_usage() {
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "dev-tools celeryd - run celery instance on top of mounted source code, e.g ./dev-tools celeryd&\n"
|
|
|
echo
|
|
|
|
|
|
else
|
|
|
printf "dev-tools celeryd - run celery instance on top of mounted source code, e.g ./dev-tools celeryd&\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
|
|
|
printf "%s\n" "Usage:"
|
|
|
printf " dev-tools celeryd [OPTIONS]\n"
|
|
|
printf " dev-tools celeryd --help | -h\n"
|
|
|
echo
|
|
|
|
|
|
# :command.long_usage
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "%s\n" "Options:"
|
|
|
|
|
|
# :command.usage_flags
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--workdir WORKDIR"
|
|
|
printf " workdir to run the pip install -e on top of can be ce or ee only\n"
|
|
|
printf " Default: /home/rhodecode/rhodecode-enterprise-ce\n"
|
|
|
echo
|
|
|
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--cmd CMD"
|
|
|
printf " cmd script to run, this is on host machine, relative to $WORKSPACE_HOME\n"
|
|
|
printf " Default: .dev-env/cmd-celeryd.sh\n"
|
|
|
echo
|
|
|
|
|
|
# :command.usage_fixed_flags
|
|
|
printf " %s\n" "--help, -h"
|
|
|
printf " Show this help\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
# :command.usage
|
|
|
dev_tools_ssh_usage() {
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "dev-tools ssh - run bash console for rhodecode-ssh\n"
|
|
|
echo
|
|
|
|
|
|
else
|
|
|
printf "dev-tools ssh - run bash console for rhodecode-ssh\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
|
|
|
printf "%s\n" "Usage:"
|
|
|
printf " dev-tools ssh [OPTIONS]\n"
|
|
|
printf " dev-tools ssh --help | -h\n"
|
|
|
echo
|
|
|
|
|
|
# :command.long_usage
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "%s\n" "Options:"
|
|
|
|
|
|
# :command.usage_flags
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--workdir WORKDIR"
|
|
|
printf " workdir to run the pip install -e on top of can be ce or ee only\n"
|
|
|
printf " Default: /home/rhodecode/rhodecode-enterprise-ce\n"
|
|
|
echo
|
|
|
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--cmd CMD"
|
|
|
printf " cmd script to run, this is on host machine, relative to $WORKSPACE_HOME\n"
|
|
|
printf " Default: .dev-env/cmd-ssh.sh\n"
|
|
|
echo
|
|
|
|
|
|
# :command.usage_fixed_flags
|
|
|
printf " %s\n" "--help, -h"
|
|
|
printf " Show this help\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
# :command.usage
|
|
|
dev_tools_sshd_usage() {
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "dev-tools sshd - run sshd instance for rhodecode-ssh\n"
|
|
|
echo
|
|
|
|
|
|
else
|
|
|
printf "dev-tools sshd - run sshd instance for rhodecode-ssh\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
|
|
|
printf "%s\n" "Usage:"
|
|
|
printf " dev-tools sshd [OPTIONS]\n"
|
|
|
printf " dev-tools sshd --help | -h\n"
|
|
|
echo
|
|
|
|
|
|
# :command.long_usage
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "%s\n" "Options:"
|
|
|
|
|
|
# :command.usage_flags
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--workdir WORKDIR"
|
|
|
printf " workdir to run the pip install -e on top of can be ce or ee only\n"
|
|
|
printf " Default: /home/rhodecode/rhodecode-enterprise-ce\n"
|
|
|
echo
|
|
|
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--cmd CMD"
|
|
|
printf " cmd script to run, this is on host machine, relative to $WORKSPACE_HOME\n"
|
|
|
printf " Default: .dev-env/cmd-sshd.sh\n"
|
|
|
echo
|
|
|
|
|
|
# :command.usage_fixed_flags
|
|
|
printf " %s\n" "--help, -h"
|
|
|
printf " Show this help\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
# :command.usage
|
|
|
dev_tools_svn_usage() {
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "dev-tools svn - run bash console for rhodecode-ssh\n"
|
|
|
echo
|
|
|
|
|
|
else
|
|
|
printf "dev-tools svn - run bash console for rhodecode-ssh\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
|
|
|
printf "%s\n" "Usage:"
|
|
|
printf " dev-tools svn [OPTIONS]\n"
|
|
|
printf " dev-tools svn --help | -h\n"
|
|
|
echo
|
|
|
|
|
|
# :command.long_usage
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "%s\n" "Options:"
|
|
|
|
|
|
# :command.usage_flags
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--workdir WORKDIR"
|
|
|
printf " workdir to run the pip install -e on top of can be ce or ee only\n"
|
|
|
printf " Default: /home/rhodecode/rhodecode-enterprise-ce\n"
|
|
|
echo
|
|
|
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--cmd CMD"
|
|
|
printf " cmd script to run, this is on host machine, relative to $WORKSPACE_HOME\n"
|
|
|
printf " Default: .dev-env/cmd-svn.sh\n"
|
|
|
echo
|
|
|
|
|
|
# :command.usage_fixed_flags
|
|
|
printf " %s\n" "--help, -h"
|
|
|
printf " Show this help\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
# :command.usage
|
|
|
dev_tools_svnd_usage() {
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "dev-tools svnd - run sshd instance for rhodecode-ssh\n"
|
|
|
echo
|
|
|
|
|
|
else
|
|
|
printf "dev-tools svnd - run sshd instance for rhodecode-ssh\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
|
|
|
printf "%s\n" "Usage:"
|
|
|
printf " dev-tools svnd [OPTIONS]\n"
|
|
|
printf " dev-tools svnd --help | -h\n"
|
|
|
echo
|
|
|
|
|
|
# :command.long_usage
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "%s\n" "Options:"
|
|
|
|
|
|
# :command.usage_flags
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--workdir WORKDIR"
|
|
|
printf " workdir to run the pip install -e on top of can be ce or ee only\n"
|
|
|
printf " Default: /home/rhodecode/rhodecode-enterprise-ce\n"
|
|
|
echo
|
|
|
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--cmd CMD"
|
|
|
printf " cmd script to run, this is on host machine, relative to $WORKSPACE_HOME\n"
|
|
|
printf " Default: .dev-env/cmd-svnd.sh\n"
|
|
|
echo
|
|
|
|
|
|
# :command.usage_fixed_flags
|
|
|
printf " %s\n" "--help, -h"
|
|
|
printf " Show this help\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
# :command.usage
|
|
|
dev_tools_tools_usage() {
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "dev-tools tools - run bash console for rhodecode-tools-ce\n"
|
|
|
echo
|
|
|
|
|
|
else
|
|
|
printf "dev-tools tools - run bash console for rhodecode-tools-ce\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
|
|
|
printf "Alias: t\n"
|
|
|
echo
|
|
|
|
|
|
printf "%s\n" "Usage:"
|
|
|
printf " dev-tools tools\n"
|
|
|
printf " dev-tools tools --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
|
|
|
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
# :command.usage
|
|
|
dev_tools_dev_env_usage() {
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "dev-tools dev-env - create dev env required to run vcsserver and rhodecode\n"
|
|
|
echo
|
|
|
|
|
|
else
|
|
|
printf "dev-tools dev-env - create dev env required to run vcsserver and rhodecode\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
|
|
|
printf "%s\n" "Usage:"
|
|
|
printf " dev-tools dev-env\n"
|
|
|
printf " dev-tools dev-env --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
|
|
|
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
# :command.usage
|
|
|
dev_tools_prune_usage() {
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "dev-tools prune - clears docker images\n"
|
|
|
echo
|
|
|
|
|
|
else
|
|
|
printf "dev-tools prune - clears docker images\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
|
|
|
printf "%s\n" "Usage:"
|
|
|
printf " dev-tools prune\n"
|
|
|
printf " dev-tools prune --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
|
|
|
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
# :command.usage
|
|
|
dev_tools_prune_all_usage() {
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "dev-tools prune-all - clears docker images and system cache, full cleanup. Be cautious !\n"
|
|
|
echo
|
|
|
|
|
|
else
|
|
|
printf "dev-tools prune-all - clears docker images and system cache, full cleanup. Be cautious !\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
|
|
|
printf "%s\n" "Usage:"
|
|
|
printf " dev-tools prune-all\n"
|
|
|
printf " dev-tools prune-all --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
|
|
|
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
# :command.usage
|
|
|
dev_tools_cli_generate_pull_usage() {
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "dev-tools cli-generate-pull - pull latest image of bashly\n"
|
|
|
echo
|
|
|
|
|
|
else
|
|
|
printf "dev-tools cli-generate-pull - pull latest image of bashly\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
|
|
|
printf "%s\n" "Usage:"
|
|
|
printf " dev-tools cli-generate-pull\n"
|
|
|
printf " dev-tools cli-generate-pull --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
|
|
|
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
# :command.usage
|
|
|
dev_tools_cli_generate_help_usage() {
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "dev-tools cli-generate-help - print out help about bashly\n"
|
|
|
echo
|
|
|
|
|
|
else
|
|
|
printf "dev-tools cli-generate-help - print out help about bashly\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
|
|
|
printf "%s\n" "Usage:"
|
|
|
printf " dev-tools cli-generate-help\n"
|
|
|
printf " dev-tools cli-generate-help --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
|
|
|
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
# :command.usage
|
|
|
dev_tools_stack_cli_version_usage() {
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "dev-tools stack-cli-version - set the version for rcstack\n"
|
|
|
echo
|
|
|
|
|
|
else
|
|
|
printf "dev-tools stack-cli-version - set the version for rcstack\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
|
|
|
printf "%s\n" "Usage:"
|
|
|
printf " dev-tools stack-cli-version VERSION\n"
|
|
|
printf " dev-tools stack-cli-version --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 to set e.g '5.0.0'\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
# :command.usage
|
|
|
dev_tools_cli_generate_rc_usage() {
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "dev-tools cli-generate-rc - run a ./rcstack generation script\n"
|
|
|
echo
|
|
|
|
|
|
else
|
|
|
printf "dev-tools cli-generate-rc - run a ./rcstack generation script\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
|
|
|
printf "%s\n" "Usage:"
|
|
|
printf " dev-tools cli-generate-rc [OPTIONS]\n"
|
|
|
printf " dev-tools cli-generate-rc --help | -h\n"
|
|
|
echo
|
|
|
|
|
|
# :command.long_usage
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "%s\n" "Options:"
|
|
|
|
|
|
# :command.usage_flags
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--one-time, -o"
|
|
|
printf " run the command a single time without watch\n"
|
|
|
echo
|
|
|
|
|
|
# :command.usage_fixed_flags
|
|
|
printf " %s\n" "--help, -h"
|
|
|
printf " Show this help\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
# :command.usage
|
|
|
dev_tools_cli_generate_dev_usage() {
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "dev-tools cli-generate-dev - run a ./dev-tools generation script\n"
|
|
|
echo
|
|
|
|
|
|
else
|
|
|
printf "dev-tools cli-generate-dev - run a ./dev-tools generation script\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
|
|
|
printf "%s\n" "Usage:"
|
|
|
printf " dev-tools cli-generate-dev [OPTIONS]\n"
|
|
|
printf " dev-tools cli-generate-dev --help | -h\n"
|
|
|
echo
|
|
|
|
|
|
# :command.long_usage
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "%s\n" "Options:"
|
|
|
|
|
|
# :command.usage_flags
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--one-time, -o"
|
|
|
printf " run the command a single time without watch\n"
|
|
|
echo
|
|
|
|
|
|
# :command.usage_fixed_flags
|
|
|
printf " %s\n" "--help, -h"
|
|
|
printf " Show this help\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
# :command.usage
|
|
|
dev_tools_get_build_artifacts_usage() {
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "dev-tools get-build-artifacts - Fetch Artifacts to run installer based build\n"
|
|
|
echo
|
|
|
|
|
|
else
|
|
|
printf "dev-tools get-build-artifacts - Fetch Artifacts to run installer based build\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
|
|
|
printf "%s\n" "Usage:"
|
|
|
printf " dev-tools get-build-artifacts [OPTIONS]\n"
|
|
|
printf " dev-tools get-build-artifacts --help | -h\n"
|
|
|
echo
|
|
|
|
|
|
# :command.long_usage
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "%s\n" "Options:"
|
|
|
|
|
|
# :command.usage_flags
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--auth AUTH"
|
|
|
printf " Specify custom auth for curl e.g -u admin:secret\n"
|
|
|
printf " Default: \n"
|
|
|
echo
|
|
|
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--installer-url INSTALLER_URL"
|
|
|
printf " Installer Download URL\n"
|
|
|
printf " Default: https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee\n"
|
|
|
echo
|
|
|
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--manifest-url MANIFEST_URL"
|
|
|
printf " Manifest file url\n"
|
|
|
printf " Default: https://dls.rhodecode.com/linux/MANIFEST\n"
|
|
|
echo
|
|
|
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--version-name VERSION_NAME"
|
|
|
printf " Specify custom build ver e.g 4.27.0\n"
|
|
|
printf " Default: $RC_CLI_VERSION_NAME\n"
|
|
|
echo
|
|
|
|
|
|
# :command.usage_fixed_flags
|
|
|
printf " %s\n" "--help, -h"
|
|
|
printf " Show this help\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
# :command.usage
|
|
|
dev_tools_build_installer_usage() {
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "dev-tools build-installer - Build RhodeCode image from installer, ./dev-tools get-build-artifacts initially\n"
|
|
|
echo
|
|
|
|
|
|
else
|
|
|
printf "dev-tools build-installer - Build RhodeCode image from installer, ./dev-tools get-build-artifacts initially\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
|
|
|
printf "%s\n" "Usage:"
|
|
|
printf " dev-tools build-installer [OPTIONS]\n"
|
|
|
printf " dev-tools build-installer --help | -h\n"
|
|
|
echo
|
|
|
|
|
|
# :command.long_usage
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "%s\n" "Options:"
|
|
|
|
|
|
# :command.usage_flags
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--version-name VERSION_NAME"
|
|
|
printf " Specify custom build ver e.g 4.27.0\n"
|
|
|
printf " Default: $RC_CLI_VERSION_NAME\n"
|
|
|
echo
|
|
|
|
|
|
# :command.usage_fixed_flags
|
|
|
printf " %s\n" "--help, -h"
|
|
|
printf " Show this help\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
# :command.usage
|
|
|
dev_tools_get_build_source_usage() {
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "dev-tools get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n"
|
|
|
echo
|
|
|
|
|
|
else
|
|
|
printf "dev-tools get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
|
|
|
printf "%s\n" "Usage:"
|
|
|
printf " dev-tools get-build-source [OPTIONS]\n"
|
|
|
printf " dev-tools get-build-source --help | -h\n"
|
|
|
echo
|
|
|
|
|
|
# :command.long_usage
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "%s\n" "Options:"
|
|
|
|
|
|
# :command.usage_flags
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--revision REVISION"
|
|
|
printf " revision to download\n"
|
|
|
printf " Default: default\n"
|
|
|
echo
|
|
|
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--auth-token AUTH_TOKEN"
|
|
|
printf " Specify AUTH TOKEN to obtain sources\n"
|
|
|
echo
|
|
|
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--server-url SERVER_URL"
|
|
|
printf " Specify RhodeCode server location where projects should be downloaded\n"
|
|
|
printf " Default: https://code.rhodecode.com\n"
|
|
|
echo
|
|
|
|
|
|
# :command.usage_fixed_flags
|
|
|
printf " %s\n" "--help, -h"
|
|
|
printf " Show this help\n"
|
|
|
echo
|
|
|
|
|
|
# :command.usage_examples
|
|
|
printf "%s\n" "Examples:"
|
|
|
printf " ./dev-tools get-sources $RC_CLI_VERSION_NAME\n"
|
|
|
printf " ./dev-tools get-sources default --auth-token xyxyxyx --server-url\n https://secret.repo/\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
# :command.usage
|
|
|
dev_tools_build_source_usage() {
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "dev-tools build-source - Build RhodeCode image from source, requires ./dev-tools get-build-source initially\n"
|
|
|
echo
|
|
|
|
|
|
else
|
|
|
printf "dev-tools build-source - Build RhodeCode image from source, requires ./dev-tools get-build-source initially\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
|
|
|
printf "%s\n" "Usage:"
|
|
|
printf " dev-tools build-source [OPTIONS]\n"
|
|
|
printf " dev-tools build-source --help | -h\n"
|
|
|
echo
|
|
|
|
|
|
# :command.long_usage
|
|
|
if [[ -n $long_usage ]]; then
|
|
|
printf "%s\n" "Options:"
|
|
|
|
|
|
# :command.usage_flags
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--version-name VERSION_NAME"
|
|
|
printf " Specify custom build ver e.g 4.27.0\n"
|
|
|
printf " Default: $RC_CLI_VERSION_NAME\n"
|
|
|
echo
|
|
|
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--source-build-yaml BUILD_SOURCE_YAML"
|
|
|
printf " yaml file to build source against\n"
|
|
|
printf " Default: build_yaml/docker-compose-apps.5.yaml\n"
|
|
|
echo
|
|
|
|
|
|
# :flag.usage
|
|
|
printf " %s\n" "--tag TAG (repeatable)"
|
|
|
printf " tag build image\n"
|
|
|
echo
|
|
|
|
|
|
# :command.usage_fixed_flags
|
|
|
printf " %s\n" "--help, -h"
|
|
|
printf " Show this help\n"
|
|
|
echo
|
|
|
|
|
|
# :command.usage_examples
|
|
|
printf "%s\n" "Examples:"
|
|
|
printf " ./dev-tools build-source --source-build-yaml\n build_yaml/docker-compose-apps.5.yaml --version-name 5.0.0.beta1 --tag beta\n"
|
|
|
printf " ./dev-tools build-source --source-build-yaml\n build_yaml/docker-compose-apps.4.yaml --version-name 4.28.0 --tag stable\n"
|
|
|
echo
|
|
|
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
# :command.normalize_input
|
|
|
normalize_input() {
|
|
|
local arg flags
|
|
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
arg="$1"
|
|
|
if [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then
|
|
|
input+=("${BASH_REMATCH[1]}")
|
|
|
input+=("${BASH_REMATCH[2]}")
|
|
|
elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then
|
|
|
input+=("${BASH_REMATCH[1]}")
|
|
|
input+=("${BASH_REMATCH[2]}")
|
|
|
elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then
|
|
|
flags="${BASH_REMATCH[1]}"
|
|
|
for ((i = 0; i < ${#flags}; i++)); do
|
|
|
input+=("-${flags:i:1}")
|
|
|
done
|
|
|
else
|
|
|
input+=("$arg")
|
|
|
fi
|
|
|
|
|
|
shift
|
|
|
done
|
|
|
}
|
|
|
# :command.inspect_args
|
|
|
inspect_args() {
|
|
|
if ((${#args[@]})); then
|
|
|
readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort)
|
|
|
echo args:
|
|
|
for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done
|
|
|
else
|
|
|
echo args: none
|
|
|
fi
|
|
|
|
|
|
if ((${#other_args[@]})); then
|
|
|
echo
|
|
|
echo other_args:
|
|
|
echo "- \${other_args[*]} = ${other_args[*]}"
|
|
|
for i in "${!other_args[@]}"; do
|
|
|
echo "- \${other_args[$i]} = ${other_args[$i]}"
|
|
|
done
|
|
|
fi
|
|
|
|
|
|
if ((${#deps[@]})); then
|
|
|
readarray -t sorted_keys < <(printf '%s\n' "${!deps[@]}" | sort)
|
|
|
echo
|
|
|
echo deps:
|
|
|
for k in "${sorted_keys[@]}"; do echo "- \${deps[$k]} = ${deps[$k]}"; done
|
|
|
fi
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.command_functions
|
|
|
# :command.function
|
|
|
dev_tools_vcs_command() {
|
|
|
# src/vcs_command.sh
|
|
|
container_name=dev-vcsserver
|
|
|
dev_env_file="/home/rhodecode/rhodecode-vcsserver/.dev/dev-env.sh"
|
|
|
env_file=".custom/.dev.env"
|
|
|
|
|
|
docker_id=$(docker ps -q --filter "name=$container_name")
|
|
|
|
|
|
if [[ $docker_id ]]; then
|
|
|
echo $container_name FOUND, Killing old one !
|
|
|
docker kill -s 9 $docker_id
|
|
|
sleep 5
|
|
|
docker rm -fv $container_name
|
|
|
echo "done..."
|
|
|
else
|
|
|
echo $container_name not found
|
|
|
# # bootstrap dev-env.sh
|
|
|
# if [[ ! -f $dev_env_file ]]; then
|
|
|
# echo "bootstrap of new dev-env file under $dev_env_file"
|
|
|
# fi
|
|
|
fi
|
|
|
|
|
|
if [[ -v WORKSPACE_HOME ]];
|
|
|
then
|
|
|
DEFAULT_WORKSPACE_HOME=$WORKSPACE_HOME
|
|
|
else
|
|
|
echo "WORKSPACE_HOME env var is not set"
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
|
|
|
|
|
|
eval "
|
|
|
WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME \
|
|
|
./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
|
|
|
run -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_sh \
|
|
|
--publish 10010:10010 --rm --use-aliases \
|
|
|
--workdir=\"/home/rhodecode/rhodecode-vcsserver\" \
|
|
|
--interactive --tty \
|
|
|
--name=\"$container_name\" vcsserver bash $dev_env_file"
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.function
|
|
|
dev_tools_ee_command() {
|
|
|
# src/ee_command.sh
|
|
|
container_name=dev-enterprise-ee
|
|
|
dev_env_file="/home/rhodecode/rhodecode-enterprise-ee/.dev/dev-env.sh"
|
|
|
env_file=".custom/.dev.env"
|
|
|
|
|
|
docker_id=$(docker ps -q --filter "name=$container_name")
|
|
|
|
|
|
if [[ $docker_id ]]; then
|
|
|
echo $container_name FOUND, Killing old one !
|
|
|
docker kill -s 9 $docker_id
|
|
|
sleep 5
|
|
|
docker rm -fv $container_name
|
|
|
echo "done..."
|
|
|
else
|
|
|
echo $container_name not found
|
|
|
# # bootstrap dev-env.sh
|
|
|
# if [[ ! -f $dev_env_file ]]; then
|
|
|
# echo "bootstrap of new dev-env file under $dev_env_file"
|
|
|
# fi
|
|
|
fi
|
|
|
|
|
|
if [[ -v WORKSPACE_HOME ]];
|
|
|
then
|
|
|
DEFAULT_WORKSPACE_HOME=$WORKSPACE_HOME
|
|
|
else
|
|
|
echo "WORKSPACE_HOME env var is not set"
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
|
|
|
|
|
|
eval "
|
|
|
WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME \
|
|
|
./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
|
|
|
run -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_sh --rm --use-aliases \
|
|
|
--publish 10020:10020 --rm --use-aliases \
|
|
|
--workdir=\"/home/rhodecode/rhodecode-enterprise-ee\" \
|
|
|
--interactive --tty \
|
|
|
--name=\"$container_name\" rhodecode bash $dev_env_file"
|
|
|
}
|
|
|
|
|
|
# :command.function
|
|
|
dev_tools_ce_command() {
|
|
|
# src/ce_command.sh
|
|
|
container_name=dev-enterprise-ce
|
|
|
dev_env_file="/home/rhodecode/rhodecode-enterprise-ce/.dev/dev-env.sh"
|
|
|
env_file=".custom/.dev.env"
|
|
|
|
|
|
docker_id=$(docker ps -q --filter "name=$container_name")
|
|
|
|
|
|
if [[ $docker_id ]]; then
|
|
|
echo $container_name FOUND, Killing old one !
|
|
|
docker kill -s 9 $docker_id
|
|
|
sleep 5
|
|
|
docker rm -fv $container_name
|
|
|
echo "done..."
|
|
|
else
|
|
|
echo $container_name not found
|
|
|
# # bootstrap dev-env.sh
|
|
|
# if [[ ! -f $dev_env_file ]]; then
|
|
|
# echo "bootstrap of new dev-env file under $dev_env_file"
|
|
|
# fi
|
|
|
fi
|
|
|
|
|
|
if [[ -v WORKSPACE_HOME ]];
|
|
|
then
|
|
|
DEFAULT_WORKSPACE_HOME=$WORKSPACE_HOME
|
|
|
else
|
|
|
echo "WORKSPACE_HOME env var is not set"
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
|
|
|
|
|
|
eval "
|
|
|
WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME \
|
|
|
./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
|
|
|
run -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_sh --rm --use-aliases \
|
|
|
--publish 10020:10020 --rm --use-aliases \
|
|
|
--workdir=\"/home/rhodecode/rhodecode-enterprise-ce\" \
|
|
|
--interactive --tty \
|
|
|
--name=\"$container_name\" rhodecode bash $dev_env_file"
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.function
|
|
|
dev_tools_celery_command() {
|
|
|
# src/celery_command.sh
|
|
|
if [[ -v WORKSPACE_HOME ]];
|
|
|
then
|
|
|
DEFAULT_WORKSPACE_HOME=$WORKSPACE_HOME
|
|
|
echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
|
|
|
else
|
|
|
echo "WORKSPACE_HOME env var is not set"
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
code_workdir=${args[--workdir]}
|
|
|
cmd_script=${args[--cmd]}
|
|
|
|
|
|
exec_script=$WORKSPACE_HOME/$cmd_script
|
|
|
container_name=dev-celery
|
|
|
env_file=".custom/.dev.env"
|
|
|
|
|
|
echo "Using exec script: $exec_script"
|
|
|
|
|
|
RC_DEV_CMD_HELP="celery --no-color --app=rhodecode.lib.celerylib.loader worker --autoscale=4,2 --max-tasks-per-child=100 --task-events --loglevel=DEBUG --ini=.dev/dev.ini"
|
|
|
|
|
|
if [[ ! -f $exec_script ]]; then
|
|
|
echo "Generating new $exec_script file..."
|
|
|
mkdir -p $(dirname $exec_script)
|
|
|
|
|
|
cat <<< "
|
|
|
# Generated dev-env script for celery
|
|
|
|
|
|
echo \"Run celery dev using the following command:\"
|
|
|
echo \"++++++++++++++++++++++++++++++++++++++++++++++++++\"
|
|
|
echo \"$RC_DEV_CMD_HELP\"
|
|
|
echo \"++++++++++++++++++++++++++++++++++++++++++++++++++\"
|
|
|
make sh
|
|
|
" > $exec_script
|
|
|
chmod +x $exec_script
|
|
|
fi
|
|
|
|
|
|
docker_exec_script="/var/opt/rhodecode_repo_store/$cmd_script"
|
|
|
|
|
|
docker_id=$(docker ps -q --filter "name=$container_name" --filter name="rc_cluster_apps-celery")
|
|
|
|
|
|
if [[ $docker_id ]]; then
|
|
|
echo $container_name FOUND, Killing old one !
|
|
|
docker kill -s 9 $docker_id
|
|
|
sleep 5
|
|
|
docker rm -fv $container_name
|
|
|
echo "done..."
|
|
|
else
|
|
|
echo $container_name not found
|
|
|
fi
|
|
|
|
|
|
eval "
|
|
|
WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME RC_DEV_CMD_HELP=\"$RC_DEV_CMD_HELP\" \
|
|
|
./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
|
|
|
run -e RC_DEV_CMD_HELP=\"'$RC_DEV_CMD_HELP'\" -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_$container_name --rm --use-aliases \
|
|
|
--workdir=\"$code_workdir\" \
|
|
|
--name=\"$container_name\" \
|
|
|
--interactive --tty \
|
|
|
rhodecode bash $docker_exec_script"
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.function
|
|
|
dev_tools_celeryd_command() {
|
|
|
# src/celeryd_command.sh
|
|
|
if [[ -v WORKSPACE_HOME ]];
|
|
|
then
|
|
|
DEFAULT_WORKSPACE_HOME=$WORKSPACE_HOME
|
|
|
echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
|
|
|
else
|
|
|
echo "WORKSPACE_HOME env var is not set"
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
code_workdir=${args[--workdir]}
|
|
|
cmd_script=${args[--cmd]}
|
|
|
|
|
|
exec_script=$WORKSPACE_HOME/$cmd_script
|
|
|
container_name=dev-celeryd
|
|
|
env_file=".custom/.dev.env"
|
|
|
|
|
|
echo "Using exec script: $exec_script"
|
|
|
|
|
|
RC_DEV_CMD_HELP=""
|
|
|
|
|
|
if [[ ! -f $exec_script ]]; then
|
|
|
echo "Generating new $exec_script file..."
|
|
|
mkdir -p $(dirname $exec_script)
|
|
|
|
|
|
cat <<< "
|
|
|
# Generated dev-env script for celeryd
|
|
|
|
|
|
echo \"Run celery dev using the following command:\"
|
|
|
make dev-env && celery --no-color --app=rhodecode.lib.celerylib.loader worker --autoscale=4,2 --max-tasks-per-child=100 --task-events --loglevel=DEBUG --ini=.dev/dev.ini
|
|
|
" > $exec_script
|
|
|
chmod +x $exec_script
|
|
|
fi
|
|
|
|
|
|
docker_exec_script="/var/opt/rhodecode_repo_store/$cmd_script"
|
|
|
|
|
|
docker_id=$(docker ps -q --filter "name=$container_name" --filter name="rc_cluster_apps-celery")
|
|
|
|
|
|
if [[ $docker_id ]]; then
|
|
|
echo $container_name FOUND, Killing old one !
|
|
|
docker kill -s 9 $docker_id
|
|
|
sleep 5
|
|
|
docker rm -fv $container_name
|
|
|
echo "done..."
|
|
|
else
|
|
|
echo $container_name not found
|
|
|
fi
|
|
|
|
|
|
eval "
|
|
|
WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME RC_DEV_CMD_HELP=\"$RC_DEV_CMD_HELP\" \
|
|
|
./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
|
|
|
run -e RC_DEV_CMD_HELP=\"'$RC_DEV_CMD_HELP'\" -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_$container_name --rm --use-aliases \
|
|
|
--workdir=\"$code_workdir\" \
|
|
|
--name=\"$container_name\" \
|
|
|
--detach \
|
|
|
rhodecode $docker_exec_script"
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.function
|
|
|
dev_tools_ssh_command() {
|
|
|
# src/ssh_command.sh
|
|
|
if [[ -v WORKSPACE_HOME ]];
|
|
|
then
|
|
|
DEFAULT_WORKSPACE_HOME=$WORKSPACE_HOME
|
|
|
echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
|
|
|
else
|
|
|
echo "WORKSPACE_HOME env var is not set"
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
code_workdir=${args[--workdir]}
|
|
|
cmd_script=${args[--cmd]}
|
|
|
|
|
|
exec_script=$WORKSPACE_HOME/$cmd_script
|
|
|
container_name=dev-ssh
|
|
|
env_file=".custom/.dev.env"
|
|
|
|
|
|
echo "Using exec script: $exec_script"
|
|
|
|
|
|
RC_DEV_CMD_HELP="mkdir -p /run/sshd && /usr/sbin/sshd -f /etc/rhodecode/sshd_config -D -e"
|
|
|
|
|
|
if [[ ! -f $exec_script ]]; then
|
|
|
echo "Generating new $exec_script file..."
|
|
|
mkdir -p $(dirname $exec_script)
|
|
|
|
|
|
cat <<< "
|
|
|
# Generated dev-env script for ssh
|
|
|
|
|
|
echo \"Run ssh dev using the following command:\"
|
|
|
echo \"++++++++++++++++++++++++++++++++++++++++++++++++++\"
|
|
|
echo \"$RC_DEV_CMD_HELP\"
|
|
|
echo \"++++++++++++++++++++++++++++++++++++++++++++++++++\"
|
|
|
make sh
|
|
|
" > $exec_script
|
|
|
chmod +x $exec_script
|
|
|
fi
|
|
|
|
|
|
docker_exec_script="/var/opt/rhodecode_repo_store/$cmd_script"
|
|
|
|
|
|
docker_id=$(docker ps -q --filter "name=$container_name" --filter name="rc_cluster_apps-sshd")
|
|
|
|
|
|
if [[ $docker_id ]]; then
|
|
|
echo $container_name FOUND, Killing old one !
|
|
|
docker kill -s 9 $docker_id
|
|
|
sleep 5
|
|
|
docker rm -fv $container_name
|
|
|
echo "done..."
|
|
|
else
|
|
|
echo $container_name not found
|
|
|
fi
|
|
|
|
|
|
RC_SSH_PORT=9022
|
|
|
|
|
|
eval "
|
|
|
WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME RC_DEV_CMD_HELP=\"$RC_DEV_CMD_HELP\" \
|
|
|
./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
|
|
|
run -e RC_DEV_CMD_HELP=\"'$RC_DEV_CMD_HELP'\" -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_$container_name --rm --use-aliases \
|
|
|
--workdir=\"$code_workdir\" \
|
|
|
--name=\"$container_name\" \
|
|
|
--interactive --tty \
|
|
|
--publish $RC_SSH_PORT:$RC_SSH_PORT \
|
|
|
sshd bash $docker_exec_script"
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.function
|
|
|
dev_tools_sshd_command() {
|
|
|
# src/sshd_command.sh
|
|
|
if [[ -v WORKSPACE_HOME ]];
|
|
|
then
|
|
|
DEFAULT_WORKSPACE_HOME=$WORKSPACE_HOME
|
|
|
echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
|
|
|
else
|
|
|
echo "WORKSPACE_HOME env var is not set"
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
code_workdir=${args[--workdir]}
|
|
|
cmd_script=${args[--cmd]}
|
|
|
|
|
|
exec_script=$WORKSPACE_HOME/$cmd_script
|
|
|
container_name=dev-sshd
|
|
|
env_file=".custom/.dev.env"
|
|
|
|
|
|
echo "Using exec script: $exec_script"
|
|
|
|
|
|
RC_DEV_CMD_HELP=""
|
|
|
|
|
|
if [[ ! -f $exec_script ]]; then
|
|
|
echo "Generating new $exec_script file..."
|
|
|
mkdir -p $(dirname $exec_script)
|
|
|
|
|
|
cat <<< "
|
|
|
# Generated dev-env script for ssh
|
|
|
|
|
|
echo \"Run ssh dev using the following command:\"
|
|
|
make dev-env && mkdir -p /run/sshd && /usr/sbin/sshd -f /etc/rhodecode/sshd_config -D -e
|
|
|
" > $exec_script
|
|
|
chmod +x $exec_script
|
|
|
fi
|
|
|
|
|
|
docker_exec_script="/var/opt/rhodecode_repo_store/$cmd_script"
|
|
|
|
|
|
docker_id=$(docker ps -q --filter "name=$container_name" --filter name="rc_cluster_apps-sshd")
|
|
|
|
|
|
if [[ $docker_id ]]; then
|
|
|
echo $container_name FOUND, Killing old one !
|
|
|
docker kill -s 9 $docker_id
|
|
|
sleep 5
|
|
|
docker rm -fv $container_name
|
|
|
echo "done..."
|
|
|
else
|
|
|
echo $container_name not found
|
|
|
fi
|
|
|
|
|
|
RC_SSH_PORT=9022
|
|
|
|
|
|
eval "
|
|
|
WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME RC_DEV_CMD_HELP=\"$RC_DEV_CMD_HELP\" \
|
|
|
./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
|
|
|
run -e RC_DEV_CMD_HELP=\"'$RC_DEV_CMD_HELP'\" -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_$container_name --rm --use-aliases \
|
|
|
--workdir=\"$code_workdir\" \
|
|
|
--name=\"$container_name\" \
|
|
|
--detach \
|
|
|
--publish $RC_SSH_PORT:$RC_SSH_PORT \
|
|
|
sshd $docker_exec_script"
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.function
|
|
|
dev_tools_svn_command() {
|
|
|
# src/svn_command.sh
|
|
|
if [[ -v WORKSPACE_HOME ]];
|
|
|
then
|
|
|
DEFAULT_WORKSPACE_HOME=$WORKSPACE_HOME
|
|
|
echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
|
|
|
else
|
|
|
echo "WORKSPACE_HOME env var is not set"
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
code_workdir=${args[--workdir]}
|
|
|
cmd_script=${args[--cmd]}
|
|
|
|
|
|
exec_script=$WORKSPACE_HOME/$cmd_script
|
|
|
container_name=dev-svn
|
|
|
env_file=".custom/.dev.env"
|
|
|
|
|
|
echo "Using exec script: $exec_script"
|
|
|
|
|
|
RC_DEV_CMD_HELP="apachectl -D FOREGROUND"
|
|
|
|
|
|
if [[ ! -f $exec_script ]]; then
|
|
|
echo "Generating new $exec_script file..."
|
|
|
mkdir -p $(dirname $exec_script)
|
|
|
|
|
|
cat <<< "
|
|
|
# Generated dev-env script for svn
|
|
|
|
|
|
echo \"Run svn dev using the following command:\"
|
|
|
echo \"++++++++++++++++++++++++++++++++++++++++++++++++++\"
|
|
|
echo \"$RC_DEV_CMD_HELP\"
|
|
|
echo \"++++++++++++++++++++++++++++++++++++++++++++++++++\"
|
|
|
make sh
|
|
|
" > $exec_script
|
|
|
chmod +x $exec_script
|
|
|
fi
|
|
|
|
|
|
docker_exec_script="/var/opt/rhodecode_repo_store/$cmd_script"
|
|
|
|
|
|
docker_id=$(docker ps -q --filter "name=$container_name" --filter name="rc_cluster_apps-svn")
|
|
|
|
|
|
if [[ $docker_id ]]; then
|
|
|
echo $container_name FOUND, Killing old one !
|
|
|
docker kill -s 9 $docker_id
|
|
|
sleep 5
|
|
|
docker rm -fv $container_name
|
|
|
echo "done..."
|
|
|
else
|
|
|
echo $container_name not found
|
|
|
fi
|
|
|
|
|
|
eval "
|
|
|
WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME RC_DEV_CMD_HELP=\"$RC_DEV_CMD_HELP\" \
|
|
|
./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
|
|
|
run -e RC_DEV_CMD_HELP=\"'$RC_DEV_CMD_HELP'\" -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_$container_name --rm --use-aliases \
|
|
|
--workdir=\"$code_workdir\" \
|
|
|
--name=\"$container_name\" \
|
|
|
--interactive --tty \
|
|
|
svn bash $docker_exec_script"
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.function
|
|
|
dev_tools_svnd_command() {
|
|
|
# src/svnd_command.sh
|
|
|
echo "# this file is located in 'src/svnd_command.sh'"
|
|
|
echo "# code for 'dev-tools svnd' goes here"
|
|
|
echo "# you can edit it freely and regenerate (it will not be overwritten)"
|
|
|
inspect_args
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.function
|
|
|
dev_tools_tools_command() {
|
|
|
# src/tools_command.sh
|
|
|
container_name=dev-tools
|
|
|
|
|
|
docker ps -q --filter "name=$container_name" | grep -q . && echo $container_name found || echo $container_name not found
|
|
|
docker ps -q --filter "name=$container_name" | grep -q . && docker stop -t 120 $container_name && docker rm -fv $container_name
|
|
|
|
|
|
if [[ -v WORKSPACE_HOME ]];
|
|
|
then
|
|
|
DEFAULT_WORKSPACE_HOME=$WORKSPACE_HOME
|
|
|
else
|
|
|
echo "WORKSPACE_HOME env var is not set"
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
|
|
|
|
|
|
eval "
|
|
|
WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME \
|
|
|
./rcstack stack --env-file-path .custom/.dev.env rhodecode -f docker-compose-apps.dev.yaml \
|
|
|
run -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_tools_bash \
|
|
|
--rm --use-aliases \
|
|
|
--workdir=\"/home/rhodecode/rhodecode-tools-ce\" \
|
|
|
--interactive --tty \
|
|
|
--name=\"$container_name\" rhodecode bash /home/rhodecode/rhodecode-tools-ce/.dev/dev-env.sh"
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.function
|
|
|
dev_tools_dev_env_command() {
|
|
|
# src/dev_env_command.sh
|
|
|
eval " \
|
|
|
./rcstack stack metrics up --detach statsd-exporter && \
|
|
|
./rcstack stack services up --detach && \
|
|
|
./rcstack stack services up --detach httpbin && \
|
|
|
./rcstack stack services up --detach ldap-server && \
|
|
|
./rcstack stack rhodecode up --detach svn && \
|
|
|
./rcstack stack rhodecode up --detach celery celery-beat && \
|
|
|
./rcstack stack rhodecode up --detach sshd && \
|
|
|
./rcstack status"
|
|
|
}
|
|
|
|
|
|
# :command.function
|
|
|
dev_tools_prune_command() {
|
|
|
# src/prune_command.sh
|
|
|
docker container prune -f
|
|
|
docker image prune -f
|
|
|
docker builder prune -f
|
|
|
docker system df
|
|
|
}
|
|
|
|
|
|
# :command.function
|
|
|
dev_tools_prune_all_command() {
|
|
|
# src/prune_all_command.sh
|
|
|
docker container prune -f
|
|
|
docker image prune -f
|
|
|
docker builder prune -f
|
|
|
docker system prune -f
|
|
|
docker system df
|
|
|
}
|
|
|
|
|
|
# :command.function
|
|
|
dev_tools_cli_generate_pull_command() {
|
|
|
# src/cli_generate_pull_command.sh
|
|
|
docker pull $bashly_image
|
|
|
}
|
|
|
|
|
|
# :command.function
|
|
|
dev_tools_cli_generate_help_command() {
|
|
|
# src/cli_generate_help_command.sh
|
|
|
source_dir=/media/psf/Home/workspace/rcstack-cli-modules/dev-tools
|
|
|
target_dir=/media/psf/Home/workspace/rhodecode-docker/scripts/dev-tools
|
|
|
|
|
|
echo "To pull latest image:"
|
|
|
echo " docker pull $bashly_image"
|
|
|
|
|
|
echo "To run generation manually:"
|
|
|
echo " docker run --rm -it --user $(id -u):$(id -g) --volume "$source_dir:/app" --volume "$target_dir:/dest" -e BASHLY_TARGET_DIR=/dest $bashly_image generate"
|
|
|
|
|
|
echo "To upgrade builting scripts:"
|
|
|
echo " docker run --rm -it --user $(id -u):$(id -g) --volume "$source_dir:/app" --volume "$target_dir:/dest" -e BASHLY_TARGET_DIR=/dest $bashly_image generate --upgrade"
|
|
|
|
|
|
#bashly generate --upgrade
|
|
|
|
|
|
# bashly add completions_script && source ./completions.bash
|
|
|
|
|
|
#alias bashly='docker run --rm -it --user $(id -u):$(id -g) --volume "$PWD:/app" dannyben/bashly:edge'
|
|
|
}
|
|
|
|
|
|
# :command.function
|
|
|
dev_tools_stack_cli_version_command() {
|
|
|
# src/stack_cli_version_command.sh
|
|
|
version=${args[version]}
|
|
|
version_file=$(pwd)/VERSION
|
|
|
yaml_file=$(pwd)/scripts/rcstack/src/bashly.yml
|
|
|
|
|
|
echo "Setting $version to $version_file"
|
|
|
echo -n $version > $version_file
|
|
|
|
|
|
echo "Setting $version to $yaml_file"
|
|
|
sed -i -E "s/version:.+/version: $version/" $yaml_file
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.function
|
|
|
dev_tools_cli_generate_rc_command() {
|
|
|
# src/cli_generate_rc_command.sh
|
|
|
one_time=${args[--one-time]}
|
|
|
|
|
|
echo "Using scripts/scripts/rcstack/bashly.yaml @ $bashly_image"
|
|
|
source_dir=/media/psf/Home/workspace/rcstack-cli-modules/rcstack
|
|
|
target_dir=/media/psf/Home/workspace/rhodecode-docker/scripts/rcstack
|
|
|
|
|
|
if [[ $one_time ]]; then
|
|
|
docker run --rm -it --user $(id -u):$(id -g) --volume "$source_dir:/app" --volume "$target_dir:/dest" -e BASHLY_TARGET_DIR=/dest $bashly_image generate --upgrade
|
|
|
else
|
|
|
docker run --rm -it --user $(id -u):$(id -g) --volume "$source_dir:/app" --volume "$target_dir:/dest" -e BASHLY_TARGET_DIR=/dest $bashly_image generate --watch
|
|
|
fi
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.function
|
|
|
dev_tools_cli_generate_dev_command() {
|
|
|
# src/cli_generate_dev_command.sh
|
|
|
one_time=${args[--one-time]}
|
|
|
|
|
|
echo "Using scripts/dev-tools/bashly.yaml @ $bashly_image"
|
|
|
source_dir=/media/psf/Home/workspace/rcstack-cli-modules/dev-tools
|
|
|
target_dir=/media/psf/Home/workspace/rhodecode-docker/scripts/dev-tools
|
|
|
|
|
|
if [[ $one_time ]]; then
|
|
|
docker run --rm -it --user $(id -u):$(id -g) --volume "$source_dir:/app" --volume "$target_dir:/dest" -e BASHLY_TARGET_DIR=/dest $bashly_image generate --upgrade
|
|
|
else
|
|
|
docker run --rm -it --user $(id -u):$(id -g) --volume "$source_dir:/app" --volume "$target_dir:/dest" -e BASHLY_TARGET_DIR=/dest $bashly_image generate --watch
|
|
|
fi
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.function
|
|
|
dev_tools_get_build_artifacts_command() {
|
|
|
# src/get_build_artifacts_command.sh
|
|
|
|
|
|
DEBUG=${args[--debug]}
|
|
|
AUTH=${args[--auth]}
|
|
|
INSTALLER_URL=${args[--installer-url]}
|
|
|
MANIFEST_URL=${args[--manifest-url]}
|
|
|
RC_VERSION=${args[--version-name]}
|
|
|
VER=$RC_VERSION
|
|
|
|
|
|
CACHE_DIR=$PWD/.cache
|
|
|
VER_REGEX="$VER+x86_64"
|
|
|
|
|
|
if [[ $VER == "" ]]; then
|
|
|
msg="Version is empty, please set --version-name correctly"
|
|
|
echo "$(red $msg)"
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
echo "Downloading Artifacts for version: $VER"
|
|
|
mkdir -p $CACHE_DIR
|
|
|
|
|
|
echo "1/4 Checking available downloads from MANIFEST file"
|
|
|
|
|
|
ARTS=$(curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2)
|
|
|
|
|
|
if [[ $DEBUG ]]; then
|
|
|
echo "DEBUG START"
|
|
|
curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" || echo "no regex match"
|
|
|
curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2
|
|
|
echo "Found following artifacts:"
|
|
|
echo $ARTS
|
|
|
echo "DEBUG END"
|
|
|
fi
|
|
|
|
|
|
if [[ $ARTS == "" ]]; then
|
|
|
MSG="Failed to found any MANIFEST entries for version $VER make sure there exists release with that version or use --version to specify different version"
|
|
|
echo "$(red $MSG)"
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
echo "2/4 Downloading locale-archive"
|
|
|
curl -L https://dls.rhodecode.com/assets/locale-archive -J -O
|
|
|
mv -v locale-archive "$CACHE_DIR"
|
|
|
|
|
|
# vcsserver/ce/ee
|
|
|
echo "3/4 Downloading installer artifacts"
|
|
|
for url in $ARTS; do
|
|
|
echo "Downloading $url with $AUTH"
|
|
|
curl $AUTH --fail-early -L ${url} -J -O
|
|
|
done
|
|
|
|
|
|
#for url in $(curl -s $MANIFEST_URL | grep --ignore-case -E 'control.+\+x86_64' | cut -d ' ' -f 2); do
|
|
|
# echo "Downloading $url"
|
|
|
# curl -L ${url} -J -O
|
|
|
#done
|
|
|
|
|
|
echo "4/4 Downloading installer from $INSTALLER_URL"
|
|
|
curl $AUTH -L $INSTALLER_URL -J -O
|
|
|
|
|
|
INSTALLER=$(ls -Art RhodeCode-installer-* | tail -n 1)
|
|
|
if [[ -n $INSTALLER ]]; then
|
|
|
chmod +x "${INSTALLER}"
|
|
|
fi
|
|
|
|
|
|
echo "Copying artifacts into $CACHE_DIR"
|
|
|
|
|
|
mv -v "${INSTALLER}" $CACHE_DIR
|
|
|
mv -v *.bz2 $CACHE_DIR
|
|
|
ls -lh $CACHE_DIR
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.function
|
|
|
dev_tools_build_installer_command() {
|
|
|
# src/build_installer_command.sh
|
|
|
|
|
|
rc_version=${args[--version-name]}
|
|
|
export RC_VERSION=$rc_version
|
|
|
eval "echo INSTALLER BASED BUILDING${RC_VERSION}"
|
|
|
|
|
|
RC_VERSION=$rc_version ./$RC_SCRIPT_NAME stack rhodecode build --progress plain rhodecode
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.function
|
|
|
dev_tools_get_build_source_command() {
|
|
|
# src/get_build_source_command.sh
|
|
|
|
|
|
DEBUG=${args[--debug]}
|
|
|
AUTH_TOKEN=${args[--auth-token]}
|
|
|
SERVER_URL=${args[--server-url]}
|
|
|
revision=${args[--revision]}
|
|
|
|
|
|
SOURCE_DIR=$PWD/.source
|
|
|
|
|
|
RHODECODE_VCS_HASH=$revision
|
|
|
RHODECODE_CE_HASH=$revision
|
|
|
RHODECODE_EE_HASH=$revision
|
|
|
|
|
|
# download sources
|
|
|
echo "** download rhodecode source for build from $SERVER_URL using '$revision' hash **"
|
|
|
mkdir -p $SOURCE_DIR
|
|
|
|
|
|
echo "getting $SERVER_URL/rhodecode-vcsserver/archive/$RHODECODE_VCS_HASH.tgz"
|
|
|
curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-vcsserver/archive/$RHODECODE_VCS_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR
|
|
|
|
|
|
echo "getting $SERVER_URL/rhodecode-enterprise-ce/archive/$RHODECODE_CE_HASH.tgz"
|
|
|
curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-ce/archive/$RHODECODE_CE_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR
|
|
|
|
|
|
echo "getting $SERVER_URL/rhodecode-enterprise-ee/archive/$RHODECODE_EE_HASH.tgz"
|
|
|
curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-ee/archive/$RHODECODE_EE_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR
|
|
|
|
|
|
rm -rf $SOURCE_DIR/rhodecode-vcsserver && \
|
|
|
mv $SOURCE_DIR/*rhodecode-vcsserver-* $SOURCE_DIR/rhodecode-vcsserver
|
|
|
rm -rf $SOURCE_DIR/rhodecode-vcsserver/.hg
|
|
|
|
|
|
rm -rf $SOURCE_DIR/rhodecode-enterprise-ce && \
|
|
|
mv $SOURCE_DIR/*rhodecode-enterprise-ce-* $SOURCE_DIR/rhodecode-enterprise-ce
|
|
|
rm -rf $SOURCE_DIR/rhodecode-enterprise-ce/.hg
|
|
|
|
|
|
rm -rf $SOURCE_DIR/rhodecode-enterprise-ee && \
|
|
|
mv $SOURCE_DIR/*rhodecode-enterprise-ee-* $SOURCE_DIR/rhodecode-enterprise-ee
|
|
|
rm -rf $SOURCE_DIR/rhodecode-enterprise-ee/.hg
|
|
|
|
|
|
echo "downloading sources done to $SOURCE_DIR, directory now consists:"
|
|
|
ls -l $SOURCE_DIR
|
|
|
|
|
|
echo ""
|
|
|
date_formatted=$(date +%Y.%m.%d.1)
|
|
|
echo "to create source based build run:"
|
|
|
echo " ./$RC_SCRIPT_NAME build-source --version-name 4.28.0.$date_formatted --tag beta"
|
|
|
echo " ./$RC_SCRIPT_NAME build-source --version-name 5.0.0.$date_formatted --tag beta"
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.function
|
|
|
dev_tools_build_source_command() {
|
|
|
# src/build_source_command.sh
|
|
|
|
|
|
rc_version=${args[--version-name]}
|
|
|
source_build_yaml=${args[--source-build-yaml]}
|
|
|
|
|
|
eval "tags_data=(${args[--tag]})"
|
|
|
|
|
|
export RC_VERSION=$rc_version
|
|
|
export RC_EDITION=ee
|
|
|
|
|
|
VCS_SHA=$(cat .source/rhodecode-vcsserver/.archival.txt | grep commit_id | cut -d ":" -f 2 | cut -c 1-6)
|
|
|
CE_SHA=$(cat .source/rhodecode-enterprise-ce/.archival.txt | grep commit_id | cut -d ":" -f 2 | cut -c 1-6)
|
|
|
EE_SHA=$(cat .source/rhodecode-enterprise-ee/.archival.txt | grep commit_id | cut -d ":" -f 2 | cut -c 1-6)
|
|
|
|
|
|
echo "build_source: SOURCE BASED BUILDING: $rc_version @ vcs:$VCS_SHA ce:$CE_SHA ee:$EE_SHA"
|
|
|
echo "build_source: tags:" ${tags_data[@]}
|
|
|
echo ""
|
|
|
|
|
|
RC_SCRIPT_NAME=rcstack
|
|
|
DOCKER_SCAN_SUGGEST=false RC_VERSION=$rc_version \
|
|
|
./$RC_SCRIPT_NAME stack rhodecode -f $source_build_yaml \
|
|
|
--progress plain \
|
|
|
build \
|
|
|
--build-arg VCS_SHA=$VCS_SHA \
|
|
|
--build-arg CE_SHA=$CE_SHA \
|
|
|
--build-arg EE_SHA=$EE_SHA \
|
|
|
rhodecode
|
|
|
|
|
|
# now tag the ee to ce
|
|
|
docker tag rhodecode/rhodecode-ee:$rc_version rhodecode/rhodecode-ce:$rc_version
|
|
|
|
|
|
# apply the tags
|
|
|
for tag in "${tags_data[@]}"; do
|
|
|
echo "build_source: creating tag:$tag"
|
|
|
docker tag rhodecode/rhodecode-ee:$rc_version rhodecode/rhodecode-ee:$tag
|
|
|
docker tag rhodecode/rhodecode-ee:$rc_version rhodecode/rhodecode-ce:$tag
|
|
|
done
|
|
|
|
|
|
echo "build_source: consider setting release version using"
|
|
|
echo " ./$RC_SCRIPT_NAME cli set-runtime-image $rc_version"
|
|
|
|
|
|
echo "build_source: push this image using"
|
|
|
echo " docker push rhodecode/rhodecode-ee:$rc_version"
|
|
|
echo " docker push rhodecode/rhodecode-ce:$rc_version"
|
|
|
|
|
|
for tag in "${tags_data[@]}"; do
|
|
|
echo " docker push rhodecode/rhodecode-ee:$tag"
|
|
|
echo " docker push rhodecode/rhodecode-ce:$tag"
|
|
|
done
|
|
|
}
|
|
|
|
|
|
# :command.parse_requirements
|
|
|
parse_requirements() {
|
|
|
# :command.fixed_flags_filter
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
case "${1:-}" in
|
|
|
--version | -v)
|
|
|
version_command
|
|
|
exit
|
|
|
;;
|
|
|
|
|
|
--help | -h)
|
|
|
long_usage=yes
|
|
|
dev_tools_usage
|
|
|
exit
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
break
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.command_filter
|
|
|
action=${1:-}
|
|
|
|
|
|
case $action in
|
|
|
-*) ;;
|
|
|
|
|
|
vcs | v)
|
|
|
action="vcs"
|
|
|
shift
|
|
|
dev_tools_vcs_parse_requirements "$@"
|
|
|
shift $#
|
|
|
;;
|
|
|
|
|
|
ee | e)
|
|
|
action="ee"
|
|
|
shift
|
|
|
dev_tools_ee_parse_requirements "$@"
|
|
|
shift $#
|
|
|
;;
|
|
|
|
|
|
ce | c)
|
|
|
action="ce"
|
|
|
shift
|
|
|
dev_tools_ce_parse_requirements "$@"
|
|
|
shift $#
|
|
|
;;
|
|
|
|
|
|
celery)
|
|
|
action="celery"
|
|
|
shift
|
|
|
dev_tools_celery_parse_requirements "$@"
|
|
|
shift $#
|
|
|
;;
|
|
|
|
|
|
celeryd)
|
|
|
action="celeryd"
|
|
|
shift
|
|
|
dev_tools_celeryd_parse_requirements "$@"
|
|
|
shift $#
|
|
|
;;
|
|
|
|
|
|
ssh)
|
|
|
action="ssh"
|
|
|
shift
|
|
|
dev_tools_ssh_parse_requirements "$@"
|
|
|
shift $#
|
|
|
;;
|
|
|
|
|
|
sshd)
|
|
|
action="sshd"
|
|
|
shift
|
|
|
dev_tools_sshd_parse_requirements "$@"
|
|
|
shift $#
|
|
|
;;
|
|
|
|
|
|
svn)
|
|
|
action="svn"
|
|
|
shift
|
|
|
dev_tools_svn_parse_requirements "$@"
|
|
|
shift $#
|
|
|
;;
|
|
|
|
|
|
svnd)
|
|
|
action="svnd"
|
|
|
shift
|
|
|
dev_tools_svnd_parse_requirements "$@"
|
|
|
shift $#
|
|
|
;;
|
|
|
|
|
|
tools | t)
|
|
|
action="tools"
|
|
|
shift
|
|
|
dev_tools_tools_parse_requirements "$@"
|
|
|
shift $#
|
|
|
;;
|
|
|
|
|
|
dev-env)
|
|
|
action="dev-env"
|
|
|
shift
|
|
|
dev_tools_dev_env_parse_requirements "$@"
|
|
|
shift $#
|
|
|
;;
|
|
|
|
|
|
prune)
|
|
|
action="prune"
|
|
|
shift
|
|
|
dev_tools_prune_parse_requirements "$@"
|
|
|
shift $#
|
|
|
;;
|
|
|
|
|
|
prune-all)
|
|
|
action="prune-all"
|
|
|
shift
|
|
|
dev_tools_prune_all_parse_requirements "$@"
|
|
|
shift $#
|
|
|
;;
|
|
|
|
|
|
cli-generate-pull)
|
|
|
action="cli-generate-pull"
|
|
|
shift
|
|
|
dev_tools_cli_generate_pull_parse_requirements "$@"
|
|
|
shift $#
|
|
|
;;
|
|
|
|
|
|
cli-generate-help)
|
|
|
action="cli-generate-help"
|
|
|
shift
|
|
|
dev_tools_cli_generate_help_parse_requirements "$@"
|
|
|
shift $#
|
|
|
;;
|
|
|
|
|
|
stack-cli-version)
|
|
|
action="stack-cli-version"
|
|
|
shift
|
|
|
dev_tools_stack_cli_version_parse_requirements "$@"
|
|
|
shift $#
|
|
|
;;
|
|
|
|
|
|
cli-generate-rc)
|
|
|
action="cli-generate-rc"
|
|
|
shift
|
|
|
dev_tools_cli_generate_rc_parse_requirements "$@"
|
|
|
shift $#
|
|
|
;;
|
|
|
|
|
|
cli-generate-dev)
|
|
|
action="cli-generate-dev"
|
|
|
shift
|
|
|
dev_tools_cli_generate_dev_parse_requirements "$@"
|
|
|
shift $#
|
|
|
;;
|
|
|
|
|
|
get-build-artifacts)
|
|
|
action="get-build-artifacts"
|
|
|
shift
|
|
|
dev_tools_get_build_artifacts_parse_requirements "$@"
|
|
|
shift $#
|
|
|
;;
|
|
|
|
|
|
build-installer)
|
|
|
action="build-installer"
|
|
|
shift
|
|
|
dev_tools_build_installer_parse_requirements "$@"
|
|
|
shift $#
|
|
|
;;
|
|
|
|
|
|
get-build-source)
|
|
|
action="get-build-source"
|
|
|
shift
|
|
|
dev_tools_get_build_source_parse_requirements "$@"
|
|
|
shift $#
|
|
|
;;
|
|
|
|
|
|
build-source)
|
|
|
action="build-source"
|
|
|
shift
|
|
|
dev_tools_build_source_parse_requirements "$@"
|
|
|
shift $#
|
|
|
;;
|
|
|
|
|
|
# :command.command_fallback
|
|
|
"")
|
|
|
dev_tools_usage >&2
|
|
|
exit 1
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
printf "invalid command: %s\n" "$action" >&2
|
|
|
exit 1
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
|
|
|
# :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
|
|
|
printf "invalid argument: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.parse_requirements
|
|
|
dev_tools_vcs_parse_requirements() {
|
|
|
# :command.fixed_flags_filter
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
case "${1:-}" in
|
|
|
--help | -h)
|
|
|
long_usage=yes
|
|
|
dev_tools_vcs_usage
|
|
|
exit
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
break
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.command_filter
|
|
|
action="vcs"
|
|
|
|
|
|
# :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
|
|
|
printf "invalid argument: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.parse_requirements
|
|
|
dev_tools_ee_parse_requirements() {
|
|
|
# :command.fixed_flags_filter
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
case "${1:-}" in
|
|
|
--help | -h)
|
|
|
long_usage=yes
|
|
|
dev_tools_ee_usage
|
|
|
exit
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
break
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.command_filter
|
|
|
action="ee"
|
|
|
|
|
|
# :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
|
|
|
printf "invalid argument: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.parse_requirements
|
|
|
dev_tools_ce_parse_requirements() {
|
|
|
# :command.fixed_flags_filter
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
case "${1:-}" in
|
|
|
--help | -h)
|
|
|
long_usage=yes
|
|
|
dev_tools_ce_usage
|
|
|
exit
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
break
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.command_filter
|
|
|
action="ce"
|
|
|
|
|
|
# :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
|
|
|
printf "invalid argument: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.parse_requirements
|
|
|
dev_tools_celery_parse_requirements() {
|
|
|
# :command.fixed_flags_filter
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
case "${1:-}" in
|
|
|
--help | -h)
|
|
|
long_usage=yes
|
|
|
dev_tools_celery_usage
|
|
|
exit
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
break
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.command_filter
|
|
|
action="celery"
|
|
|
|
|
|
# :command.parse_requirements_while
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
key="$1"
|
|
|
case "$key" in
|
|
|
# :flag.case
|
|
|
--workdir)
|
|
|
|
|
|
# :flag.case_arg
|
|
|
if [[ -n ${2+x} ]]; then
|
|
|
|
|
|
args['--workdir']="$2"
|
|
|
shift
|
|
|
shift
|
|
|
else
|
|
|
printf "%s\n" "--workdir requires an argument: --workdir WORKDIR" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
;;
|
|
|
|
|
|
# :flag.case
|
|
|
--cmd)
|
|
|
|
|
|
# :flag.case_arg
|
|
|
if [[ -n ${2+x} ]]; then
|
|
|
|
|
|
args['--cmd']="$2"
|
|
|
shift
|
|
|
shift
|
|
|
else
|
|
|
printf "%s\n" "--cmd requires an argument: --cmd CMD" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
;;
|
|
|
|
|
|
-?*)
|
|
|
printf "invalid option: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
# :command.parse_requirements_case
|
|
|
# :command.parse_requirements_case_simple
|
|
|
printf "invalid argument: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.default_assignments
|
|
|
[[ -n ${args['--workdir']:-} ]] || args['--workdir']="/home/rhodecode/rhodecode-enterprise-ce"
|
|
|
[[ -n ${args['--cmd']:-} ]] || args['--cmd']=".dev-env/cmd-celery.sh"
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.parse_requirements
|
|
|
dev_tools_celeryd_parse_requirements() {
|
|
|
# :command.fixed_flags_filter
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
case "${1:-}" in
|
|
|
--help | -h)
|
|
|
long_usage=yes
|
|
|
dev_tools_celeryd_usage
|
|
|
exit
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
break
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.command_filter
|
|
|
action="celeryd"
|
|
|
|
|
|
# :command.parse_requirements_while
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
key="$1"
|
|
|
case "$key" in
|
|
|
# :flag.case
|
|
|
--workdir)
|
|
|
|
|
|
# :flag.case_arg
|
|
|
if [[ -n ${2+x} ]]; then
|
|
|
|
|
|
args['--workdir']="$2"
|
|
|
shift
|
|
|
shift
|
|
|
else
|
|
|
printf "%s\n" "--workdir requires an argument: --workdir WORKDIR" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
;;
|
|
|
|
|
|
# :flag.case
|
|
|
--cmd)
|
|
|
|
|
|
# :flag.case_arg
|
|
|
if [[ -n ${2+x} ]]; then
|
|
|
|
|
|
args['--cmd']="$2"
|
|
|
shift
|
|
|
shift
|
|
|
else
|
|
|
printf "%s\n" "--cmd requires an argument: --cmd CMD" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
;;
|
|
|
|
|
|
-?*)
|
|
|
printf "invalid option: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
# :command.parse_requirements_case
|
|
|
# :command.parse_requirements_case_simple
|
|
|
printf "invalid argument: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.default_assignments
|
|
|
[[ -n ${args['--workdir']:-} ]] || args['--workdir']="/home/rhodecode/rhodecode-enterprise-ce"
|
|
|
[[ -n ${args['--cmd']:-} ]] || args['--cmd']=".dev-env/cmd-celeryd.sh"
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.parse_requirements
|
|
|
dev_tools_ssh_parse_requirements() {
|
|
|
# :command.fixed_flags_filter
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
case "${1:-}" in
|
|
|
--help | -h)
|
|
|
long_usage=yes
|
|
|
dev_tools_ssh_usage
|
|
|
exit
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
break
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.command_filter
|
|
|
action="ssh"
|
|
|
|
|
|
# :command.parse_requirements_while
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
key="$1"
|
|
|
case "$key" in
|
|
|
# :flag.case
|
|
|
--workdir)
|
|
|
|
|
|
# :flag.case_arg
|
|
|
if [[ -n ${2+x} ]]; then
|
|
|
|
|
|
args['--workdir']="$2"
|
|
|
shift
|
|
|
shift
|
|
|
else
|
|
|
printf "%s\n" "--workdir requires an argument: --workdir WORKDIR" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
;;
|
|
|
|
|
|
# :flag.case
|
|
|
--cmd)
|
|
|
|
|
|
# :flag.case_arg
|
|
|
if [[ -n ${2+x} ]]; then
|
|
|
|
|
|
args['--cmd']="$2"
|
|
|
shift
|
|
|
shift
|
|
|
else
|
|
|
printf "%s\n" "--cmd requires an argument: --cmd CMD" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
;;
|
|
|
|
|
|
-?*)
|
|
|
printf "invalid option: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
# :command.parse_requirements_case
|
|
|
# :command.parse_requirements_case_simple
|
|
|
printf "invalid argument: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.default_assignments
|
|
|
[[ -n ${args['--workdir']:-} ]] || args['--workdir']="/home/rhodecode/rhodecode-enterprise-ce"
|
|
|
[[ -n ${args['--cmd']:-} ]] || args['--cmd']=".dev-env/cmd-ssh.sh"
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.parse_requirements
|
|
|
dev_tools_sshd_parse_requirements() {
|
|
|
# :command.fixed_flags_filter
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
case "${1:-}" in
|
|
|
--help | -h)
|
|
|
long_usage=yes
|
|
|
dev_tools_sshd_usage
|
|
|
exit
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
break
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.command_filter
|
|
|
action="sshd"
|
|
|
|
|
|
# :command.parse_requirements_while
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
key="$1"
|
|
|
case "$key" in
|
|
|
# :flag.case
|
|
|
--workdir)
|
|
|
|
|
|
# :flag.case_arg
|
|
|
if [[ -n ${2+x} ]]; then
|
|
|
|
|
|
args['--workdir']="$2"
|
|
|
shift
|
|
|
shift
|
|
|
else
|
|
|
printf "%s\n" "--workdir requires an argument: --workdir WORKDIR" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
;;
|
|
|
|
|
|
# :flag.case
|
|
|
--cmd)
|
|
|
|
|
|
# :flag.case_arg
|
|
|
if [[ -n ${2+x} ]]; then
|
|
|
|
|
|
args['--cmd']="$2"
|
|
|
shift
|
|
|
shift
|
|
|
else
|
|
|
printf "%s\n" "--cmd requires an argument: --cmd CMD" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
;;
|
|
|
|
|
|
-?*)
|
|
|
printf "invalid option: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
# :command.parse_requirements_case
|
|
|
# :command.parse_requirements_case_simple
|
|
|
printf "invalid argument: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.default_assignments
|
|
|
[[ -n ${args['--workdir']:-} ]] || args['--workdir']="/home/rhodecode/rhodecode-enterprise-ce"
|
|
|
[[ -n ${args['--cmd']:-} ]] || args['--cmd']=".dev-env/cmd-sshd.sh"
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.parse_requirements
|
|
|
dev_tools_svn_parse_requirements() {
|
|
|
# :command.fixed_flags_filter
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
case "${1:-}" in
|
|
|
--help | -h)
|
|
|
long_usage=yes
|
|
|
dev_tools_svn_usage
|
|
|
exit
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
break
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.command_filter
|
|
|
action="svn"
|
|
|
|
|
|
# :command.parse_requirements_while
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
key="$1"
|
|
|
case "$key" in
|
|
|
# :flag.case
|
|
|
--workdir)
|
|
|
|
|
|
# :flag.case_arg
|
|
|
if [[ -n ${2+x} ]]; then
|
|
|
|
|
|
args['--workdir']="$2"
|
|
|
shift
|
|
|
shift
|
|
|
else
|
|
|
printf "%s\n" "--workdir requires an argument: --workdir WORKDIR" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
;;
|
|
|
|
|
|
# :flag.case
|
|
|
--cmd)
|
|
|
|
|
|
# :flag.case_arg
|
|
|
if [[ -n ${2+x} ]]; then
|
|
|
|
|
|
args['--cmd']="$2"
|
|
|
shift
|
|
|
shift
|
|
|
else
|
|
|
printf "%s\n" "--cmd requires an argument: --cmd CMD" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
;;
|
|
|
|
|
|
-?*)
|
|
|
printf "invalid option: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
# :command.parse_requirements_case
|
|
|
# :command.parse_requirements_case_simple
|
|
|
printf "invalid argument: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.default_assignments
|
|
|
[[ -n ${args['--workdir']:-} ]] || args['--workdir']="/home/rhodecode/rhodecode-enterprise-ce"
|
|
|
[[ -n ${args['--cmd']:-} ]] || args['--cmd']=".dev-env/cmd-svn.sh"
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.parse_requirements
|
|
|
dev_tools_svnd_parse_requirements() {
|
|
|
# :command.fixed_flags_filter
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
case "${1:-}" in
|
|
|
--help | -h)
|
|
|
long_usage=yes
|
|
|
dev_tools_svnd_usage
|
|
|
exit
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
break
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.command_filter
|
|
|
action="svnd"
|
|
|
|
|
|
# :command.parse_requirements_while
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
key="$1"
|
|
|
case "$key" in
|
|
|
# :flag.case
|
|
|
--workdir)
|
|
|
|
|
|
# :flag.case_arg
|
|
|
if [[ -n ${2+x} ]]; then
|
|
|
|
|
|
args['--workdir']="$2"
|
|
|
shift
|
|
|
shift
|
|
|
else
|
|
|
printf "%s\n" "--workdir requires an argument: --workdir WORKDIR" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
;;
|
|
|
|
|
|
# :flag.case
|
|
|
--cmd)
|
|
|
|
|
|
# :flag.case_arg
|
|
|
if [[ -n ${2+x} ]]; then
|
|
|
|
|
|
args['--cmd']="$2"
|
|
|
shift
|
|
|
shift
|
|
|
else
|
|
|
printf "%s\n" "--cmd requires an argument: --cmd CMD" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
;;
|
|
|
|
|
|
-?*)
|
|
|
printf "invalid option: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
# :command.parse_requirements_case
|
|
|
# :command.parse_requirements_case_simple
|
|
|
printf "invalid argument: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.default_assignments
|
|
|
[[ -n ${args['--workdir']:-} ]] || args['--workdir']="/home/rhodecode/rhodecode-enterprise-ce"
|
|
|
[[ -n ${args['--cmd']:-} ]] || args['--cmd']=".dev-env/cmd-svnd.sh"
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.parse_requirements
|
|
|
dev_tools_tools_parse_requirements() {
|
|
|
# :command.fixed_flags_filter
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
case "${1:-}" in
|
|
|
--help | -h)
|
|
|
long_usage=yes
|
|
|
dev_tools_tools_usage
|
|
|
exit
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
break
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.command_filter
|
|
|
action="tools"
|
|
|
|
|
|
# :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
|
|
|
printf "invalid argument: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.parse_requirements
|
|
|
dev_tools_dev_env_parse_requirements() {
|
|
|
# :command.fixed_flags_filter
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
case "${1:-}" in
|
|
|
--help | -h)
|
|
|
long_usage=yes
|
|
|
dev_tools_dev_env_usage
|
|
|
exit
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
break
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.command_filter
|
|
|
action="dev-env"
|
|
|
|
|
|
# :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
|
|
|
printf "invalid argument: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.parse_requirements
|
|
|
dev_tools_prune_parse_requirements() {
|
|
|
# :command.fixed_flags_filter
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
case "${1:-}" in
|
|
|
--help | -h)
|
|
|
long_usage=yes
|
|
|
dev_tools_prune_usage
|
|
|
exit
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
break
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.command_filter
|
|
|
action="prune"
|
|
|
|
|
|
# :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
|
|
|
printf "invalid argument: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.parse_requirements
|
|
|
dev_tools_prune_all_parse_requirements() {
|
|
|
# :command.fixed_flags_filter
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
case "${1:-}" in
|
|
|
--help | -h)
|
|
|
long_usage=yes
|
|
|
dev_tools_prune_all_usage
|
|
|
exit
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
break
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.command_filter
|
|
|
action="prune-all"
|
|
|
|
|
|
# :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
|
|
|
printf "invalid argument: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.parse_requirements
|
|
|
dev_tools_cli_generate_pull_parse_requirements() {
|
|
|
# :command.fixed_flags_filter
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
case "${1:-}" in
|
|
|
--help | -h)
|
|
|
long_usage=yes
|
|
|
dev_tools_cli_generate_pull_usage
|
|
|
exit
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
break
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.command_filter
|
|
|
action="cli-generate-pull"
|
|
|
|
|
|
# :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
|
|
|
printf "invalid argument: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.parse_requirements
|
|
|
dev_tools_cli_generate_help_parse_requirements() {
|
|
|
# :command.fixed_flags_filter
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
case "${1:-}" in
|
|
|
--help | -h)
|
|
|
long_usage=yes
|
|
|
dev_tools_cli_generate_help_usage
|
|
|
exit
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
break
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.command_filter
|
|
|
action="cli-generate-help"
|
|
|
|
|
|
# :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
|
|
|
printf "invalid argument: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.parse_requirements
|
|
|
dev_tools_stack_cli_version_parse_requirements() {
|
|
|
# :command.fixed_flags_filter
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
case "${1:-}" in
|
|
|
--help | -h)
|
|
|
long_usage=yes
|
|
|
dev_tools_stack_cli_version_usage
|
|
|
exit
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
break
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.command_filter
|
|
|
action="stack-cli-version"
|
|
|
|
|
|
# :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: dev-tools stack-cli-version VERSION\n" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.parse_requirements
|
|
|
dev_tools_cli_generate_rc_parse_requirements() {
|
|
|
# :command.fixed_flags_filter
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
case "${1:-}" in
|
|
|
--help | -h)
|
|
|
long_usage=yes
|
|
|
dev_tools_cli_generate_rc_usage
|
|
|
exit
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
break
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.command_filter
|
|
|
action="cli-generate-rc"
|
|
|
|
|
|
# :command.parse_requirements_while
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
key="$1"
|
|
|
case "$key" in
|
|
|
# :flag.case
|
|
|
--one-time | -o)
|
|
|
|
|
|
# :flag.case_no_arg
|
|
|
args['--one-time']=1
|
|
|
shift
|
|
|
;;
|
|
|
|
|
|
-?*)
|
|
|
printf "invalid option: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
# :command.parse_requirements_case
|
|
|
# :command.parse_requirements_case_simple
|
|
|
printf "invalid argument: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.parse_requirements
|
|
|
dev_tools_cli_generate_dev_parse_requirements() {
|
|
|
# :command.fixed_flags_filter
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
case "${1:-}" in
|
|
|
--help | -h)
|
|
|
long_usage=yes
|
|
|
dev_tools_cli_generate_dev_usage
|
|
|
exit
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
break
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.command_filter
|
|
|
action="cli-generate-dev"
|
|
|
|
|
|
# :command.parse_requirements_while
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
key="$1"
|
|
|
case "$key" in
|
|
|
# :flag.case
|
|
|
--one-time | -o)
|
|
|
|
|
|
# :flag.case_no_arg
|
|
|
args['--one-time']=1
|
|
|
shift
|
|
|
;;
|
|
|
|
|
|
-?*)
|
|
|
printf "invalid option: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
# :command.parse_requirements_case
|
|
|
# :command.parse_requirements_case_simple
|
|
|
printf "invalid argument: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.parse_requirements
|
|
|
dev_tools_get_build_artifacts_parse_requirements() {
|
|
|
# :command.fixed_flags_filter
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
case "${1:-}" in
|
|
|
--help | -h)
|
|
|
long_usage=yes
|
|
|
dev_tools_get_build_artifacts_usage
|
|
|
exit
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
break
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.command_filter
|
|
|
action="get-build-artifacts"
|
|
|
|
|
|
# :command.parse_requirements_while
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
key="$1"
|
|
|
case "$key" in
|
|
|
# :flag.case
|
|
|
--auth)
|
|
|
|
|
|
# :flag.case_arg
|
|
|
if [[ -n ${2+x} ]]; then
|
|
|
|
|
|
args['--auth']="$2"
|
|
|
shift
|
|
|
shift
|
|
|
else
|
|
|
printf "%s\n" "--auth requires an argument: --auth AUTH" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
;;
|
|
|
|
|
|
# :flag.case
|
|
|
--installer-url)
|
|
|
|
|
|
# :flag.case_arg
|
|
|
if [[ -n ${2+x} ]]; then
|
|
|
|
|
|
args['--installer-url']="$2"
|
|
|
shift
|
|
|
shift
|
|
|
else
|
|
|
printf "%s\n" "--installer-url requires an argument: --installer-url INSTALLER_URL" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
;;
|
|
|
|
|
|
# :flag.case
|
|
|
--manifest-url)
|
|
|
|
|
|
# :flag.case_arg
|
|
|
if [[ -n ${2+x} ]]; then
|
|
|
|
|
|
args['--manifest-url']="$2"
|
|
|
shift
|
|
|
shift
|
|
|
else
|
|
|
printf "%s\n" "--manifest-url requires an argument: --manifest-url MANIFEST_URL" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
;;
|
|
|
|
|
|
# :flag.case
|
|
|
--version-name)
|
|
|
|
|
|
# :flag.case_arg
|
|
|
if [[ -n ${2+x} ]]; then
|
|
|
|
|
|
args['--version-name']="$2"
|
|
|
shift
|
|
|
shift
|
|
|
else
|
|
|
printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
;;
|
|
|
|
|
|
-?*)
|
|
|
printf "invalid option: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
# :command.parse_requirements_case
|
|
|
# :command.parse_requirements_case_simple
|
|
|
printf "invalid argument: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.default_assignments
|
|
|
[[ -n ${args['--auth']:-} ]] || args['--auth']=""
|
|
|
[[ -n ${args['--installer-url']:-} ]] || args['--installer-url']="https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee"
|
|
|
[[ -n ${args['--manifest-url']:-} ]] || args['--manifest-url']="https://dls.rhodecode.com/linux/MANIFEST"
|
|
|
[[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME"
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.parse_requirements
|
|
|
dev_tools_build_installer_parse_requirements() {
|
|
|
# :command.fixed_flags_filter
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
case "${1:-}" in
|
|
|
--help | -h)
|
|
|
long_usage=yes
|
|
|
dev_tools_build_installer_usage
|
|
|
exit
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
break
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.command_filter
|
|
|
action="build-installer"
|
|
|
|
|
|
# :command.parse_requirements_while
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
key="$1"
|
|
|
case "$key" in
|
|
|
# :flag.case
|
|
|
--version-name)
|
|
|
|
|
|
# :flag.case_arg
|
|
|
if [[ -n ${2+x} ]]; then
|
|
|
|
|
|
args['--version-name']="$2"
|
|
|
shift
|
|
|
shift
|
|
|
else
|
|
|
printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
;;
|
|
|
|
|
|
-?*)
|
|
|
printf "invalid option: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
# :command.parse_requirements_case
|
|
|
# :command.parse_requirements_case_simple
|
|
|
printf "invalid argument: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.default_assignments
|
|
|
[[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME"
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.parse_requirements
|
|
|
dev_tools_get_build_source_parse_requirements() {
|
|
|
# :command.fixed_flags_filter
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
case "${1:-}" in
|
|
|
--help | -h)
|
|
|
long_usage=yes
|
|
|
dev_tools_get_build_source_usage
|
|
|
exit
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
break
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.dependencies_filter
|
|
|
if command -v curl >/dev/null 2>&1; then
|
|
|
deps['curl']="$(command -v curl | head -n1)"
|
|
|
else
|
|
|
printf "missing dependency: curl\n" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
if command -v tar >/dev/null 2>&1; then
|
|
|
deps['tar']="$(command -v tar | head -n1)"
|
|
|
else
|
|
|
printf "missing dependency: tar\n" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
# :command.command_filter
|
|
|
action="get-build-source"
|
|
|
|
|
|
# :command.parse_requirements_while
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
key="$1"
|
|
|
case "$key" in
|
|
|
# :flag.case
|
|
|
--revision)
|
|
|
|
|
|
# :flag.case_arg
|
|
|
if [[ -n ${2+x} ]]; then
|
|
|
|
|
|
args['--revision']="$2"
|
|
|
shift
|
|
|
shift
|
|
|
else
|
|
|
printf "%s\n" "--revision requires an argument: --revision REVISION" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
;;
|
|
|
|
|
|
# :flag.case
|
|
|
--auth-token)
|
|
|
|
|
|
# :flag.case_arg
|
|
|
if [[ -n ${2+x} ]]; then
|
|
|
|
|
|
args['--auth-token']="$2"
|
|
|
shift
|
|
|
shift
|
|
|
else
|
|
|
printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
;;
|
|
|
|
|
|
# :flag.case
|
|
|
--server-url)
|
|
|
|
|
|
# :flag.case_arg
|
|
|
if [[ -n ${2+x} ]]; then
|
|
|
|
|
|
args['--server-url']="$2"
|
|
|
shift
|
|
|
shift
|
|
|
else
|
|
|
printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
;;
|
|
|
|
|
|
-?*)
|
|
|
printf "invalid option: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
# :command.parse_requirements_case
|
|
|
# :command.parse_requirements_case_simple
|
|
|
printf "invalid argument: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.default_assignments
|
|
|
[[ -n ${args['--revision']:-} ]] || args['--revision']="default"
|
|
|
[[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://code.rhodecode.com"
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.parse_requirements
|
|
|
dev_tools_build_source_parse_requirements() {
|
|
|
# :command.fixed_flags_filter
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
case "${1:-}" in
|
|
|
--help | -h)
|
|
|
long_usage=yes
|
|
|
dev_tools_build_source_usage
|
|
|
exit
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
break
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.command_filter
|
|
|
action="build-source"
|
|
|
|
|
|
# :command.parse_requirements_while
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
key="$1"
|
|
|
case "$key" in
|
|
|
# :flag.case
|
|
|
--version-name)
|
|
|
|
|
|
# :flag.case_arg
|
|
|
if [[ -n ${2+x} ]]; then
|
|
|
|
|
|
args['--version-name']="$2"
|
|
|
shift
|
|
|
shift
|
|
|
else
|
|
|
printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
;;
|
|
|
|
|
|
# :flag.case
|
|
|
--source-build-yaml)
|
|
|
|
|
|
# :flag.case_arg
|
|
|
if [[ -n ${2+x} ]]; then
|
|
|
|
|
|
args['--source-build-yaml']="$2"
|
|
|
shift
|
|
|
shift
|
|
|
else
|
|
|
printf "%s\n" "--source-build-yaml requires an argument: --source-build-yaml BUILD_SOURCE_YAML" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
;;
|
|
|
|
|
|
# :flag.case
|
|
|
--tag)
|
|
|
|
|
|
# :flag.case_arg
|
|
|
if [[ -n ${2+x} ]]; then
|
|
|
|
|
|
if [[ -z ${args['--tag']+x} ]]; then
|
|
|
args['--tag']="\"$2\""
|
|
|
else
|
|
|
args['--tag']="${args[--tag]} \"$2\""
|
|
|
fi
|
|
|
shift
|
|
|
shift
|
|
|
else
|
|
|
printf "%s\n" "--tag requires an argument: --tag TAG" >&2
|
|
|
exit 1
|
|
|
fi
|
|
|
;;
|
|
|
|
|
|
-?*)
|
|
|
printf "invalid option: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
;;
|
|
|
|
|
|
*)
|
|
|
# :command.parse_requirements_case
|
|
|
# :command.parse_requirements_case_simple
|
|
|
printf "invalid argument: %s\n" "$key" >&2
|
|
|
exit 1
|
|
|
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
# :command.default_assignments
|
|
|
[[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME"
|
|
|
[[ -n ${args['--source-build-yaml']:-} ]] || args['--source-build-yaml']="build_yaml/docker-compose-apps.5.yaml"
|
|
|
|
|
|
}
|
|
|
|
|
|
# :command.initialize
|
|
|
initialize() {
|
|
|
version="1.0.0"
|
|
|
long_usage=''
|
|
|
set -e
|
|
|
|
|
|
# src/initialize.sh
|
|
|
|
|
|
bashly_image="dannyben/bashly:1.0.8"
|
|
|
}
|
|
|
|
|
|
# :command.run
|
|
|
run() {
|
|
|
declare -A args=()
|
|
|
declare -A deps=()
|
|
|
declare -a other_args=()
|
|
|
declare -a input=()
|
|
|
normalize_input "$@"
|
|
|
parse_requirements "${input[@]}"
|
|
|
|
|
|
case "$action" in
|
|
|
"vcs") dev_tools_vcs_command ;;
|
|
|
"ee") dev_tools_ee_command ;;
|
|
|
"ce") dev_tools_ce_command ;;
|
|
|
"celery") dev_tools_celery_command ;;
|
|
|
"celeryd") dev_tools_celeryd_command ;;
|
|
|
"ssh") dev_tools_ssh_command ;;
|
|
|
"sshd") dev_tools_sshd_command ;;
|
|
|
"svn") dev_tools_svn_command ;;
|
|
|
"svnd") dev_tools_svnd_command ;;
|
|
|
"tools") dev_tools_tools_command ;;
|
|
|
"dev-env") dev_tools_dev_env_command ;;
|
|
|
"prune") dev_tools_prune_command ;;
|
|
|
"prune-all") dev_tools_prune_all_command ;;
|
|
|
"cli-generate-pull") dev_tools_cli_generate_pull_command ;;
|
|
|
"cli-generate-help") dev_tools_cli_generate_help_command ;;
|
|
|
"stack-cli-version") dev_tools_stack_cli_version_command ;;
|
|
|
"cli-generate-rc") dev_tools_cli_generate_rc_command ;;
|
|
|
"cli-generate-dev") dev_tools_cli_generate_dev_command ;;
|
|
|
"get-build-artifacts") dev_tools_get_build_artifacts_command ;;
|
|
|
"build-installer") dev_tools_build_installer_command ;;
|
|
|
"get-build-source") dev_tools_get_build_source_command ;;
|
|
|
"build-source") dev_tools_build_source_command ;;
|
|
|
esac
|
|
|
}
|
|
|
|
|
|
initialize
|
|
|
run "$@"
|
|
|
|