blob: e451f4246964218d6df56adf4de0b4e5f92ef55a [file] [log] [blame]
Joey Armstrong5353d312024-02-09 19:03:03 -05001#!/usr/bin/env groovy
2// -----------------------------------------------------------------------
3// Copyright 2024 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
18// -----------------------------------------------------------------------
19// -----------------------------------------------------------------------
20String getIam(String func) {
21 String src = 'vars/dotkube.groovy'
22 String iam = [src, func].join('::')
23 return iam
24}
25
26// -----------------------------------------------------------------------
27// Intent: Log progress message
28// -----------------------------------------------------------------------
29void enter(String name) {
30 // Announce ourselves for log usability
31 String iam = getIam(name)
32 println("${iam}: ENTER")
33 return
34}
35
36// -----------------------------------------------------------------------
37// Intent: Log progress message
38// -----------------------------------------------------------------------
39void leave(String name) {
40 // Announce ourselves for log usability
41 String iam = getIam(name)
42 println("${iam}: LEAVE")
43 return
44}
45
46// -----------------------------------------------------------------------
47// Intent: Display debug info about .kube/*
48// -----------------------------------------------------------------------
49def call(Map config) {
50 config ?: [:]
51 // Boolean debug = config.debug ?: false
52
53 String iam = getIam('main')
54
55 try {
56 enter(iam)
57
58 // clusterName: kind-ci
59 // config=kind-{clusterName}
60 // -------------------------
61 // loader.go:223] Config not found: /home/jenkins/.kube/kind-kind-ci
62 stage('.kube/ debugging')
63 {
Joey Armstrong7035bf72024-02-10 18:44:11 -050064 sh("""/bin/ls -ld ~/.kube """)
Joey Armstrongc26dd382024-02-10 19:48:30 -050065 sh("""find ~/.kube -print0 \
Joey Armstrongf0232762024-02-11 17:23:04 -050066 | grep --null --null-data -e 'cache' -e 'temp' \
Joey Armstrongc26dd382024-02-10 19:48:30 -050067 | xargs -0 /bin/ls -ld""")
Joey Armstrong5353d312024-02-09 19:03:03 -050068 // if (config['do-something']) {}
69 }
70 }
71 // groovylint-disable-next-line
72 catch (Exception err) {
73 println("** ${iam}: EXCEPTION ${err}")
74 throw err
75 }
76 finally {
77 leave(iam)
78 }
79
80 return
81}
82
83// [EOF]