Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
1cda616a
Commit
1cda616a
authored
Oct 13, 2016
by
Łukasz Oleś
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Retry curl when it failed during download
Fixes #34769
parent
786cc3ef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
etcd.sh
hack/lib/etcd.sh
+6
-2
util.sh
hack/lib/util.sh
+19
-0
No files found.
hack/lib/etcd.sh
View file @
1cda616a
...
@@ -74,12 +74,16 @@ kube::etcd::install() {
...
@@ -74,12 +74,16 @@ kube::etcd::install() {
cd
"
${
KUBE_ROOT
}
/third_party"
cd
"
${
KUBE_ROOT
}
/third_party"
if
[[
$(
uname
)
==
"Darwin"
]]
;
then
if
[[
$(
uname
)
==
"Darwin"
]]
;
then
download_file
=
"etcd-v
${
ETCD_VERSION
}
-darwin-amd64.zip"
download_file
=
"etcd-v
${
ETCD_VERSION
}
-darwin-amd64.zip"
curl
-fsSLO
--retry
3
--keepalive-time
2 https://github.com/coreos/etcd/releases/download/v
${
ETCD_VERSION
}
/
"
${
download_file
}
"
url
=
"https://github.com/coreos/etcd/releases/download/v
${
ETCD_VERSION
}
/
${
download_file
}
"
kube::util::download_file
"
${
url
}
"
"
${
download_file
}
"
unzip
-o
"
${
download_file
}
"
unzip
-o
"
${
download_file
}
"
ln
-fns
"etcd-v
${
ETCD_VERSION
}
-darwin-amd64"
etcd
ln
-fns
"etcd-v
${
ETCD_VERSION
}
-darwin-amd64"
etcd
rm
"
${
download_file
}
"
rm
"
${
download_file
}
"
else
else
curl
-fsSL
--retry
3
--keepalive-time
2 https://github.com/coreos/etcd/releases/download/v
${
ETCD_VERSION
}
/etcd-v
${
ETCD_VERSION
}
-linux-amd64
.tar.gz |
tar
xzf -
url
=
"https://github.com/coreos/etcd/releases/download/v
${
ETCD_VERSION
}
/etcd-v
${
ETCD_VERSION
}
-linux-amd64.tar.gz"
download_file
=
"etcd-v
${
ETCD_VERSION
}
-linux-amd64.tar.gz"
kube::util::download_file
"
${
url
}
"
"
${
download_file
}
"
tar
xzf
"
${
download_file
}
"
ln
-fns
"etcd-v
${
ETCD_VERSION
}
-linux-amd64"
etcd
ln
-fns
"etcd-v
${
ETCD_VERSION
}
-linux-amd64"
etcd
fi
fi
kube::log::info
"etcd v
${
ETCD_VERSION
}
installed. To use:"
kube::log::info
"etcd v
${
ETCD_VERSION
}
installed. To use:"
...
...
hack/lib/util.sh
View file @
1cda616a
...
@@ -478,4 +478,23 @@ kube::util::has_changes_against_upstream_branch() {
...
@@ -478,4 +478,23 @@ kube::util::has_changes_against_upstream_branch() {
return
1
return
1
}
}
kube::util::download_file
()
{
local
-r
url
=
$1
local
-r
destination_file
=
$2
rm
${
destination_file
}
2&> /dev/null
||
true
for
i
in
$(
seq
5
)
do
if
!
curl
-fsSL
--retry
3
--keepalive-time
2
${
url
}
-o
${
destination_file
}
;
then
echo
"Downloading
${
url
}
failed.
$((
5
-
i
))
retries left."
sleep
1
else
echo
"Downloading
${
url
}
succeed"
return
0
fi
done
return
1
}
# ex: ts=2 sw=2 et filetype=sh
# ex: ts=2 sw=2 et filetype=sh
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment