64 lines
2.2 KiB
Bash
Executable file
64 lines
2.2 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
set -e
|
|
set -u
|
|
# DEBUG
|
|
#set -x
|
|
|
|
|
|
_dir_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)"
|
|
# get DOMAIN env var
|
|
[ -f ./status_data ] && . ./status_data
|
|
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
|
|
)"
|
|
|
|
printf -- "meta:\n\n"
|
|
_dir_info .
|
|
d_name="docker"
|
|
printf -- "- dir: %-17s | branch: %-8s | commit: %s\n" "${d_name}" "${branch_info}" "${commit_info}"
|
|
printf -- " - info: the repo that has all code for deployments, such as this status service\n"
|
|
|
|
_dir_info ./ssikit_trustchain
|
|
printf -- "- dir: %-17s | 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 is only relevant for new or fresh builds\n\n"
|
|
|
|
printf -- "idhub instances:\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
|
|
_dir_info "${d}"
|
|
printf -- " - %-32s | dir: %-30s | branch: %-8s | commit: %s\n" "${DOMAIN:-unknown domain}" "${d_name}" "${branch_info}" "${commit_info}"
|
|
unset DOMAIN
|
|
done
|
|
done
|
|
printf '\n\n$ docker ps\n\n'
|
|
# add on `/etc/sudoers.d/allow_dockerps` the following content:
|
|
# #https://serverfault.com/questions/184072/how-can-i-allow-all-users-to-run-a-given-command-via-sudo
|
|
# ALL ALL=NOPASSWD: /usr/bin/docker ps
|
|
sudo docker ps
|
|
}
|
|
|
|
main "${@}"
|