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