jenkinsfile to use charts repo and specific versions

Change-Id: I86c9feeee65b2c2b8a1310e0f7da372db0db90da
diff --git a/Jenkinsfile-attworkflow-build b/Jenkinsfile-attworkflow-build
index 6fec97c..02fd814 100644
--- a/Jenkinsfile-attworkflow-build
+++ b/Jenkinsfile-attworkflow-build
@@ -23,7 +23,7 @@
             stage('Clean up') {
                 timeout(10) {
                     sh returnStdout: true, script: """
-                    rm -rf helm-charts cord-tester
+                    rm -rf cord-tester
                     git clone -b ${branch} ${cordRepoUrl}/helm-charts
                     export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
                     for hchart in \$(helm list -q | grep -E -v 'docker-registry|mavenrepo|ponnet');
@@ -61,170 +61,179 @@
                     // }
                 }
             }
-            dir ("helm-charts") {
-                stage('Install CORD Kafka') {
-                    timeout(10) {
-                        sh returnStdout: true, script: """
-                        export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
-                        helm install -f examples/kafka-single.yaml --version 0.8.8 -n cord-kafka incubator/kafka
+            stage('Add CORD repository') {
+                sh returnStdout: true, script: """
+                export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
+                helm repo add cord https://charts.opencord.org
+                helm repo update
+                """
+                timeout(1) {
+                    waitUntil {
+                        cord_repo_present = sh returnStdout: true, script: """
+                        export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
+                        helm repo list | grep cord | wc -l
                         """
-                    }
-                    timeout(10) {
-                        waitUntil {
-                            kafka_instances_running = sh returnStdout: true, script: """
-                            export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
-                            kubectl get pods | grep cord-kafka | grep -i running | grep 1/1 | wc -l
-                            """
-                            return kafka_instances_running.toInteger() == 2
-                        }
-                    }
-                }
-                stage('Install Logging Infrastructure') {
-                    timeout(10) {
-                        sh returnStdout: true, script: """
-                        export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
-                        helm dep update logging
-                        helm install -f examples/logging-single.yaml -n logging logging
-                        scripts/wait_for_pods.sh
-                        """
-                    }
-                }
-                stage('Install Monitoring Infrastructure') {
-                    timeout(10) {
-                        sh returnStdout: true, script: """
-                        export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
-                        helm dep update nem-monitoring
-                        helm install -n nem-monitoring nem-monitoring
-                        scripts/wait_for_pods.sh
-                        """
-                    }
-                }
-                stage('Install etcd-cluster') {
-                    timeout(10) {
-                        sh returnStdout: true, script: """
-                        export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
-                        helm install -f ../${configBaseDir}/${configKubernetesDir}/${configFileName}.yml --version 0.8.0 -n etcd-operator stable/etcd-operator
-                        """
-                    }
-                    timeout(10) {
-                        waitUntil {
-                            etcd_running = sh returnStdout: true, script: """
-                            export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
-                            kubectl get pods | grep etcd | grep -i running | grep 1/1 | wc -l
-                            """
-                            return etcd_running.toInteger() == 3
-                        }
-                    }
-                }
-                stage('Install voltha') {
-                    timeout(10) {
-                        sh returnStdout: true, script: """
-                        export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
-                        helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/
-                        helm dep build voltha
-                        helm install -n voltha -f ../${configBaseDir}/${configKubernetesDir}/${configFileName}.yml voltha
-                        """
-                    }
-                    timeout(10) {
-                        waitUntil {
-                            voltha_completed = sh returnStdout: true, script: """
-                            export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
-                            kubectl get pods -n voltha | grep -i running | grep 1/1 | wc -l
-                            """
-                            return voltha_completed.toInteger() == 8
-                        }
-                    }
-                }
-                stage('Install ONOS') {
-                    timeout(10) {
-                        sh returnStdout: true, script: """
-                        export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
-                        helm install -n onos -f ../${configBaseDir}/${configKubernetesDir}/${configFileName}.yml onos
-                        """
-                    }
-                    timeout(10) {
-                        waitUntil {
-                            onos_completed = sh returnStdout: true, script: """
-                            export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
-                            kubectl get pods | grep -i onos | grep -i running | grep 2/2 | wc -l
-                            """
-                            return onos_completed.toInteger() == 1
-                        }
-                    }
-                }
-                stage('Install xos-core') {
-                    timeout(10) {
-                        sh returnStdout: true, script: """
-                        export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
-                        helm dep update xos-core
-                        helm install -f ../${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n xos-core xos-core
-                        """
-                    }
-                    timeout(10) {
-                        waitUntil {
-                            xos_core_completed = sh returnStdout: true, script: """
-                            export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
-                            kubectl get pods | grep -i xos | grep -i running | grep 1/1 | wc -l
-                            """
-                            return xos_core_completed.toInteger() == 6
-                        }
-                    }
-                }
-                stage('Install seba-services profile') {
-                    timeout(10) {
-                        sh returnStdout: true, script: """
-                        export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
-                        helm dep update xos-profiles/seba-services
-                        helm install -f ../${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n seba-services xos-profiles/seba-services
-                        """
-                    }
-                    timeout(10) {
-                        waitUntil {
-                            att_workflow_tosca_completed = sh returnStdout: true, script: """
-                            export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
-                            kubectl get pods | grep -i seba-services-tosca-loader | grep -i completed | wc -l
-                            """
-                            return att_workflow_tosca_completed.toInteger() == 1
-                        }
-                    }
-                }
-                stage('Install base-kubernetes') {
-                    timeout(10) {
-                        sh returnStdout: true, script: """
-                        export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
-                        helm dep update xos-profiles/base-kubernetes
-                        helm install -f ../${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n base-kubernetes xos-profiles/base-kubernetes
-                        """
-                    }
-                    timeout(10) {
-                        waitUntil {
-                            base_kubernetes_tosca_running = sh returnStdout: true, script: """
-                            export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
-                            kubectl get pods | grep -i base-kubernetes-tosca-loader | grep -i completed | wc -l
-                            """
-                            return base_kubernetes_tosca_running.toInteger() == 1
-                        }
-                    }
-                }
-                stage('Install att workflow') {
-                    timeout(10) {
-                        sh returnStdout: true, script: """
-                        export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
-                        helm dep update workflows/att-workflow
-                        helm install -f ../${configBaseDir}/${configKubernetesDir}/${configFileName}.yml --set att-workflow-driver.kafkaService=cord-kafka -n att-workflow workflows/att-workflow
-                        """
-                    }
-                    timeout(10) {
-                        waitUntil {
-                            att_workflow_tosca_completed = sh returnStdout: true, script: """
-                            export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
-                            kubectl get pods | grep -i att-workflow-tosca-loader | grep -i completed | wc -l
-                            """
-                            return att_workflow_tosca_completed.toInteger() == 1
-                        }
+                        return cord_repo_present.toInteger() == 1
                     }
                 }
             }
+            stage('Install CORD Kafka') {
+                timeout(10) {
+                    sh returnStdout: true, script: """
+                    export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
+                    helm install -f examples/kafka-single.yaml --version 0.8.8 -n cord-kafka incubator/kafka
+                    """
+                }
+                timeout(10) {
+                    waitUntil {
+                        kafka_instances_running = sh returnStdout: true, script: """
+                        export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
+                        kubectl get pods | grep cord-kafka | grep -i running | grep 1/1 | wc -l
+                        """
+                        return kafka_instances_running.toInteger() == 2
+                    }
+                }
+            }
+            stage('Install Logging Infrastructure') {
+                timeout(10) {
+                    sh returnStdout: true, script: """
+                    export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
+                    helm install -f examples/logging-single.yaml -n logging cord/logging
+                    scripts/wait_for_pods.sh
+                    """
+                }
+            }
+            stage('Install Monitoring Infrastructure') {
+                timeout(10) {
+                    sh returnStdout: true, script: """
+                    export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
+                    helm install -f ../${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n nem-monitoring cord/nem-monitoring
+                    scripts/wait_for_pods.sh
+                    """
+                }
+            }
+            stage('Install etcd-cluster') {
+                timeout(10) {
+                    sh returnStdout: true, script: """
+                    export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
+                    helm install -f ../${configBaseDir}/${configKubernetesDir}/${configFileName}.yml --version 0.8.0 -n etcd-operator stable/etcd-operator
+                    """
+                }
+                timeout(10) {
+                    waitUntil {
+                        etcd_running = sh returnStdout: true, script: """
+                        export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
+                        kubectl get pods | grep etcd | grep -i running | grep 1/1 | wc -l
+                        """
+                        return etcd_running.toInteger() == 3
+                    }
+                }
+            }
+            stage('Install voltha') {
+                timeout(10) {
+                    sh returnStdout: true, script: """
+                    export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
+                    helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/
+                    helm dep build voltha
+                    helm install -n voltha -f ../${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/voltha
+                    """
+                }
+                timeout(10) {
+                    waitUntil {
+                        voltha_completed = sh returnStdout: true, script: """
+                        export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
+                        kubectl get pods -n voltha | grep -i running | grep 1/1 | wc -l
+                        """
+                        return voltha_completed.toInteger() == 8
+                    }
+                }
+            }
+            stage('Install ONOS') {
+                timeout(10) {
+                    sh returnStdout: true, script: """
+                    export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
+                    helm install -n onos -f ../${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/onos
+                    """
+                }
+                timeout(10) {
+                    waitUntil {
+                        onos_completed = sh returnStdout: true, script: """
+                        export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
+                        kubectl get pods | grep -i onos | grep -i running | grep 2/2 | wc -l
+                        """
+                        return onos_completed.toInteger() == 1
+                    }
+                }
+            }
+            stage('Install xos-core') {
+                timeout(10) {
+                    sh returnStdout: true, script: """
+                    export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
+                    helm install -f ../${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n xos-core cord/xos-core
+                    """
+                }
+                timeout(10) {
+                    waitUntil {
+                        xos_core_completed = sh returnStdout: true, script: """
+                        export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
+                        kubectl get pods | grep -i xos | grep -i running | grep 1/1 | wc -l
+                        """
+                        return xos_core_completed.toInteger() == 6
+                    }
+                }
+            }
+            stage('Install seba-services profile') {
+                timeout(10) {
+                    sh returnStdout: true, script: """
+                    export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
+                    helm install -f ../${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n seba-services cord/seba-services
+                    """
+                }
+                timeout(10) {
+                    waitUntil {
+                        att_workflow_tosca_completed = sh returnStdout: true, script: """
+                        export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
+                        kubectl get pods | grep -i seba-services-tosca-loader | grep -i completed | wc -l
+                        """
+                        return att_workflow_tosca_completed.toInteger() == 1
+                    }
+                }
+            }
+            stage('Install base-kubernetes') {
+                timeout(10) {
+                    sh returnStdout: true, script: """
+                    export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
+                    helm install -f ../${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n base-kubernetes cord/base-kubernetes
+                    """
+                }
+                timeout(10) {
+                    waitUntil {
+                        base_kubernetes_tosca_running = sh returnStdout: true, script: """
+                        export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
+                        kubectl get pods | grep -i base-kubernetes-tosca-loader | grep -i completed | wc -l
+                        """
+                        return base_kubernetes_tosca_running.toInteger() == 1
+                    }
+                }
+            }
+            stage('Install att workflow') {
+                timeout(10) {
+                    sh returnStdout: true, script: """
+                    export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
+                    helm install -f ../${configBaseDir}/${configKubernetesDir}/${configFileName}.yml --set att-workflow-driver.kafkaService=cord-kafka -n att-workflow cord/att-workflow
+                    """
+                }
+                timeout(10) {
+                    waitUntil {
+                        att_workflow_tosca_completed = sh returnStdout: true, script: """
+                        export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
+                        kubectl get pods | grep -i att-workflow-tosca-loader | grep -i completed | wc -l
+                        """
+                        return att_workflow_tosca_completed.toInteger() == 1
+                    }
+                }
+            }
+
             if ( params.reinstallOlt ) {
                 stage('Reinstall OLT software') {
                     for(int i=0; i < deployment_config.olts.size(); i++) {