forked from EvergreenCrypto/docker-finance
client: lib_docker: version: refactor, print image name
This commit is contained in:
@@ -635,10 +635,9 @@ function lib_docker::__version()
|
||||
{
|
||||
lib_docker::__parse_args_version "$@"
|
||||
|
||||
[ -z "${DOCKER_FINANCE_VERSION}" ] && lib_utils::die_fatal
|
||||
[ -z "${DOCKER_FINANCE_CLIENT_REPO}" ] && lib_utils::die_fatal
|
||||
|
||||
[ -z "$global_platform" ] && lib_utils::die_fatal
|
||||
[ -z "$global_platform_image" ] && lib_utils::die_fatal
|
||||
|
||||
[ -z "${global_arg_type[*]}" ] && lib_utils::die_fatal
|
||||
|
||||
for _type in "${global_arg_type[@]}"; do
|
||||
@@ -665,23 +664,20 @@ function lib_docker::__version()
|
||||
|
||||
container)
|
||||
# Feed dependency manifest (client is not bind-mounted for security reasons)
|
||||
[ -z "$global_repo_manifest" ] && lib_utils::die_fatal
|
||||
local _manifest
|
||||
# TODO: use global_repo_manifest
|
||||
_manifest="$(<${DOCKER_FINANCE_CLIENT_REPO}/client/docker-finance.yaml)"
|
||||
_manifest="$(<$global_repo_manifest)"
|
||||
|
||||
# NOTE: uses variable "callback"
|
||||
case "$global_platform" in
|
||||
archlinux)
|
||||
_platform="$global_platform"
|
||||
_image="finance"
|
||||
_image="$global_platform_image"
|
||||
_pkg="pacman -Q \$_package"
|
||||
;;
|
||||
ubuntu | dev-tools)
|
||||
if [[ "$global_platform" =~ ^ubuntu$|^dev-tools$ ]]; then
|
||||
_platform="ubuntu"
|
||||
_image="finance"
|
||||
[[ "$global_platform" == "dev-tools" ]] && _image="dev-tools"
|
||||
fi
|
||||
_platform="ubuntu" # NOTE: current dev-tools is treated as an ubuntu-based image
|
||||
_image="$global_platform_image"
|
||||
_pkg="dpkg -s \$_package | grep -E \"(^Package:|^Version:)\" | cut -d' ' -f2 | paste -s | awk '{print \$1 \" \" \$2}'"
|
||||
;;
|
||||
*)
|
||||
@@ -707,6 +703,9 @@ function lib_docker::__version()
|
||||
;;
|
||||
|
||||
short)
|
||||
[ -z "$DOCKER_FINANCE_CLIENT_REPO" ] && lib_utils::die_fatal
|
||||
[ -z "$DOCKER_FINANCE_VERSION" ] && lib_utils::die_fatal
|
||||
|
||||
local _hash
|
||||
if pushd "$DOCKER_FINANCE_CLIENT_REPO" 1>/dev/null; then
|
||||
_hash="$(git log --pretty='format:%h' -n 1)"
|
||||
@@ -717,7 +716,7 @@ function lib_docker::__version()
|
||||
|
||||
# TODO: add build type
|
||||
echo
|
||||
echo -e "docker-finance ${DOCKER_FINANCE_VERSION} | commit: $_hash | build: $global_platform"
|
||||
echo -e "docker-finance $DOCKER_FINANCE_VERSION | commit: $_hash | platform: $global_platform | image: $global_platform_image"
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
Reference in New Issue
Block a user