[VOL-5177] - verify_voltha-openolt-adapter_sanity-test failure
jjb/*
---------------------------------------------------------
o Added function enter/leave for log mesage consistency
o Update more sh """ calls to sh(label:foo, script:bar) for logfile context.
o minor npm-groovy-lint cleanups to shorten the warning report.
vars/volthaDeploy.groovy
vars/volthaInfraDeploy.groovy
-----------------------------
o re-indent buffer so npm-groovy-lint is usable.
o Log more progression messages to help debugging.
Change-Id: I5824164dbb8f9c516691672219d6d7476212ccd1
diff --git a/vars/volthaInfraDeploy.groovy b/vars/volthaInfraDeploy.groovy
index c476fd5..db17b42 100644
--- a/vars/volthaInfraDeploy.groovy
+++ b/vars/volthaInfraDeploy.groovy
@@ -35,13 +35,33 @@
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: Display and interact with kubernetes namespaces.
// -----------------------------------------------------------------------
def doKubeNamespaces()
{
- String iam = getIam('doKubeNamespaces')
- println("** ${iam}: ENTER")
+ enter('doKubeNamespaces')
/*
[joey] - should pre-existing hint the env is tainted (?)
@@ -50,13 +70,13 @@
05:24:57 error: failed to create configmap: configmaps "kube-config" already exists
[joey] Thinking we should:
- o A special case exists (create namespace)
- o helm upgrade --install (inital update)
+ o A special case exists (create namespace)
+ o helm upgrade --install (inital update)
*/
sh('kubectl get namespaces || true')
- println("** ${iam}: LEAVE")
+ leave('doKubeNamespaces')
return
}
@@ -64,22 +84,21 @@
// -----------------------------------------------------------------------
def process(Map config)
{
- String iam = getIam('process')
- println("** ${iam}: ENTER")
+ enter('process')
// NOTE use params or directule extraHelmFlags??
def defaultConfig = [
- onosReplica: 1,
- atomixReplica: 1,
- kafkaReplica: 1,
- etcdReplica: 1,
- infraNamespace: "infra",
- workflow: "att",
- withMacLearning: false,
- withFttb: false,
- extraHelmFlags: "",
- localCharts: false,
- kubeconfig: null, // location of the kubernetes config file, if null we assume it's stored in the $KUBECONFIG environment variable
+ onosReplica: 1,
+ atomixReplica: 1,
+ kafkaReplica: 1,
+ etcdReplica: 1,
+ infraNamespace: "infra",
+ workflow: "att",
+ withMacLearning: false,
+ withFttb: false,
+ extraHelmFlags: "",
+ localCharts: false,
+ kubeconfig: null, // location of the kubernetes config file, if null we assume it's stored in the $KUBECONFIG environment variable
]
def cfg = defaultConfig + config
@@ -87,47 +106,51 @@
def volthaInfraChart = "onf/voltha-infra"
if (cfg.localCharts) {
- volthaInfraChart = "$WORKSPACE/voltha-helm-charts/voltha-infra"
+ volthaInfraChart = "$WORKSPACE/voltha-helm-charts/voltha-infra"
- sh """
- pushd $WORKSPACE/voltha-helm-charts/voltha-infra
- helm dep update
- popd
- """
+ sh(label : 'HELM: Update deps',
+ script : """
+pushd $WORKSPACE/voltha-helm-charts/voltha-infra
+helm dep update
+popd
+""")
}
println "Deploying VOLTHA Infra with the following parameters: ${cfg}."
def kubeconfig = cfg.kubeconfig
if (kubeconfig == null) {
- kubeconfig = env.KUBECONFIG
+ kubeconfig = env.KUBECONFIG
}
doKubeNamespaces() // WIP: joey
- sh """
- kubectl create namespace ${cfg.infraNamespace} || true
- kubectl create configmap -n ${cfg.infraNamespace} kube-config "--from-file=kube_config=${kubeconfig}" || true
- """
+ sh(label : 'KUBE: Create namespace',
+ script : """
+kubectl create namespace ${cfg.infraNamespace} || true
+kubectl create configmap -n ${cfg.infraNamespace} kube-config "--from-file=kube_config=${kubeconfig}" || true
+""")
def serviceConfigFile = cfg.workflow
if (cfg.withMacLearning && cfg.workflow == 'tt') {
- serviceConfigFile = "tt-maclearner"
+ serviceConfigFile = "tt-maclearner"
} else if (cfg.withFttb && cfg.workflow == 'dt') {
- serviceConfigFile = "dt-fttb"
+ serviceConfigFile = "dt-fttb"
}
// bitnamic/etch has change the replica format between the currently used 5.4.2 and the latest 6.2.5
// for now put both values in the extra helm chart flags
- sh """
+ sh(label : 'HELM: upgrade --install',
+ script : """
helm upgrade --install --create-namespace -n ${cfg.infraNamespace} voltha-infra ${volthaInfraChart} \
--set onos-classic.replicas=${cfg.onosReplica},onos-classic.atomix.replicas=${cfg.atomixReplica} \
--set kafka.replicaCount=${cfg.kafkaReplica},kafka.zookeeper.replicaCount=${cfg.kafkaReplica} \
--set etcd.statefulset.replicaCount=${cfg.etcdReplica} \
--set etcd.replicaCount=${cfg.etcdReplica} \
-f $WORKSPACE/voltha-helm-charts/examples/${serviceConfigFile}-values.yaml ${cfg.extraHelmFlags}
- """
+""")
+ leave('process')
return
}
@@ -135,8 +158,7 @@
// -----------------------------------------------------------------------
def call(Map config)
{
- String iam = getIam('main')
- println("** ${iam}: ENTER")
+ enter('main')
if (!config) {
config = [:]
@@ -144,18 +166,19 @@
try
{
- process(config)
+ process(config)
}
catch (Exception err)
{
- println("** ${iam}: EXCEPTION ${err}")
- // Cannot re-throw ATM: too many potential shell errors.
- // throw err
+ String iam = getIam(name)
+ println("** ${iam}: EXCEPTION ${err}")
+ throw err
}
finally
{
- println("** ${iam}: LEAVE")
+ leave('main')
}
+
return
}