File tree 2 files changed +16
-16
lines changed
2 files changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ Clone a commit:
16
16
17
17
```
18
18
docker run --rm \
19
+ -e DRONE_WORKSPACE=/drone \
19
20
-e DRONE_REMOTE_URL=https://github.com/drone/envsubst.git \
20
21
-e DRONE_BUILD_EVENT=push \
21
22
-e DRONE_COMMIT_SHA=15e3f9b7e16332eee3bbdff9ef31f95d23c5da2c \
Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
2
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.
10
16
cd ${DRONE_WORKSPACE}
11
17
fi
12
18
13
- # we default home directory to /home/drone
19
+ # force the home directory path.
14
20
15
21
if [ " $HOME " != " /home/drone" ]; then
22
+ echo " [DEBUG] setting default home directory"
16
23
export HOME=/home/drone
17
24
fi
18
25
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
-
27
26
# if the netrc enviornment variables exist, write
28
27
# the netrc file.
29
28
You can’t perform that action at this time.
0 commit comments