Joey Armstrong | af679da | 2023-01-31 14:22:41 -0500 | [diff] [blame] | 1 | #!/usr/bin/env groovy |
| 2 | // ----------------------------------------------------------------------- |
| 3 | // Copyright 2021-2023 Open Networking Foundation (ONF) and the ONF Contributors |
| 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 | |
Matteo Scandolo | 660e4af | 2021-04-02 11:16:09 -0700 | [diff] [blame] | 18 | // returns the helm flags required to override a specific image |
Joey Armstrong | 28e86ee | 2023-08-03 15:22:29 -0400 | [diff] [blame] | 19 | String call(String project = 'unknown', String tag = 'citest', String pullPolicy = 'Never') { |
Joey Armstrong | 0fc63c9 | 2023-08-03 16:53:14 -0400 | [diff] [blame] | 20 | String chart = 'unknown' |
| 21 | String image = 'unknown' |
| 22 | switch (project) { |
| 23 | case 'ofagent-go': |
| 24 | chart = 'voltha' |
| 25 | image = 'ofagent' |
| 26 | break |
| 27 | case 'voltha-go': |
| 28 | chart = 'voltha' |
| 29 | image = 'rw_core' |
| 30 | break |
| 31 | case 'voltha-openonu-adapter-go': |
| 32 | chart = 'voltha-adapter-openonu' |
| 33 | image = 'adapter_open_onu_go' |
| 34 | break |
| 35 | // TODO end |
| 36 | case 'voltha-openolt-adapter': |
| 37 | chart = 'voltha-adapter-openolt' |
| 38 | image = 'adapter_open_olt' |
| 39 | break |
| 40 | case 'bbsim': |
| 41 | // BBSIM has a different format that voltha, return directly |
| 42 | String ans = [ |
| 43 | "--set images.bbsim.tag=${tag}", |
| 44 | "images.bbsim.pullPolicy=${pullPolicy}", |
| 45 | "images.bbsim.registry=''", |
| 46 | ].join(',') |
| 47 | return(ans) |
| 48 | break |
| 49 | case 'voltha-onos': |
| 50 | String ans = [ |
Mahir Gunyel | daa38a3 | 2024-01-04 12:50:20 -0800 | [diff] [blame] | 51 | '--set onos-classic.image.repository=voltha/voltha-onos', |
Joey Armstrong | 0fc63c9 | 2023-08-03 16:53:14 -0400 | [diff] [blame] | 52 | 'onos-classic.image.tag=citest', |
| 53 | "onos-classic.image.pullPolicy=${pullPolicy}", |
| 54 | ].join(',') |
| 55 | return (ans) |
| 56 | break |
| 57 | default: |
| 58 | return '' |
| 59 | break |
| 60 | } |
Matteo Scandolo | 660e4af | 2021-04-02 11:16:09 -0700 | [diff] [blame] | 61 | |
Joey Armstrong | 0fc63c9 | 2023-08-03 16:53:14 -0400 | [diff] [blame] | 62 | String ans = [ |
| 63 | "--set ${chart}.images.${image}.tag=${tag}", |
| 64 | "${chart}.images.${image}.pullPolicy=${pullPolicy}", |
| 65 | "${chart}.images.${image}.registry='' " |
| 66 | ].join(',') |
| 67 | |
Joey Armstrong | 28e86ee | 2023-08-03 15:22:29 -0400 | [diff] [blame] | 68 | println("getVolthaImageFlags return ${ans}") |
| 69 | return(ans) |
Matteo Scandolo | 660e4af | 2021-04-02 11:16:09 -0700 | [diff] [blame] | 70 | } |
Joey Armstrong | af679da | 2023-01-31 14:22:41 -0500 | [diff] [blame] | 71 | |
| 72 | // [EOF] |