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 | c26dd38 | 2024-02-10 19:48:30 -0500 | [diff] [blame] | 65 | sh("""find ~/.kube -print0 \ |
| 66 | | grep --null --null-data -e 'cache -e 'temp' \ |
| 67 | | xargs -0 /bin/ls -ld""") |
Joey Armstrong | 5353d31 | 2024-02-09 19:03:03 -0500 | [diff] [blame] | 68 | // 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] |