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" |
Hardik Windlass | b9d6320 | 2022-02-10 04:52:14 +0000 | [diff] [blame] | 7 | } else if (branch == "voltha-2.9") { |
| 8 | voltctlVersion = "1.7.4" |
Matteo Scandolo | b47a6fd | 2021-10-27 17:02:49 -0700 | [diff] [blame] | 9 | } 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 Windlass | 9658cd2 | 2021-10-25 11:13:25 +0000 | [diff] [blame] | 18 | sh returnStdout: false, script: """ |
Matteo Scandolo | b47a6fd | 2021-10-27 17:02:49 -0700 | [diff] [blame] | 19 | |
Hardik Windlass | 9658cd2 | 2021-10-25 11:13:25 +0000 | [diff] [blame] | 20 | mkdir -p $WORKSPACE/bin |
| 21 | cd $WORKSPACE |
Hardik Windlass | 9658cd2 | 2021-10-25 11:13:25 +0000 | [diff] [blame] | 22 | 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 Scandolo | b47a6fd | 2021-10-27 17:02:49 -0700 | [diff] [blame] | 27 | 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] | 28 | chmod 755 $WORKSPACE/bin/voltctl |
| 29 | voltctl version --clientonly |
| 30 | """ |
| 31 | } |