blob: d75beb10c28130f5f0dc21f7ee100e4d9d96a91f [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"
Matteo Scandolob47a6fd2021-10-27 17:02:49 -07009 } else {
10 voltctlVersion = sh (
11 script: "curl -sSL https://api.github.com/repos/opencord/voltctl/releases/latest | jq -r .tag_name | sed -e 's/^v//g'",
12 returnStdout: true
13 ).trim()
14 }
15
16 println "Installing voltctl version ${voltctlVersion} on branch ${branch}"
17
Hardik Windlass9658cd22021-10-25 11:13:25 +000018 sh returnStdout: false, script: """
Matteo Scandolob47a6fd2021-10-27 17:02:49 -070019
Hardik Windlass9658cd22021-10-25 11:13:25 +000020 mkdir -p $WORKSPACE/bin
21 cd $WORKSPACE
Hardik Windlass9658cd22021-10-25 11:13:25 +000022 HOSTOS=\$(uname -s | tr "[:upper:]" "[:lower:"])
23 HOSTARCH=\$(uname -m | tr "[:upper:]" "[:lower:"])
24 if [ \$HOSTARCH == "x86_64" ]; then
25 HOSTARCH="amd64"
26 fi
Matteo Scandolob47a6fd2021-10-27 17:02:49 -070027 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 +000028 chmod 755 $WORKSPACE/bin/voltctl
29 voltctl version --clientonly
30 """
31}