npm-groovy-lint inspired cleanups
vars/volthaInfraDeploy.groovy
-----------------------------
o Cleanup most npm-groovy-lint compaints:
make lint-groovy-mod (locally modified)
make lint-groovy (all *.groovy sources)
o The type is not specified for variable "kubeconfig"
- Note: Local vars used in sh() calls not typed as String to avoid the
"gString has no native cast to java.lang.String" problem.
jjb/verify/voltha-onos.yaml
---------------------------
o Cosmetic change to force jenkins job to run.
Change-Id: I230190b2d0df9455430c5ca5760c8e6d818b161e
diff --git a/jjb/verify/voltha-onos.yaml b/jjb/verify/voltha-onos.yaml
index 8baf4cf..c27705a 100644
--- a/jjb/verify/voltha-onos.yaml
+++ b/jjb/verify/voltha-onos.yaml
@@ -18,10 +18,6 @@
name-extension: '-voltha-2.11'
override-branch: 'voltha-2.11'
branch-regexp: '^voltha-2.11$'
-# - 'verify-voltha-onos-jobs-voltha-2.8':
-# name-extension: '-voltha-2.8'
-# override-branch: 'voltha-2.8'
-# branch-regexp: '^voltha-2.8$'
- 'publish-voltha-onos-jobs':
branch-regexp: '{all-branches-regexp}'
@@ -46,12 +42,6 @@
pipeline-script: 'voltha/voltha-2.11/bbsim-tests.groovy'
pipeline-branch: 'voltha-2.11'
-#- job-group:
-# name: 'verify-voltha-onos-jobs-voltha-2.8'
-# jobs:
-# - 'voltha-patch-test':
-# pipeline-script: 'voltha/voltha-2.8/bbsim-tests.groovy'
-
- job-group:
name: 'verify-voltha-onos-jobs-master'
jobs:
diff --git a/vars/volthaInfraDeploy.groovy b/vars/volthaInfraDeploy.groovy
index 0a979e5..8a3f745 100644
--- a/vars/volthaInfraDeploy.groovy
+++ b/vars/volthaInfraDeploy.groovy
@@ -18,24 +18,20 @@
//
// stage('test stage') {
// steps {
-// volthaDeploy([
-// onosReplica: 3
-// ])
+// volthaDeploy([onosReplica: 3])
// }
// }
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
-def getIam(String func)
-{
+String getIam(String func) {
// Cannot rely on a stack trace due to jenkins manipulation
String src = 'vars/volthaInfraDeploy.groovy'
String iam = [src, func].join('::')
return iam
}
-
// -----------------------------------------------------------------------
// Intent: Log progress message
// -----------------------------------------------------------------------
@@ -59,9 +55,9 @@
// -----------------------------------------------------------------------
// Intent: Display and interact with kubernetes namespaces.
// -----------------------------------------------------------------------
-def doKubeNamespaces()
-{
- enter('doKubeNamespaces')
+void doKubeNamespaces() {
+ String iam = 'doKubeNamespaces'
+ enter(iam)
/*
[joey] - should pre-existing hint the env is tainted (?)
@@ -76,34 +72,35 @@
sh('kubectl get namespaces || true')
- leave('doKubeNamespaces')
+ leave(iam)
return
}
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
-def process(Map config)
-{
+void process(Map config) {
enter('process')
// NOTE use params or directule extraHelmFlags??
- def defaultConfig = [
+ Map defaultConfig = [
onosReplica: 1,
atomixReplica: 1,
kafkaReplica: 1,
etcdReplica: 1,
- infraNamespace: "infra",
- workflow: "att",
+ infraNamespace: 'infra',
+ workflow: 'att',
withMacLearning: false,
withFttb: false,
- extraHelmFlags: "",
+ extraHelmFlags: '',
localCharts: false,
- kubeconfig: null, // location of the kubernetes config file, if null we assume it's stored in the $KUBECONFIG environment variable
+ // location of the kubernetes config file,
+ // if null we assume it's stored in the $KUBECONFIG
+ kubeconfig: null,
]
- def cfg = defaultConfig + config
+ Map cfg = defaultConfig + config
- def volthaInfraChart = "onf/voltha-infra"
+ def volthaInfraChart = 'onf/voltha-infra'
if (cfg.localCharts) {
volthaInfraChart = "$WORKSPACE/voltha-helm-charts/voltha-infra"
@@ -131,11 +128,11 @@
kubectl create configmap -n ${cfg.infraNamespace} kube-config "--from-file=kube_config=${kubeconfig}" || true
""")
- def serviceConfigFile = cfg.workflow
+ String 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
@@ -158,27 +155,19 @@
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
-def call(Map config)
-{
+def call(Map config=[:]) {
enter('main')
- if (!config) {
- config = [:]
+ try {
+ process(config)
}
-
- try
- {
- process(config)
- }
- catch (Exception err)
- {
+ catch (Exception err) { // groovylint-disable-line CatchException
String iam = getIam(name)
- println("** ${iam}: EXCEPTION ${err}")
- throw err
+ println("** ${iam}: EXCEPTION ${err}")
+ throw err
}
- finally
- {
- leave('main')
+ finally {
+ leave('main')
}
return