blob: fa49a1da0c28141dbdcaade031c8bb16e4e62518 [file] [log] [blame]
Joey Armstrongaf679da2023-01-31 14:22:41 -05001#!/usr/bin/env groovy
2// -----------------------------------------------------------------------
Joey Armstrong518f3572024-02-11 07:56:25 -05003// Copyright 2021-2024 Open Networking Foundation (ONF) and the ONF Contributors
Joey Armstrongaf679da2023-01-31 14:22:41 -05004//
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 Scandolo42f6e572021-01-25 15:11:34 -080017// loads all the images tagged as citest on a Kind cluster
Joey Armstrongaf679da2023-01-31 14:22:41 -050018// -----------------------------------------------------------------------
Matteo Scandolo42f6e572021-01-25 15:11:34 -080019
20def 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 Scandolobd176d72021-02-03 10:55:25 -080039 def image = list[i].trim()
40
41 if (!image) {
42 return
43 }
44
Matteo Scandolo42f6e572021-01-25 15:11:34 -080045 println "Loading image ${image} on Kind cluster ${cfg.name}"
46
47 sh """
Matteo Scandolo2411a3c2021-03-15 16:00:20 -070048 kind load docker-image ${image}:citest --name ${cfg.name} --nodes ${cfg.name}-control-plane,${cfg.name}-worker,${cfg.name}-worker2
Matteo Scandolo42f6e572021-01-25 15:11:34 -080049 """
50 }
51}
Joey Armstrongaf679da2023-01-31 14:22:41 -050052
53// [EOF]