blob: c5ba815ba2d0fb0cd6e348967105ae9bdd41b8f0 [file] [log] [blame]
Joey Armstrongaf679da2023-01-31 14:22:41 -05001#!/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 Scandolo660e4af2021-04-02 11:16:09 -070018// returns the helm flags required to override a specific image
Joey Armstrong28e86ee2023-08-03 15:22:29 -040019String call(String project = 'unknown', String tag = 'citest', String pullPolicy = 'Never') {
20 def chart = 'unknown'
21 def image = 'unknown'
Matteo Scandolo660e4af2021-04-02 11:16:09 -070022 switch(project) {
Joey Armstrong28e86ee2023-08-03 15:22:29 -040023 case 'ofagent-go':
24 chart = 'voltha'
25 image = 'ofagent'
Matteo Scandolo660e4af2021-04-02 11:16:09 -070026 break
Joey Armstrong28e86ee2023-08-03 15:22:29 -040027 case 'voltha-go':
28 chart = 'voltha'
29 image = 'rw_core'
Matteo Scandolo660e4af2021-04-02 11:16:09 -070030 break
Joey Armstrong28e86ee2023-08-03 15:22:29 -040031 case 'voltha-openonu-adapter-go':
32 chart = 'voltha-adapter-openonu'
33 image = 'adapter_open_onu_go'
Matteo Scandolo660e4af2021-04-02 11:16:09 -070034 break
Matteo Scandolo660e4af2021-04-02 11:16:09 -070035 // TODO end
Joey Armstrong28e86ee2023-08-03 15:22:29 -040036 case 'voltha-openolt-adapter':
37 chart = 'voltha-adapter-openolt'
38 image = 'adapter_open_olt'
Matteo Scandolo660e4af2021-04-02 11:16:09 -070039 break
Joey Armstrong28e86ee2023-08-03 15:22:29 -040040 case 'bbsim':
Matteo Scandolo660e4af2021-04-02 11:16:09 -070041 // BBSIM has a different format that voltha, return directly
Joey Armstrong28e86ee2023-08-03 15:22:29 -040042 return '--set images.bbsim.tag=${tag},images.bbsim.pullPolicy=${pullPolicy},images.bbsim.registry='' '
Matteo Scandolo660e4af2021-04-02 11:16:09 -070043 break
Joey Armstrong28e86ee2023-08-03 15:22:29 -040044 case 'voltha-onos':
45 return '--set onos-classic.image.repository=voltha/voltha-onos,onos-classic.image.tag=citest,onos-classic.image.pullPolicy=${pullPolicy}'
Matteo Scandolo660e4af2021-04-02 11:16:09 -070046 default:
Joey Armstrong28e86ee2023-08-03 15:22:29 -040047 return ''
Matteo Scandolo660e4af2021-04-02 11:16:09 -070048 break
49 }
50
Joey Armstrong28e86ee2023-08-03 15:22:29 -040051 String ans = "--set ${chart}.images.${image}.tag=${tag},${chart}.images.${image}.pullPolicy=${pullPolicy},${chart}.images.${image}.registry='' "
52 println("getVolthaImageFlags return ${ans}")
53 return(ans)
Matteo Scandolo660e4af2021-04-02 11:16:09 -070054}
Joey Armstrongaf679da2023-01-31 14:22:41 -050055
56// [EOF]