@@ -35,6 +35,16 @@ rally_repo = ENV.fetch("RALLY_REPO", "https://github.com/elastic/rally.git")
35
35
rally_branch = ENV . fetch ( "RALLY_BRANCH" , "master" )
36
36
rally_sha = ENV . fetch ( "RALLY_SHA" , "" )
37
37
38
+ def curl_wrapper ( max_time = 10 , retry_max_time = 100 , silent = true )
39
+ # Return a curl command prefix that always retries on failure
40
+ basic_command = "curl -SfL --connect-timeout 5 --max-time #{ max_time } --retry 5 --retry-max-time #{ retry_max_time } "
41
+ if silent
42
+ return basic_command << " -s"
43
+ else
44
+ return basic_command
45
+ end
46
+ end
47
+
38
48
def rally_sudoers
39
49
# Use single quotes to avoid interpolating EOF2 intended for bash
40
50
# tilde before 'EOF' allows indenting heredoc without passing the extra leading spaces to actual bash command
@@ -79,22 +89,26 @@ def install_vault
79
89
<<~EOF
80
90
set -eo pipefail
81
91
CUR_HOME=$HOME
82
- curl -fsS -o ${CUR_HOME}/vault.zip https://releases.hashicorp.com/vault/1.1.1/vault_1.1.1_linux_amd64.zip
92
+ #{ curl_wrapper } -o ${CUR_HOME}/vault.zip https://releases.hashicorp.com/vault/1.1.1/vault_1.1.1_linux_amd64.zip
83
93
sudo unzip ${CUR_HOME}/vault.zip -d /usr/local/bin
84
94
sudo chmod +x /usr/local/bin/vault
85
95
rm ${CUR_HOME}/vault.zip
86
96
EOF
87
97
end
88
98
89
99
def install_rally_source ( rally_repo , rally_branch , rally_sha )
100
+ # Remove OS packages for python3-pip and python3-setuptools; we prefer per account installation of pip3
90
101
<<~EOF
91
102
set -eo pipefail
92
103
apt-get update
104
+ apt-get purge -y python3\* -pip python3\* -setuptools
93
105
apt-get install -y python-virtualenv
94
- apt-get install -y python3-pip
106
+ apt-get install -y python3-dev
95
107
sudo -iu jenkins bash -c '
96
- pip3 install --user setuptools;
97
108
cd /var/lib/jenkins;
109
+ #{ curl_wrapper } https://bootstrap.pypa.io/get-pip.py -o get-pip.py;
110
+ python3 get-pip.py --user;
111
+ rm get-pip.py;
98
112
mkdir src bin;
99
113
cd src;
100
114
git clone #{ rally_repo } --branch #{ rally_branch } ;
@@ -162,11 +176,11 @@ end
162
176
def install_java ( major_ver )
163
177
<<~EOF
164
178
set -eo pipefail
165
- jdk_url=$(curl -fsSL https://jvm-catalog.elastic.co/jdk/latest_openjdk_#{ major_ver } _linux | jq -r .url)
179
+ jdk_url=$(#{ curl_wrapper } https://jvm-catalog.elastic.co/jdk/latest_openjdk_#{ major_ver } _linux | jq -r .url)
166
180
cd /var/lib/jenkins
167
181
mkdir -p .java/openjdk#{ major_ver }
168
182
cd .java/openjdk#{ major_ver }
169
- curl --progress-bar -fSL -o java#{ major_ver } .tgz $jdk_url
183
+ #{ curl_wrapper ( max_time = 300 , retry_max_time = 1800 , silent = false ) } --progress-bar -o java#{ major_ver } .tgz $jdk_url
170
184
tar zxf java#{ major_ver } .tgz --strip-components=1
171
185
rm -f java#{ major_ver } .tgz
172
186
cd ../../
0 commit comments