From cd936ce0c8af1e2520a4030dcf75867ea804ef60 Mon Sep 17 00:00:00 2001 From: Radon Rosborough Date: Mon, 21 Dec 2020 10:47:47 -0800 Subject: [PATCH] Implement runWithUser/fsGroup within entrypoint Addresses https://github.com/runatlantis/helm-charts/issues/14 --- docker-entrypoint.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 572b270d42..f785d204a2 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -3,6 +3,14 @@ set -e # Modified: https://github.com/hashicorp/docker-consul/blob/2c2873f9d619220d1eef0bc46ec78443f55a10b5/0.X/docker-entrypoint.sh +# https://github.com/runatlantis/helm-charts/issues/14 +if [ -d /atlantis-data -a "$(stat -c %U:%G /atlantis-data 2>/dev/null)" != atlantis:atlantis ]; then + echo "docker-entrypoint.sh: detected /atlantis-data wrong filesystem permissions" >&2 + echo "currently owned by $(stat -c %U:%G /atlantis-data 2>/dev/null), changing to atlantis:atlantis..." >&2 + chown -R atlantis:atlantis /atlantis-data + echo "docker-entrypoint.sh: finished changing /atlantis-data filesystem permissions" >&2 +fi + # If the user is trying to run atlantis directly with some arguments, then # pass them to atlantis. if [ "${1:0:1}" = '-' ]; then