Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 1 | // loads all the images tagged as citest on a Kind cluster |
| 2 | |
| 3 | def call(Map config) { |
| 4 | def defaultConfig = [ |
| 5 | name: "kind-ci" |
| 6 | ] |
| 7 | |
| 8 | if (!config) { |
| 9 | config = [:] |
| 10 | } |
| 11 | |
| 12 | def cfg = defaultConfig + config |
| 13 | |
| 14 | def images = sh ( |
| 15 | script: 'docker images -f "reference=**/*citest" --format "{{.Repository}}"', |
| 16 | returnStdout: true |
| 17 | ).trim() |
| 18 | |
| 19 | def list = images.split("\n") |
| 20 | |
| 21 | for(int i = 0;i<list.size();i++) { |
Matteo Scandolo | bd176d7 | 2021-02-03 10:55:25 -0800 | [diff] [blame] | 22 | def image = list[i].trim() |
| 23 | |
| 24 | if (!image) { |
| 25 | return |
| 26 | } |
| 27 | |
Matteo Scandolo | 42f6e57 | 2021-01-25 15:11:34 -0800 | [diff] [blame] | 28 | println "Loading image ${image} on Kind cluster ${cfg.name}" |
| 29 | |
| 30 | sh """ |
| 31 | kind load docker-image ${image}:citest --name ${cfg.name} --nodes ${cfg.name}-worker,${cfg.name}-worker2 |
| 32 | """ |
| 33 | } |
| 34 | } |