blob: c3ec591ef290d101cd964ca30d611987c91f5b83 [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 Armstronge6f337e2024-02-10 17:14:26 -050065 sh("""find ~/.kube -print0 | xargs -0 /bin/ls -ld""")
Joey Armstrong5353d312024-02-09 19:03:03 -050066 // if (config['do-something']) {}
67 }
68 }
69 // groovylint-disable-next-line
70 catch (Exception err) {
71 println("** ${iam}: EXCEPTION ${err}")
72 throw err
73 }
74 finally {
75 leave(iam)
76 }
77
78 return
79}
80
81// [EOF]