Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
f85118d1
Commit
f85118d1
authored
May 03, 2017
by
ReSearchITEng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added possibility to set desired install version. See issue #2380
parent
7b77bd32
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
12 deletions
+46
-12
get
scripts/get
+46
-12
No files found.
scripts/get
View file @
f85118d1
...
...
@@ -62,31 +62,31 @@ verifySupported() {
fi
}
# check
LatestVersion checks the latest available version
.
check
Latest
Version
()
{
# Use the GitHub releases webpage for the project to find the
latest
version for this project.
local
latest_url
=
"https://github.com/kubernetes/helm/releases/latest
"
# check
DesiredVersion checks if the desired version is available
.
check
Desired
Version
()
{
# Use the GitHub releases webpage for the project to find the
desired
version for this project.
local
release_url
=
"https://github.com/kubernetes/helm/releases/
${
DESIRED_VERSION
:-
latest
}
"
if
type
"curl"
>
/dev/null
;
then
TAG
=
$(
curl
-SsL
$
latest
_url
|
awk
'/\/tag\//'
|
head
-n
1 |
cut
-d
'"'
-f
2 |
awk
'{n=split($NF,a,"/");print a[n]}'
)
TAG
=
$(
curl
-SsL
$
release
_url
|
awk
'/\/tag\//'
|
head
-n
1 |
cut
-d
'"'
-f
2 |
awk
'{n=split($NF,a,"/");print a[n]}'
)
elif
type
"wget"
>
/dev/null
;
then
TAG
=
$(
wget
-q
-O
-
$
latest
_url
|
awk
'/\/tag\//'
|
head
-n
1 |
cut
-d
'"'
-f
2 |
awk
'{n=split($NF,a,"/");print a[n]}'
)
TAG
=
$(
wget
-q
-O
-
$
release
_url
|
awk
'/\/tag\//'
|
head
-n
1 |
cut
-d
'"'
-f
2 |
awk
'{n=split($NF,a,"/");print a[n]}'
)
fi
if
[
"x
$TAG
"
==
"x"
]
;
then
echo
"Cannot determine
latest
tag."
echo
"Cannot determine
${
DESIRED_VERSION
}
tag."
exit
1
fi
}
# checkHelmInstalledVersion checks which version of helm is installed and
# if it needs to be
updat
ed.
# if it needs to be
chang
ed.
checkHelmInstalledVersion
()
{
if
[[
-f
"
${
HELM_INSTALL_DIR
}
/
${
PROJECT_NAME
}
"
]]
;
then
local
version
=
$(
helm version |
grep
'^Client'
|
cut
-d
'"'
-f2
)
if
[[
"
$version
"
==
"
$TAG
"
]]
;
then
echo
"Helm
${
version
}
is
up-to-date.
"
echo
"Helm
${
version
}
is
already
${
DESIRED_VERSION
:-
latest
}
"
return
0
else
echo
"Helm
${
TAG
}
is available.
Upgrad
ing from version
${
version
}
."
echo
"Helm
${
TAG
}
is available.
Chang
ing from version
${
version
}
."
return
1
fi
else
...
...
@@ -137,7 +137,12 @@ installFile() {
fail_trap
()
{
result
=
$?
if
[
"
$result
"
!=
"0"
]
;
then
echo
"Failed to install
$PROJECT_NAME
"
if
[[
-n
"
$INPUT_ARGUMENTS
"
]]
;
then
echo
"Failed to install
$PROJECT_NAME
with the arguments provided:
$INPUT_ARGUMENTS
"
help
else
echo
"Failed to install
$PROJECT_NAME
"
fi
echo
-e
"
\t
For support, go to https://github.com/kubernetes/helm."
fi
exit
$result
...
...
@@ -156,15 +161,44 @@ testVersion() {
echo
"Run '
$PROJECT_NAME
init' to configure
$PROJECT_NAME
."
}
# help provides possible cli installation arguments
help
()
{
echo
"Accepted cli arguments are:"
echo
-e
"
\t
[--help|-h ] ->> prints this help"
echo
-e
"
\t
[--version|-v <desired_version>] . When not defined it defaults to latest"
echo
-e
"
\t
e.g. --version v2.4.0 or -v latest"
}
# Execution
#Stop execution on any error
trap
"fail_trap"
EXIT
set
-e
# Parsing input arguments (if any)
export
INPUT_ARGUMENTS
=
"
${
@
}
"
set
-u
while
[[
$#
-gt
0
]]
;
do
case
$1
in
'--version'
|
-v
)
export
DESIRED_VERSION
=
"
${
2
}
"
shift
;;
'--help'
|
-h
)
help
exit
0
;;
*
)
exit
1
;;
esac
shift
done
set
+u
initArch
initOS
verifySupported
check
Latest
Version
check
Desired
Version
if
!
checkHelmInstalledVersion
;
then
downloadFile
installFile
...
...
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