From 083d62df7c6ee407dc191be0460f2066098d3ff0 Mon Sep 17 00:00:00 2001 From: Alex Chantavy Date: Thu, 14 Nov 2024 14:12:27 -0800 Subject: [PATCH 1/3] Fix race condition for Docker local tests Signed-off-by: Alex Chantavy --- dev-entrypoint.sh | 7 +++++++ dev.Dockerfile | 3 +++ 2 files changed, 10 insertions(+) create mode 100755 dev-entrypoint.sh diff --git a/dev-entrypoint.sh b/dev-entrypoint.sh new file mode 100755 index 000000000..f70f06b12 --- /dev/null +++ b/dev-entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/sh +while ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; do + echo "Waiting for Git to be ready..." + sleep 1 +done +# Pass control to main container command +exec "$@" \ No newline at end of file diff --git a/dev.Dockerfile b/dev.Dockerfile index a1c9a5585..8c7fad36f 100644 --- a/dev.Dockerfile +++ b/dev.Dockerfile @@ -31,3 +31,6 @@ RUN git config --global --add safe.directory /var/cartography && \ git config --local user.name "cartography" USER ${uid}:${gid} + +#RUN chmod +x /var/cartography/dev-entrypoint.sh +ENTRYPOINT ["/var/cartography/dev-entrypoint.sh"] From 6c06b2e26bf28d8283bd770ffbb99d698d5ecbb6 Mon Sep 17 00:00:00 2001 From: Alex Chantavy Date: Thu, 14 Nov 2024 14:13:28 -0800 Subject: [PATCH 2/3] linter Signed-off-by: Alex Chantavy --- dev-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-entrypoint.sh b/dev-entrypoint.sh index f70f06b12..151e6dba2 100755 --- a/dev-entrypoint.sh +++ b/dev-entrypoint.sh @@ -4,4 +4,4 @@ while ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; do sleep 1 done # Pass control to main container command -exec "$@" \ No newline at end of file +exec "$@" From 631a995fcd0cf474abc874afcf41e1c4b3169f3d Mon Sep 17 00:00:00 2001 From: Alex Chantavy Date: Thu, 14 Nov 2024 14:28:54 -0800 Subject: [PATCH 3/3] better comment Signed-off-by: Alex Chantavy --- dev.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev.Dockerfile b/dev.Dockerfile index 8c7fad36f..63976bd6f 100644 --- a/dev.Dockerfile +++ b/dev.Dockerfile @@ -32,5 +32,5 @@ RUN git config --global --add safe.directory /var/cartography && \ USER ${uid}:${gid} -#RUN chmod +x /var/cartography/dev-entrypoint.sh +# Wait for git to be ready before running anything else. Fix race condition. ENTRYPOINT ["/var/cartography/dev-entrypoint.sh"]