2024-02-20 09:57:28 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -u
|
|
|
|
# DEBUG
|
|
|
|
#set -x
|
|
|
|
|
2024-02-29 16:07:27 +00:00
|
|
|
|
2024-03-08 09:09:43 +00:00
|
|
|
_dir_info() {
|
2024-02-29 16:07:27 +00:00
|
|
|
d="${1}"
|
|
|
|
|
|
|
|
cd ${d}
|
2024-02-29 16:34:52 +00:00
|
|
|
# src https://stackoverflow.com/questions/6245570/how-do-i-get-the-current-branch-name-in-git/6245587#6245587
|
|
|
|
branch_info="$(git branch --show-current)"
|
2024-02-29 16:07:27 +00:00
|
|
|
# src https://ma.ttias.be/pretty-git-log-in-one-line/
|
2024-02-29 16:43:29 +00:00
|
|
|
commit_info="$(git log --pretty=format:'[%ci] %h %an: %s' -n 1)"
|
2024-03-08 09:09:43 +00:00
|
|
|
# get DOMAIN env var
|
|
|
|
[ -f ./status_data ] && . ./status_data
|
2024-02-29 16:07:27 +00:00
|
|
|
cd - >/dev/null
|
|
|
|
d_name="$(basename "${d}")"
|
|
|
|
}
|
|
|
|
|
2024-02-20 09:57:28 +00:00
|
|
|
main() {
|
|
|
|
|
2024-02-20 09:59:56 +00:00
|
|
|
cd "$(dirname "${0}")"
|
2024-02-20 09:57:28 +00:00
|
|
|
instances="$(find . -maxdepth 1 -type d \
|
|
|
|
| grep -E 'pilot|instance' \
|
2024-02-29 16:18:06 +00:00
|
|
|
| cut -d'_' -f3 \
|
|
|
|
| sort -u
|
2024-02-20 09:57:28 +00:00
|
|
|
)"
|
2024-03-08 12:28:43 +00:00
|
|
|
|
|
|
|
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"
|
|
|
|
|
2024-03-08 09:09:43 +00:00
|
|
|
_dir_info ./ssikit_trustchain
|
2024-03-08 12:28:43 +00:00
|
|
|
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"
|
|
|
|
|
2024-02-20 09:57:28 +00:00
|
|
|
for i in ${instances}; do
|
|
|
|
dirs="$(find . -maxdepth 1 -type d \
|
|
|
|
| grep -E 'pilot|instance' \
|
2024-02-29 17:20:57 +00:00
|
|
|
| grep "${i}$"
|
2024-02-20 09:57:28 +00:00
|
|
|
)"
|
|
|
|
echo "- ${i}"
|
|
|
|
for d in ${dirs}; do
|
2024-03-08 09:09:43 +00:00
|
|
|
_dir_info "${d}"
|
2024-03-08 12:28:43 +00:00
|
|
|
printf -- " - %-32s | dir: %-30s | branch: %-8s | commit: %s\n" "${DOMAIN:-unknown domain}" "${d_name}" "${branch_info}" "${commit_info}"
|
2024-03-08 09:09:43 +00:00
|
|
|
unset DOMAIN
|
2024-02-20 09:57:28 +00:00
|
|
|
done
|
|
|
|
done
|
2024-03-07 16:31:38 +00:00
|
|
|
printf '\n\n$ docker ps\n\n'
|
2024-03-07 16:35:34 +00:00
|
|
|
# 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
|
2024-02-20 09:57:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
main "${@}"
|