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

View File

@ -6,7 +6,7 @@ set -u
#set -x #set -x
_git_info() { _dir_info() {
d="${1}" d="${1}"
cd ${d} cd ${d}
@ -14,6 +14,8 @@ _git_info() {
branch_info="$(git branch --show-current)" branch_info="$(git branch --show-current)"
# src https://ma.ttias.be/pretty-git-log-in-one-line/ # src https://ma.ttias.be/pretty-git-log-in-one-line/
commit_info="$(git log --pretty=format:'[%ci] %h %an: %s' -n 1)" commit_info="$(git log --pretty=format:'[%ci] %h %an: %s' -n 1)"
# get DOMAIN env var
[ -f ./status_data ] && . ./status_data
cd - >/dev/null cd - >/dev/null
d_name="$(basename "${d}")" d_name="$(basename "${d}")"
} }
@ -26,7 +28,7 @@ main() {
| cut -d'_' -f3 \ | cut -d'_' -f3 \
| sort -u | sort -u
)" )"
_git_info ./ssikit_trustchain _dir_info ./ssikit_trustchain
printf -- "%-36s | branch: %-8s | commit: %s\n" "${d_name}" "${branch_info}" "${commit_info}" 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" 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 for i in ${instances}; do
@ -36,8 +38,9 @@ main() {
)" )"
echo "- ${i}" echo "- ${i}"
for d in ${dirs}; do for d in ${dirs}; do
_git_info "${d}" _dir_info "${d}"
printf -- " - %-30s | branch: %-8s | commit: %s\n" "${d_name}" "${branch_info}" "${commit_info}" printf -- " - %-35s | dir: %-30s | branch: %-8s | commit: %s\n" "${DOMAIN:-unknown domain}" "${d_name}" "${branch_info}" "${commit_info}"
unset DOMAIN
done done
done done
printf '\n\n$ docker ps\n\n' printf '\n\n$ docker ps\n\n'