mirror of
https://github.com/drone/drone-git.git
synced 2026-06-13 18:42:15 +08:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 806bc25846 | |||
| 3d2cbbe9ba | |||
| f7b49aaf9e | |||
| be769618aa | |||
| 487521c8bc | |||
| 79700f47fe | |||
| 41c2120a63 | |||
| 9a0e8cc9d6 | |||
| 16f4dd8829 | |||
| e2f563e07f | |||
| 56e4928d73 | |||
| 70fe2c5f68 | |||
| f006eebba3 | |||
| 937b910001 | |||
| 6647ff2107 | |||
| a0b9eebc4f |
@@ -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 \
|
||||
|
||||
@@ -1,31 +1,10 @@
|
||||
FROM alpine:3.12
|
||||
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl
|
||||
|
||||
ENV GLIBC_VER=2.31-r0
|
||||
RUN apk --no-cache add \
|
||||
binutils \
|
||||
curl \
|
||||
&& curl -sL https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub \
|
||||
&& curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-${GLIBC_VER}.apk \
|
||||
&& curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk \
|
||||
&& apk add --no-cache \
|
||||
glibc-${GLIBC_VER}.apk \
|
||||
glibc-bin-${GLIBC_VER}.apk \
|
||||
&& curl -sL https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.1.24.zip -o awscliv2.zip \
|
||||
&& unzip awscliv2.zip \
|
||||
&& aws/install \
|
||||
&& rm -rf \
|
||||
awscliv2.zip \
|
||||
aws \
|
||||
/usr/local/aws-cli/v2/*/dist/aws_completer \
|
||||
/usr/local/aws-cli/v2/*/dist/awscli/data/ac.index \
|
||||
/usr/local/aws-cli/v2/*/dist/awscli/examples \
|
||||
&& apk --no-cache del \
|
||||
binutils \
|
||||
curl \
|
||||
&& rm glibc-${GLIBC_VER}.apk \
|
||||
&& rm glibc-bin-${GLIBC_VER}.apk \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl aws-cli sudo
|
||||
|
||||
ADD posix/* /usr/local/bin/
|
||||
ENTRYPOINT ["/usr/local/bin/clone"]
|
||||
RUN adduser -g Drone -s /bin/sh -D -u 1000 drone
|
||||
RUN echo 'drone ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/drone
|
||||
USER drone:drone
|
||||
RUN chmod -R 777 /home/drone
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/clone"]
|
||||
@@ -1,5 +1,9 @@
|
||||
FROM arm32v6/alpine:3.12
|
||||
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl
|
||||
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl aws-cli sudo
|
||||
|
||||
ADD posix/* /usr/local/bin/
|
||||
RUN adduser -g Drone -s /bin/sh -D -u 1000 drone
|
||||
RUN echo 'drone ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/drone
|
||||
USER drone:drone
|
||||
RUN chmod -R 777 /home/drone
|
||||
ENTRYPOINT ["/usr/local/bin/clone"]
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
FROM arm32v6/alpine:3.12
|
||||
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl
|
||||
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl aws-cli sudo
|
||||
|
||||
ADD posix/* /usr/local/bin/
|
||||
RUN adduser -g Drone -s /bin/sh -D -u 1000 drone
|
||||
RUN echo 'drone ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/drone
|
||||
USER drone:drone
|
||||
RUN chmod -R 777 /home/drone
|
||||
ENTRYPOINT ["/usr/local/bin/clone"]
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
FROM arm64v8/alpine:3.12
|
||||
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl
|
||||
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl aws-cli sudo
|
||||
|
||||
ADD posix/* /usr/local/bin/
|
||||
RUN adduser -g Drone -s /bin/sh -D -u 1000 drone
|
||||
RUN echo 'drone ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/drone
|
||||
USER drone:drone
|
||||
RUN chmod -R 777 /home/drone
|
||||
ENTRYPOINT ["/usr/local/bin/clone"]
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
FROM arm32v6/alpine:3.12
|
||||
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl
|
||||
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl aws-cli sudo
|
||||
|
||||
ADD posix/* /usr/local/bin/
|
||||
RUN adduser -g Drone -s /bin/sh -D -u 1000 drone
|
||||
RUN echo 'drone ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/drone
|
||||
USER drone:drone
|
||||
RUN chmod -R 777 /home/drone
|
||||
ENTRYPOINT ["/usr/local/bin/clone"]
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
FROM arm64v8/alpine:3.12
|
||||
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl
|
||||
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl aws-cli sudo
|
||||
|
||||
ADD posix/* /usr/local/bin/
|
||||
RUN adduser -g Drone -s /bin/sh -D -u 1000 drone
|
||||
RUN echo 'drone ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/drone
|
||||
USER drone:drone
|
||||
RUN chmod -R 777 /home/drone
|
||||
ENTRYPOINT ["/usr/local/bin/clone"]
|
||||
|
||||
+24
-7
@@ -1,14 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [[ ! -z "${DRONE_WORKSPACE}" ]]; then
|
||||
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
|
||||
|
||||
# force the home directory path.
|
||||
|
||||
if [ "$HOME" != "/home/drone" ]; then
|
||||
echo "[DEBUG] setting default home directory"
|
||||
export HOME=/home/drone
|
||||
fi
|
||||
|
||||
# if the netrc enviornment variables exist, write
|
||||
# the netrc file.
|
||||
|
||||
if [[ ! -z "${DRONE_NETRC_MACHINE}" ]]; then
|
||||
cat <<EOF > /root/.netrc
|
||||
cat <<EOF > ${HOME}/.netrc
|
||||
machine ${DRONE_NETRC_MACHINE}
|
||||
login ${DRONE_NETRC_USERNAME}
|
||||
password ${DRONE_NETRC_PASSWORD}
|
||||
@@ -20,12 +37,12 @@ fi
|
||||
# known hosts file.
|
||||
|
||||
if [[ ! -z "${DRONE_SSH_KEY}" ]]; then
|
||||
mkdir /root/.ssh
|
||||
echo -n "$DRONE_SSH_KEY" > /root/.ssh/id_rsa
|
||||
chmod 600 /root/.ssh/id_rsa
|
||||
mkdir ${HOME}/.ssh
|
||||
echo -n "$DRONE_SSH_KEY" > ${HOME}/.ssh/id_rsa
|
||||
chmod 600 ${HOME}/.ssh/id_rsa
|
||||
|
||||
touch /root/.ssh/known_hosts
|
||||
chmod 600 /root/.ssh/known_hosts
|
||||
touch ${HOME}/.ssh/known_hosts
|
||||
chmod 600 ${HOME}/.ssh/known_hosts
|
||||
ssh-keyscan -H ${DRONE_NETRC_MACHINE} > /etc/ssh/ssh_known_hosts 2> /dev/null
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user