Skip to content

Commit

Permalink
ci: Recurl (argoproj#2769)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexec committed Apr 21, 2020
1 parent ef08e64 commit af9f61e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
12 changes: 4 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,10 @@ RUN apt-get update && \
/usr/share/man \
/usr/share/doc \
/usr/share/doc-base
RUN if [ "${IMAGE_OS}" = "linux" -a "${IMAGE_ARCH}" = "amd64" ]; then \
curl --retry 3 -L -o /usr/local/bin/kubectl -LO https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl; \
elif [ "${IMAGE_OS}" = "linux" -a "${IMAGE_ARCH}" = "arm64" ]; then \
curl --retry 3 -L -o /usr/local/bin/kubectl -LO https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/arm64/kubectl; \
fi && \
chmod +x /usr/local/bin/kubectl
RUN curl --retry 3 -L -o /usr/local/bin/jq -LO https://github.com/stedolan/jq/releases/download/jq-${JQ_VERSION}/jq-linux64 && \
chmod +x /usr/local/bin/jq
ADD hack/recurl.sh .
RUN ./recurl.sh /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/${IMAGE_ARCH}/kubectl
RUN ./recurl.sh /usr/local/bin/jq https://github.com/stedolan/jq/releases/download/jq-${JQ_VERSION}/jq-linux64
RUN rm recurl.sh
COPY hack/ssh_known_hosts /etc/ssh/ssh_known_hosts
COPY --from=builder /usr/local/bin/docker /usr/local/bin/

Expand Down
12 changes: 4 additions & 8 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,10 @@ RUN apt-get update && \
/usr/share/man \
/usr/share/doc \
/usr/share/doc-base
RUN if [ "${IMAGE_OS}" = "linux" -a "${IMAGE_ARCH}" = "amd64" ]; then \
curl --retry 3 -L -o /usr/local/bin/kubectl -LO https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl; \
elif [ "${IMAGE_OS}" = "linux" -a "${IMAGE_ARCH}" = "arm64" ]; then \
curl --retry 3 -L -o /usr/local/bin/kubectl -LO https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/arm64/kubectl; \
fi && \
chmod +x /usr/local/bin/kubectl
RUN curl --retry 3 -L -o /usr/local/bin/jq -LO https://github.com/stedolan/jq/releases/download/jq-${JQ_VERSION}/jq-linux64 && \
chmod +x /usr/local/bin/jq
ADD hack/recurl.sh .
RUN ./recurl.sh /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/${IMAGE_ARCH}/kubectl
RUN ./recurl.sh /usr/local/bin/jq https://github.com/stedolan/jq/releases/download/jq-${JQ_VERSION}/jq-linux64
RUN rm recurl.sh
COPY hack/ssh_known_hosts /etc/ssh/ssh_known_hosts
COPY --from=builder /usr/local/bin/docker /usr/local/bin/

Expand Down
2 changes: 1 addition & 1 deletion hack/maybe-skip-job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ job=$1
diffs=$(git diff --name-only origin/master)

# if certain files change, then we always run
[ "$(echo "$diffs" | grep Makefile)" != "" ] && exit
[ "$(echo "$diffs" | grep 'Dockerfile\|Makefile')" != "" ] && exit

# if there are changes to this areas, we must run
rx=
Expand Down
13 changes: 13 additions & 0 deletions hack/recurl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
set -eux -o pipefail

file=$1
url=$2

# loop forever
while ! curl -c -L -o "$file" -LO -- "$url" ;do
echo "sleeping before trying again"
sleep 10s
done

chmod +x "$file"

0 comments on commit af9f61e

Please sign in to comment.