idhub entrypoint: inject DOMAIN env var in status

also adapt accordingly status.sh script
This commit is contained in:
pedro 2024-03-08 10:09:43 +01:00
parent 604c7a014c
commit a8aec1143c
2 changed files with 11 additions and 4 deletions

View File

@ -19,6 +19,10 @@ inject_env_vars() {
# related https://www.kenmuse.com/blog/avoiding-dubious-ownership-in-dev-containers/
git config --global --add safe.directory "${idhub_dir}"
export COMMIT="commit: $(git log --pretty=format:'%h' -n 1)"
cat > status_data <<END
DOMAIN=${DOMAIN}
END
}
deployment_strategy() {

View File

@ -6,7 +6,7 @@ set -u
#set -x
_git_info() {
_dir_info() {
d="${1}"
cd ${d}
@ -14,6 +14,8 @@ _git_info() {
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}")"
}
@ -26,7 +28,7 @@ main() {
| cut -d'_' -f3 \
| sort -u
)"
_git_info ./ssikit_trustchain
_dir_info ./ssikit_trustchain
printf -- "%-36s | 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"
for i in ${instances}; do
@ -36,8 +38,9 @@ main() {
)"
echo "- ${i}"
for d in ${dirs}; do
_git_info "${d}"
printf -- " - %-30s | branch: %-8s | commit: %s\n" "${d_name}" "${branch_info}" "${commit_info}"
_dir_info "${d}"
printf -- " - %-35s | 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'