Joey Armstrong | deb7529 | 2023-08-24 17:06:33 -0400 | [diff] [blame] | 1 | #!/usr/bin/env groovy |
| 2 | // ----------------------------------------------------------------------- |
Joey Armstrong | 518f357 | 2024-02-11 07:56:25 -0500 | [diff] [blame] | 3 | // Copyright 2021-2024 Open Networking Foundation (ONF) and the ONF Contributors |
Joey Armstrong | deb7529 | 2023-08-24 17:06:33 -0400 | [diff] [blame] | 4 | // |
| 5 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | // you may not use this file except in compliance with the License. |
| 7 | // You may obtain a copy of the License at |
| 8 | // |
| 9 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | // |
| 11 | // Unless required by applicable law or agreed to in writing, software |
| 12 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | // See the License for the specific language governing permissions and |
| 15 | // limitations under the License. |
| 16 | // ----------------------------------------------------------------------- |
| 17 | // Install the voltctl command by branch name "voltha-xx" |
| 18 | // ----------------------------------------------------------------------- |
| 19 | |
| 20 | // ----------------------------------------------------------------------- |
| 21 | // ----------------------------------------------------------------------- |
| 22 | String getIam(String func) { |
| 23 | // Cannot rely on a stack trace due to jenkins manipulation |
| 24 | String src = 'vars/installKind.groovy' |
| 25 | String iam = [src, func].join('::') |
| 26 | return iam |
| 27 | } |
| 28 | |
| 29 | // ----------------------------------------------------------------------- |
| 30 | // ----------------------------------------------------------------------- |
| 31 | Boolean process() { |
| 32 | String iam = getIam('process') |
| 33 | Boolean ans = true |
| 34 | |
| 35 | println("** ${iam}: ENTER") |
| 36 | |
| 37 | String cmd = [ |
| 38 | 'make', |
| 39 | '--no-print-directory', |
| 40 | '-C', "$WORKSPACE/voltha-system-tests", |
| 41 | "KIND_PATH=\"$WORKSPACE/bin\"", |
| 42 | 'install-command-kind', |
| 43 | ].join(' ') |
| 44 | |
| 45 | println(" ** Running: ${cmd}") |
| 46 | sh( |
| 47 | label : 'Install: kind', // jenkins usability: label log entry 'step' |
| 48 | script : "${cmd}", |
| 49 | ) |
| 50 | |
| 51 | println("** ${iam}: LEAVE") |
| 52 | return(ans) |
| 53 | } |
| 54 | |
| 55 | // ----------------------------------------------------------------------- |
| 56 | // Install: Jenkins/groovy callback for installing the kind command. |
| 57 | // o Paramter branch is passed but not yet used. |
| 58 | // o Installer should be release friendly and checkout a frozen version |
| 59 | // ----------------------------------------------------------------------- |
| 60 | def call(String branch) { |
| 61 | String iam = getIam('main') |
| 62 | |
| 63 | println("** ${iam}: ENTER branch=${branch}") |
| 64 | println('** WARNING: branch= Not Yet Implemented') |
| 65 | |
| 66 | try { |
| 67 | process() |
| 68 | } |
| 69 | catch (Exception err) { |
| 70 | println("** ${iam}: EXCEPTION ${err}") |
| 71 | throw err |
| 72 | } |
| 73 | finally { |
| 74 | println("** ${iam}: LEAVE") |
| 75 | } |
| 76 | return |
| 77 | } |
| 78 | |
| 79 | // [EOF] |