Matteo Scandolo | 89c5854 | 2021-10-27 15:48:04 -0700 | [diff] [blame] | 1 | // This keyword will install the voltctl based on the branch (e.g.: voltha-2.8 or master) |
Hardik Windlass | 9658cd2 | 2021-10-25 11:13:25 +0000 | [diff] [blame] | 2 | def call(String branch) { |
Matteo Scandolo | b47a6fd | 2021-10-27 17:02:49 -0700 | [diff] [blame] | 3 | |
| 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 Windlass | 9658cd2 | 2021-10-25 11:13:25 +0000 | [diff] [blame] | 16 | sh returnStdout: false, script: """ |
Matteo Scandolo | b47a6fd | 2021-10-27 17:02:49 -0700 | [diff] [blame] | 17 | |
Hardik Windlass | 9658cd2 | 2021-10-25 11:13:25 +0000 | [diff] [blame] | 18 | mkdir -p $WORKSPACE/bin |
| 19 | cd $WORKSPACE |
Hardik Windlass | 9658cd2 | 2021-10-25 11:13:25 +0000 | [diff] [blame] | 20 | 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 Scandolo | b47a6fd | 2021-10-27 17:02:49 -0700 | [diff] [blame] | 25 | curl -o $WORKSPACE/bin/voltctl -sSL https://github.com/opencord/voltctl/releases/download/v${voltctlVersion}/voltctl-${voltctlVersion}-\${HOSTOS}-\${HOSTARCH} |
Hardik Windlass | 9658cd2 | 2021-10-25 11:13:25 +0000 | [diff] [blame] | 26 | chmod 755 $WORKSPACE/bin/voltctl |
| 27 | voltctl version --clientonly |
| 28 | """ |
| 29 | } |