Skip to content

Commit 75dfdcb

Browse files
committed
ci: download awscli from our mirror
This fixes multiple network issues we had when downloading awscli from PyPI on Azure Pipelines by vendoring awscli itself and its dependencies in our S3 bucket. Instructions on how to update the cache are present at the top of src/ci/install-awscli.sh
1 parent 0e9b465 commit 75dfdcb

File tree

3 files changed

+40
-50
lines changed

3 files changed

+40
-50
lines changed

.azure-pipelines/steps/run.yml

+5-37
Original file line numberDiff line numberDiff line change
@@ -138,43 +138,11 @@ steps:
138138

139139
# Ensure the `aws` CLI is installed so we can deploy later on, cache docker
140140
# images, etc.
141-
- bash: |
142-
set -e
143-
# Temporary code to debug #62967.
144-
debug_failed_connections() {
145-
echo "trying to ping pypi.org"
146-
ping pypi.org -c10 || true
147-
echo "trying to ping google.com"
148-
ping google.com -c10 || true
149-
echo "trying to ping 8.8.8.8"
150-
ping 8.8.8.8 -c10 || true
151-
echo "trying to download pypi.org"
152-
curl https://pypi.org || true
153-
echo "trying to download from our S3 bucket"
154-
curl https://rust-lang-ci2.s3.amazonaws.com || true
155-
echo "trying to dig pypi.org"
156-
dig pypi.org || true
157-
echo "trying to dig files.pythonhosted.org"
158-
dig files.pythonhosted.org || true
159-
echo "trying to connect to pypi.org with openssl"
160-
echo | openssl s_client -connect pypi.org:443 || true
161-
echo "trying to connect to files.pythonhosted.org with openssl"
162-
echo | openssl s_client -connect files.pythonhosted.org:443 || true
163-
}
164-
debug_failed_connections_and_fail() {
165-
debug_failed_connections
166-
return 1
167-
}
168-
source src/ci/shared.sh
169-
sudo apt-get install -y python3-setuptools
170-
debug_failed_connections
171-
retry pip3 install -r src/ci/awscli-requirements.txt --upgrade --user || debug_failed_connections_and_fail
172-
echo "##vso[task.prependpath]$HOME/.local/bin"
173-
displayName: Install awscli (Linux)
174-
condition: and(succeeded(), not(variables.SKIP_JOB), eq(variables['Agent.OS'], 'Linux'))
175-
- script: pip install -r src/ci/awscli-requirements.txt
176-
displayName: Install awscli (non-Linux)
177-
condition: and(succeeded(), not(variables.SKIP_JOB), ne(variables['Agent.OS'], 'Linux'))
141+
- bash: src/ci/install-awscli.sh
142+
env:
143+
AGENT_OS: $(Agent.OS)
144+
condition: and(succeeded(), not(variables.SKIP_JOB))
145+
displayName: Install awscli
178146

179147
# Configure our CI_JOB_NAME variable which log analyzers can use for the main
180148
# step to see what's going on.

src/ci/awscli-requirements.txt

-13
This file was deleted.

src/ci/install-awscli.sh

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
# This script downloads and installs awscli from the packages mirrored in our
3+
# own S3 bucket. This follows the recommendations at:
4+
#
5+
# https://packaging.python.org/guides/index-mirrors-and-caches/#caching-with-pip
6+
#
7+
# To create a new mirrored copy you can run the command:
8+
#
9+
# pip wheel awscli
10+
#
11+
# Before compressing please make sure all the wheels end with `-none-any.whl`.
12+
# If that's not the case you'll need to remove the non-cross-platform ones and
13+
# replace them with the .tar.gz downloaded from https://pypi.org. Also make
14+
# sure it's possible to call this script with both Python 2 and Python 3.
15+
16+
set -euo pipefail
17+
IFS=$'\n\t'
18+
19+
MIRROR="https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/2019-07-27-awscli.tar"
20+
DEPS_DIR="/tmp/awscli-deps"
21+
22+
pip="pip"
23+
pipflags=""
24+
if [[ "${AGENT_OS}" == "Linux" ]]; then
25+
pip="pip3"
26+
pipflags="--user"
27+
28+
sudo apt-get install -y python3-setuptools
29+
echo "##vso[task.prependpath]$HOME/.local/bin"
30+
fi
31+
32+
mkdir -p "${DEPS_DIR}"
33+
curl "${MIRROR}" | tar xf - -C "${DEPS_DIR}"
34+
"${pip}" install ${pipflags} --no-index "--find-links=${DEPS_DIR}" awscli
35+
rm -rf "${DEPS_DIR}"

0 commit comments

Comments
 (0)