Skip to content

Commit f7b49aa

Browse files
committed
update readme and annotate code with change
1 parent 487521c commit f7b49aa

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Clone a commit:
1616

1717
```
1818
docker run --rm \
19+
-e DRONE_WORKSPACE=/drone \
1920
-e DRONE_REMOTE_URL=https://github.com/drone/envsubst.git \
2021
-e DRONE_BUILD_EVENT=push \
2122
-e DRONE_COMMIT_SHA=15e3f9b7e16332eee3bbdff9ef31f95d23c5da2c \

posix/clone

+15-16
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
#!/bin/sh
22

3-
if [[ ! -z "${DRONE_WORKSPACE}" ]]; then
4-
if [[ -n "${CI}" ]]; then
5-
sudo mkdir -p ${DRONE_WORKSPACE}
6-
sudo chown drone:drone ${DRONE_WORKSPACE}
7-
else
8-
mkdir -p ${DRONE_WORKSPACE}
9-
fi
3+
if [[ -n "${DRONE_WORKSPACE}" ]]; then
4+
echo "[DEBUG] creating drone workspace"
5+
6+
# ensure the unprivileged drone user can write
7+
# to the workspace. This is required because
8+
# the workspace is a docker volume and is owned
9+
# by root.
10+
sudo mkdir -p ${DRONE_WORKSPACE}
11+
sudo chown drone:drone ${DRONE_WORKSPACE}
12+
13+
# ensure the workspace is the current working
14+
# directory. This should already be the case,
15+
# but we cd just to be safe.
1016
cd ${DRONE_WORKSPACE}
1117
fi
1218

13-
# we default home directory to /home/drone
19+
# force the home directory path.
1420

1521
if [ "$HOME" != "/home/drone" ]; then
22+
echo "[DEBUG] setting default home directory"
1623
export HOME=/home/drone
1724
fi
1825

19-
# if the home directory does not exist it should
20-
# be created.
21-
22-
if [ ! -d "${HOME}" ]; then
23-
echo "HOME directory does not exist; creating ${HOME}"
24-
mkdir -p ${HOME}
25-
fi
26-
2726
# if the netrc enviornment variables exist, write
2827
# the netrc file.
2928

0 commit comments

Comments
 (0)