Joey Armstrong | 5353d31 | 2024-02-09 19:03:03 -0500 | [diff] [blame] | 1 | #!/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 | // ----------------------------------------------------------------------- |
| 20 | String 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 | // ----------------------------------------------------------------------- |
| 29 | void 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 | // ----------------------------------------------------------------------- |
| 39 | void 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 | // ----------------------------------------------------------------------- |
| 49 | def 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 Armstrong | 7035bf7 | 2024-02-10 18:44:11 -0500 | [diff] [blame] | 64 | sh("""/bin/ls -ld ~/.kube """) |
Joey Armstrong | e6f337e | 2024-02-10 17:14:26 -0500 | [diff] [blame] | 65 | sh("""find ~/.kube -print0 | xargs -0 /bin/ls -ld""") |
Joey Armstrong | 5353d31 | 2024-02-09 19:03:03 -0500 | [diff] [blame] | 66 | // 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] |