Feature 11077: new option to install specific components with a specific tag from CICD

Change-Id: Id49c65d3f22e123d7e4ad3c83cf93df2281ea6ad
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
diff --git a/installers/40-deploy-osm.sh b/installers/40-deploy-osm.sh
index 9d032cf..492471f 100755
--- a/installers/40-deploy-osm.sh
+++ b/installers/40-deploy-osm.sh
@@ -122,6 +122,25 @@
     fi
 fi
 
+# Only applicable to OSM CICD pipeline
+# Test specific modules specified in MODULES_FOR_TESTING, using docker tag MODULE_DOCKER_TAG
+if [ -n "${MODULES_FOR_TESTING}" ]; then
+    for module in MON NBI RO LCM KEYSTONE NGUI NG-SA prometheus webhookTranslator; do
+        if echo ${MODULES_FOR_TESTING} | grep -q ${module} ; then
+            if [ "${module}" == "NG-SA" ]; then
+                OSM_HELM_OPTS="${OSM_HELM_OPTS} --set-string airflow.defaultAirflowTag=${MODULE_DOCKER_TAG}"
+            elif [ "${module}" == "prometheus" ]; then
+                OSM_HELM_OPTS="${OSM_HELM_OPTS} --set prometheus.server.sidecarContainers.prometheus-config-sidecar.image=${DOCKER_REGISTRY_URL}${DOCKER_USER}/prometheus:${OSM_DOCKER_TAG}"
+            else
+                # For the rest of cases, set the image tag normally
+                helm_entry=${module,,}
+                echo "Setting custom docker tag ${MODULE_DOCKER_TAG} for module ${module} in helm options"
+                OSM_HELM_OPTS="${OSM_HELM_OPTS} --set ${helm_entry}.image.tag=${MODULE_DOCKER_TAG}"
+            fi
+        fi
+    done
+fi
+
 echo "helm upgrade --install -n $OSM_NAMESPACE --create-namespace $OSM_HELM_RELEASE ${HERE}/helm/osm ${OSM_HELM_OPTS}"
 helm upgrade --install -n $OSM_NAMESPACE --create-namespace $OSM_HELM_RELEASE ${HERE}/helm/osm ${OSM_HELM_OPTS}
 # Override existing values.yaml with the final values.yaml used to install OSM