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++) { |
| 22 | def image = list[i] |
| 23 | println "Loading image ${image} on Kind cluster ${cfg.name}" |
| 24 | |
| 25 | sh """ |
| 26 | kind load docker-image ${image}:citest --name ${cfg.name} --nodes ${cfg.name}-worker,${cfg.name}-worker2 |
| 27 | """ |
| 28 | } |
| 29 | } |