[VOL-5020] Update helm charts for repo:voltha-tracing
vars/getPodsInfo.groovy
-----------------------
o Add debugging
o Display ENTER/LEAVE banners when the script is called.
o Wrap logic in a try/catch/finally block to help expose
another silent failure source.
.groovylintrc.json
------------------
o Added an exclusion file to filter some basic opinion
based options that are filing the lint report.
jjb/verify/bbsim-sadis-server.yaml
jjb/verify/bbsim.yaml
----------------------------------
o *.yaml edit made for side effects.
o Regenerate JJB pipelines.
vars/iam.groovy
---------------
o Need to revisit this script, debugging flag added.
o Script creates a closure for invoking pipeline tasks.
o Automates wrapping task with try/catch/finally/ran-to-completion.
o Automates wrapping task with display of ENTER/LEAVE banner.
Change-Id: I1437c336a1fb75a7723c397716f07ce00c1d00ce
diff --git a/vars/getPodsInfo.groovy b/vars/getPodsInfo.groovy
index 599a824..ecd785c 100644
--- a/vars/getPodsInfo.groovy
+++ b/vars/getPodsInfo.groovy
@@ -1,6 +1,6 @@
#!/usr/bin/env groovy
// -----------------------------------------------------------------------
-// Copyright 2021-2023 Open Networking Foundation (ONF) and the ONF Contributors
+// Copyright 2021-2024 Open Networking Foundation (ONF) and the ONF Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -18,9 +18,48 @@
// the only parameter required is the destination folder to store the collected information
// -----------------------------------------------------------------------
-def call(String dest) {
- sh """
+// -----------------------------------------------------------------------
+// -----------------------------------------------------------------------
+String getIam(String func) {
+ // Cannot rely on a stack trace due to jenkins manipulation
+ String src = 'vars/getPodsInfo.groovy'
+ String iam = [src, func].join('::')
+ return iam
+}
+
+// -----------------------------------------------------------------------
+// Intent: Log progress message
+// -----------------------------------------------------------------------
+void enter(String name) {
+ // Announce ourselves for log usability
+ String iam = getIam(name)
+ println("${iam}: ENTER")
+ return
+}
+
+// -----------------------------------------------------------------------
+// Intent: Log progress message
+// -----------------------------------------------------------------------
+void leave(String name) {
+ // Announce ourselves for log usability
+ String iam = getIam(name)
+ println("${iam}: LEAVE")
+ return
+}
+
+// -----------------------------------------------------------------------
+// Intent: Script workhorse
+// -----------------------------------------------------------------------
+// def call(String dest) {
+Boolean process(String dest)
+{
+ // [TODO] post release remove '|| true'
+ // Map cmds = [ label : { cmd, file } ]
+ // cmds.for{ rec -> sh("cmd > file")
+
+ sh("""
mkdir -p ${dest}
+
# only tee the main infos
kubectl get pods --all-namespaces -o wide | tee ${dest}/pods.txt || true
helm ls --all-namespaces | tee ${dest}/helm-charts.txt
@@ -28,9 +67,42 @@
# everything else should not be dumped on the console
kubectl get svc --all-namespaces -o wide > ${dest}/svc.txt || true
kubectl get pvc --all-namespaces -o wide > ${dest}/pvcs.txt || true
- kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq > ${dest}/pod-images.txt || true
- kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq > ${dest}/pod-imagesId.txt || true
+ kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" \
+ | sort \
+ | uniq > ${dest}/pod-images.txt || true
+ kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" \
+ | sort \
+ | uniq > ${dest}/pod-imagesId.txt || true
kubectl describe pods --all-namespaces -l app.kubernetes.io/part-of=voltha > ${dest}/voltha-pods-describe.txt
kubectl describe pods --all-namespaces -l app=onos-classic > ${dest}/onos-pods-describe.txt
- """
+""")
+
+ return(true)
}
+
+// -----------------------------------------------------------------------
+// -----------------------------------------------------------------------
+// def call(Map config=[:])
+def call(String dest)
+{
+ Map config ?: [:]
+
+ try
+ {
+ enter('main')
+ process(dest)
+ }
+ catch (Exception err) // groovylint-disable-line CatchException
+ {
+ String iam = getIam('process')
+ println("** ${iam}: EXCEPTION ${err}")
+ throw err
+ }
+ finally
+ {
+ leave('main')
+ }
+ return
+}
+
+// [EOF]