[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/volthaDeploy.groovy b/vars/volthaDeploy.groovy
index 42c482a..a545da1 100644
--- a/vars/volthaDeploy.groovy
+++ b/vars/volthaDeploy.groovy
@@ -18,32 +18,64 @@
// If you need to deploy different configurations you can use the volthaInfraDeploy and volthaStackDeploy keywords
// -----------------------------------------------------------------------
+// -----------------------------------------------------------------------
+// -----------------------------------------------------------------------
+String getIam(String func) {
+ // Cannot rely on a stack trace due to jenkins manipulation
+ String src = 'vars/volthaDeploy.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: Perform volthaDeploy stuff
+// -----------------------------------------------------------------------
def call(Map config) {
- String iam = 'vars/volthaDeploy.groovy'
- println("** ${iam}: ENTER")
+ // String iam = 'vars/volthaDeploy.groovy'
+ enter('main')
// note that I can't define this outside the function as there's no global scope in Groovy
// [joey] A class method or library call can be used in place of globals, fqdn needed.
def defaultConfig = [
- onosReplica: 1,
- atomixReplica: 1,
- kafkaReplica: 1,
- etcdReplica: 1,
- bbsimReplica: 1,
- infraNamespace: "infra",
- volthaNamespace: "voltha",
- stackName: "voltha",
- stackId: 1,
- workflow: "att",
- withMacLearning: false,
- withFttb: false,
- extraHelmFlags: "",
- localCharts: false, // wether to use locally cloned charts or upstream one (for local we assume they are stored in $WORKSPACE/voltha-helm-charts)
- dockerRegistry: "", // use a different docker registry for all images, eg: "mirror.registry.opennetworking.org"
- kubeconfig: null, // location of the kubernetes config file, if null we assume it's stored in the $KUBECONFIG environment variable
- withVolthaInfra: true,
- withVolthaStack: true,
+ onosReplica: 1,
+ atomixReplica: 1,
+ kafkaReplica: 1,
+ etcdReplica: 1,
+ bbsimReplica: 1,
+ infraNamespace: "infra",
+ volthaNamespace: "voltha",
+ stackName: "voltha",
+ stackId: 1,
+ workflow: "att",
+ withMacLearning: false,
+ withFttb: false,
+ extraHelmFlags: "",
+ localCharts: false, // wether to use locally cloned charts or upstream one (for local we assume they are stored in $WORKSPACE/voltha-helm-charts)
+ dockerRegistry: "", // use a different docker registry for all images, eg: "mirror.registry.opennetworking.org"
+ kubeconfig: null, // location of the kubernetes config file, if null we assume it's stored in the $KUBECONFIG environment variable
+ withVolthaInfra: true,
+ withVolthaStack: true,
]
if (!config) {
@@ -53,37 +85,38 @@
def cfg = defaultConfig + config
if (cfg.dockerRegistry != "") {
- def registryFlags = " --set global.image_registry=${cfg.dockerRegistry}/ "
- registryFlags += " --set etcd.image.registry=${cfg.dockerRegistry} "
- registryFlags += " --set kafka.image.registry=${cfg.dockerRegistry} "
- registryFlags += " --set kafka.zookeper.image.registry=${cfg.dockerRegistry} "
- registryFlags += " --set onos-classic.image.repository=${cfg.dockerRegistry}/voltha/voltha-onos "
- registryFlags += " --set onos-classic.atomix.image.repository=${cfg.dockerRegistry}/atomix/atomix "
- registryFlags += " --set freeradius.images.radius.registry=${cfg.dockerRegistry}/ "
+ def registryFlags = " --set global.image_registry=${cfg.dockerRegistry}/ "
+ registryFlags += " --set etcd.image.registry=${cfg.dockerRegistry} "
+ registryFlags += " --set kafka.image.registry=${cfg.dockerRegistry} "
+ registryFlags += " --set kafka.zookeper.image.registry=${cfg.dockerRegistry} "
+ registryFlags += " --set onos-classic.image.repository=${cfg.dockerRegistry}/voltha/voltha-onos "
+ registryFlags += " --set onos-classic.atomix.image.repository=${cfg.dockerRegistry}/atomix/atomix "
+ registryFlags += " --set freeradius.images.radius.registry=${cfg.dockerRegistry}/ "
- // we want to always leave the user provided flags at the end, to override changes
- cfg.extraHelmFlags = registryFlags + " " + cfg.extraHelmFlags
+ // we want to always leave the user provided flags at the end, to override changes
+ cfg.extraHelmFlags = registryFlags + " " + cfg.extraHelmFlags
}
// Add helm repositories
println "Updating helm repos"
- sh """
- helm repo add onf https://charts.opencord.org
- helm repo update
- """
+ sh(label : 'Configure helm repo',
+ script : """
+helm repo add onf https://charts.opencord.org
+helm repo update
+""")
println "Deploying VOLTHA with the following parameters: ${cfg}."
if (cfg.withVolthaInfra) {
- volthaInfraDeploy(cfg)
+ volthaInfraDeploy(cfg)
}
if (cfg.withVolthaStack) {
- volthaStackDeploy(cfg)
+ volthaStackDeploy(cfg)
}
- println("** ${iam}: LEAVE")
+ leave('main')
}
// [EOF]