I was trying to address the problem of triggering downstream builds in the simplest way I could think of. I built a small docker image containing the drone-cli
.
# Dockerfile
FROM alpine
RUN apk add --update \
&& apk add curl \
&& rm -rf /var/cache/apk/* \
&& curl http://downloads.drone.io/release/linux/amd64/drone.tar.gz | tar zx
&& install -t /usr/local/bin drone
COPY ./entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/bin/sh","/entrypoint.sh"]
And then my script would simply get the most recent build and start it again:
# entrypoint.sh
build_number=$(drone build last $REPOSITORY | head -n 1 | cut -d " " -f 2)
echo "Rerunning the most recent build #$build_number now."
drone build start $REPOSITORY $build_number
This is a rather blunt approach, but it seemed to me that it wold work just fine. In fact, when I pass the container ENV vars locally, it runs like a champ.
But, when I put it in my .drone.yml
to run, it pulls the image and fails reporting: ERROR: Error response from daemon: readdirent: not a directory
. After googling and coming up with very little, I started removing lines of code until I found what appears to be causing the error.
This step in my docker build, while working locally, will fail when run by drone: curl http://downloads.drone.io/release/linux/amd64/drone.tar.gz | tar zx
Any idea why this might be? Or how to get around it?
Thanks!