blob: 827d8905324f50d5e36688911d40da43814fb55b [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) {
3 sh returnStdout: false, script: """
4 mkdir -p $WORKSPACE/bin
5 cd $WORKSPACE
6 if [ "${branch}" == "voltha-2.8" ]; then
7 VOLTCTL_VERSION=1.6.11
8 else
9 VOLTCTL_VERSION=\$(curl -sSL https://api.github.com/repos/opencord/voltctl/releases/latest | jq -r .tag_name | sed -e 's/^v//g')
10 fi
11 HOSTOS=\$(uname -s | tr "[:upper:]" "[:lower:"])
12 HOSTARCH=\$(uname -m | tr "[:upper:]" "[:lower:"])
13 if [ \$HOSTARCH == "x86_64" ]; then
14 HOSTARCH="amd64"
15 fi
16 curl -o $WORKSPACE/bin/voltctl -sSL https://github.com/opencord/voltctl/releases/download/v\${VOLTCTL_VERSION}/voltctl-\${VOLTCTL_VERSION}-\${HOSTOS}-\${HOSTARCH}
17 chmod 755 $WORKSPACE/bin/voltctl
18 voltctl version --clientonly
19 """
20}