3 Commits

Author SHA1 Message Date
Brad Rydzewski 806bc25846 remove debug log entry 2021-05-06 14:40:28 -04:00
Brad Rydzewski 3d2cbbe9ba Merge remote-tracking branch 'origin/drone_non_root' into drone_non_root 2021-05-06 14:39:26 -04:00
Brad Rydzewski f7b49aaf9e update readme and annotate code with change 2021-05-06 14:39:13 -04:00
2 changed files with 14 additions and 16 deletions
+1
View File
@@ -16,6 +16,7 @@ Clone a commit:
```
docker run --rm \
-e DRONE_WORKSPACE=/drone \
-e DRONE_REMOTE_URL=https://github.com/drone/envsubst.git \
-e DRONE_BUILD_EVENT=push \
-e DRONE_COMMIT_SHA=15e3f9b7e16332eee3bbdff9ef31f95d23c5da2c \
+13 -16
View File
@@ -1,29 +1,26 @@
#!/bin/sh
if [[ ! -z "${DRONE_WORKSPACE}" ]]; then
if [[ -n "${CI}" ]]; then
sudo mkdir -p ${DRONE_WORKSPACE}
sudo chown drone:drone ${DRONE_WORKSPACE}
else
mkdir -p ${DRONE_WORKSPACE}
fi
if [[ -n "${DRONE_WORKSPACE}" ]]; then
# ensure the unprivileged drone user can write
# to the workspace. This is required because
# the workspace is a docker volume and is owned
# by root.
sudo mkdir -p ${DRONE_WORKSPACE}
sudo chown drone:drone ${DRONE_WORKSPACE}
# ensure the workspace is the current working
# directory. This should already be the case,
# but we cd just to be safe.
cd ${DRONE_WORKSPACE}
fi
# we default home directory to /home/drone
# force the home directory path.
if [ "$HOME" != "/home/drone" ]; then
echo "[DEBUG] setting default home directory"
export HOME=/home/drone
fi
# if the home directory does not exist it should
# be created.
if [ ! -d "${HOME}" ]; then
echo "HOME directory does not exist; creating ${HOME}"
mkdir -p ${HOME}
fi
# if the netrc enviornment variables exist, write
# the netrc file.