[VOL-3780] Migrating pipelines to use voltha-infra and voltha-stack charts through shared keywords

Change-Id: I55a9847126b4ecfa326fa882d57e6381e4cef425
diff --git a/vars/volthaDeploy.groovy b/vars/volthaDeploy.groovy
index dae88a8..29d090e 100644
--- a/vars/volthaDeploy.groovy
+++ b/vars/volthaDeploy.groovy
@@ -16,6 +16,7 @@
       workflow: "att",
       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"
     ]
 
     if (!config) {
@@ -24,6 +25,16 @@
 
     def cfg = defaultConfig + config
 
+    if (cfg.dockerRegistry != "") {
+      extraHelmFlags += " --set global.image_registry=${cfg.dockerRegistry}/ "
+      extraHelmFlags += " --set etcd.image.registry=${cfg.dockerRegistry} "
+      extraHelmFlags += " --set kafka.image.registry=${cfg.dockerRegistry} "
+      extraHelmFlags += " --set kafka.zookeper.image.registry=${cfg.dockerRegistry} "
+      extraHelmFlags += " --set onos-classic.image.repository=${cfg.dockerRegistry}/voltha/voltha-onos "
+      extraHelmFlags += " --set onos-classic.atomix.image.repository=${cfg.dockerRegistry}/atomix/atomix "
+      extraHelmFlags += " --set freeradius.images.radius.registry=${cfg.dockerRegistry}/ "
+    }
+
     println "Deploying VOLTHA with the following parameters: ${cfg}."
 
     volthaInfraDeploy(cfg)