mirror of
https://github.com/drone/drone-git.git
synced 2026-06-13 18:42:15 +08:00
Compare commits
3 Commits
drone_non_root
...
v1.2.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 806bc25846 | |||
| 3d2cbbe9ba | |||
| f7b49aaf9e |
@@ -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
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user