blob: dad20ffdc88cd7cd473e5ca831ceafbbf84d11c6 [file] [log] [blame]
Matteo Scandolo89c58542021-10-27 15:48:04 -07001// This keyword will install the voltctl based on the branch (e.g.: voltha-2.8 or master)
Hardik Windlass9658cd22021-10-25 11:13:25 +00002def call(String branch) {
Matteo Scandolob47a6fd2021-10-27 17:02:49 -07003
4 def voltctlVersion = ""
5 if (branch == "voltha-2.8") {
6 voltctlVersion = "1.6.11"
Hardik Windlassb9d63202022-02-10 04:52:14 +00007 } else if (branch == "voltha-2.9") {
8 voltctlVersion = "1.7.4"
Hardik Windlass19605da2022-06-30 22:05:57 +05309 } else if (branch == "voltha-2.10") {
10 voltctlVersion = "1.7.6"
Matteo Scandolob47a6fd2021-10-27 17:02:49 -070011 } else {
12 voltctlVersion = sh (
13 script: "curl -sSL https://api.github.com/repos/opencord/voltctl/releases/latest | jq -r .tag_name | sed -e 's/^v//g'",
14 returnStdout: true
15 ).trim()
16 }
17
18 println "Installing voltctl version ${voltctlVersion} on branch ${branch}"
19
Hardik Windlass9658cd22021-10-25 11:13:25 +000020 sh returnStdout: false, script: """
Matteo Scandolob47a6fd2021-10-27 17:02:49 -070021
Hardik Windlass9658cd22021-10-25 11:13:25 +000022 mkdir -p $WORKSPACE/bin
23 cd $WORKSPACE
Hardik Windlass9658cd22021-10-25 11:13:25 +000024 HOSTOS=\$(uname -s | tr "[:upper:]" "[:lower:"])
25 HOSTARCH=\$(uname -m | tr "[:upper:]" "[:lower:"])
26 if [ \$HOSTARCH == "x86_64" ]; then
27 HOSTARCH="amd64"
28 fi
Matteo Scandolob47a6fd2021-10-27 17:02:49 -070029 curl -o $WORKSPACE/bin/voltctl -sSL https://github.com/opencord/voltctl/releases/download/v${voltctlVersion}/voltctl-${voltctlVersion}-\${HOSTOS}-\${HOSTARCH}
Hardik Windlass9658cd22021-10-25 11:13:25 +000030 chmod 755 $WORKSPACE/bin/voltctl
31 voltctl version --clientonly
32 """
33}