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 | // ----------------------------------------------------------------------- |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 17 | // loads all the images tagged as citest on a Kind cluster |
Joey Armstrong | af679da | 2023-01-31 14:22:41 -0500 | [diff] [blame^] | 18 | // ----------------------------------------------------------------------- |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 19 | |
| 20 | def call(Map config) { |
| 21 | def defaultConfig = [ |
| 22 | name: "kind-ci" |
| 23 | ] |
| 24 | |
| 25 | if (!config) { |
| 26 | config = [:] |
| 27 | } |
| 28 | |
| 29 | def cfg = defaultConfig + config |
| 30 | |
| 31 | def images = sh ( |
| 32 | script: 'docker images -f "reference=**/*citest" --format "{{.Repository}}"', |
| 33 | returnStdout: true |
| 34 | ).trim() |
| 35 | |
| 36 | def list = images.split("\n") |
| 37 | |
| 38 | for(int i = 0;i<list.size();i++) { |
Matteo Scandolo | bd176d7 | 2021-02-03 10:55:25 -0800 | [diff] [blame] | 39 | def image = list[i].trim() |
| 40 | |
| 41 | if (!image) { |
| 42 | return |
| 43 | } |
| 44 | |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 45 | println "Loading image ${image} on Kind cluster ${cfg.name}" |
| 46 | |
| 47 | sh """ |
Matteo Scandolo | 2411a3c | 2021-03-15 16:00:20 -0700 | [diff] [blame] | 48 | kind load docker-image ${image}:citest --name ${cfg.name} --nodes ${cfg.name}-control-plane,${cfg.name}-worker,${cfg.name}-worker2 |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 49 | """ |
| 50 | } |
| 51 | } |
Joey Armstrong | af679da | 2023-01-31 14:22:41 -0500 | [diff] [blame^] | 52 | |
| 53 | // [EOF] |