This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
idhub-docker/status.sh

46 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
set -e
set -u
# DEBUG
#set -x
_git_info() {
d="${1}"
cd ${d}
# src https://stackoverflow.com/questions/6245570/how-do-i-get-the-current-branch-name-in-git/6245587#6245587
branch_info="$(git branch --show-current)"
# src https://ma.ttias.be/pretty-git-log-in-one-line/
commit_info="$(git log --pretty=format:'[%ci] %h %an: %s' -n 1)"
cd - >/dev/null
d_name="$(basename "${d}")"
}
main() {
cd "$(dirname "${0}")"
instances="$(find . -maxdepth 1 -type d \
| grep -E 'pilot|instance' \
| cut -d'_' -f3 \
| sort -u
)"
_git_info ./ssikit_trustchain
printf -- "%-31s | branch: %-8s | commit: %s\n" "${d_name}" "${branch_info}" "${commit_info}"
printf -- " note: outdated ssikit_trustchain version could be present on any instance. Hence, this only relevant for new or fresh builds\n\n"
for i in ${instances}; do
dirs="$(find . -maxdepth 1 -type d \
| grep -E 'pilot|instance' \
| grep "${i}"
)"
echo "- ${i}"
for d in ${dirs}; do
_git_info "${d}"
printf -- " - %-25s | branch: %-8s | commit: %s\n" "${d_name}" "${branch_info}" "${commit_info}"
done
done
}
main "${@}"