Skip to content

Commit 50446a9

Browse files
committed
Get uid/gid from local container fs
Get uid/gid from local container fs unless ACTION_UID/ACTION_GID environment variables are explicitly provided Signed-off-by: Kostis Papazafeiropoulos <[email protected]>
1 parent ef4e94a commit 50446a9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

entrypoint.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,12 @@ mc cp -r s3/$remote_path $local_path
4444
ok_or_die "Could not fetch object"
4545

4646
# Fix owner of local path
47-
chown -R "${ACTION_UID:-root}:${ACTION_GID:-root}" $local_path
47+
if [ -n "${ACTION_UID}"] && [ -n "${ACTION_GID}"]; then
48+
LOCAL_UID="${ACTION_UID}"
49+
LOCAL_GID="${ACTION_GID}"
50+
else
51+
LOCAL_UID="$(stat -c %u .)"
52+
LOCAL_GID="$(stat -c %g .)"
53+
fi
54+
info "Setting owner/group of $local_path to ${LOCAL_UID:-root}:${LOCAL_GID:-root}"
55+
chown -R "${LOCAL_UID:-root}:${LOCAL_GID:-root}" $local_path

0 commit comments

Comments
 (0)