Skip to content

Commit e39c024

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 e39c024

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

entrypoint.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,14 @@ 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+
echo "UID: $LOCAL_UID"
51+
else
52+
LOCAL_UID="$(stat -c %u .)"
53+
LOCAL_GID="$(stat -c %g .)"
54+
echo "UID(stat): $LOCAL_UID"
55+
fi
56+
info "Setting owner/group of $local_path to ${LOCAL_UID:-root}:${LOCAL_GID:-root}"
57+
chown -R "${LOCAL_UID:-root}:${LOCAL_GID:-root}" $local_path

0 commit comments

Comments
 (0)