diff --git a/Jenkinsfile-comac-release-build b/Jenkinsfile-comac-release-build
new file mode 100644
index 0000000..8d05dee
--- /dev/null
+++ b/Jenkinsfile-comac-release-build
@@ -0,0 +1,411 @@
+// Copyright 2019-present Open Networking Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+node ("${TestNodeName}") {
+    timeout (100) {
+        try {
+            // Start Jenkins steps from here
+            stage ("Parse deployment configuration files") {
+                sh returnStdout: true, script: "rm -rf helm-charts helm-repo-tools ${configBaseDir}"
+                sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/helm-repo-tools"
+                sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/helm-charts"
+                sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/${configBaseDir}"
+                deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml"
+            }
+
+            // Define KUBECONFIG & HELMCONFIG environment variable to use in steps
+            env.KUBECONFIG="$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf"
+            env.HELMCONFIG="$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml"
+
+            stage('Clean up') {
+                timeout(10) {
+                    // Force helm client to reload server pod, otherwise it'll possible fail on version compatible issue.
+                    sh returnStdout: true, script: "helm init --upgrade --force-upgrade"
+
+                    timeout(1) {
+                        waitUntil {
+                            tillerpod_running = sh returnStdout: true, script: """
+                            kubectl -n kube-system get pods | grep tiller-deploy | grep Running | wc -l
+                            """
+                            return tillerpod_running.toInteger() == 1
+                        }
+                    }
+
+                    // Deleted all of charts
+                    sh returnStdout: true, script: """
+                    for hchart in \$(helm list -q | grep -E -v 'docker-registry|mavenrepo|ponnet');
+                    do
+                        echo "Purging chart: \${hchart}"
+                        helm delete --purge "\${hchart}"
+                    done
+                    """
+
+                    timeout(3) {
+                        waitUntil {
+                            charts_deleted = sh returnStdout: true, script: """
+                            helm ls -q | grep -E -v 'docker-registry|mavenrepo|ponnet' | wc -l
+                            """
+                            return charts_deleted.toInteger() == 0
+                        }
+                    }
+
+                    timeout(3) {
+                        waitUntil {
+                            allpods_deleted = sh returnStdout: true, script: """
+                            kubectl get pods --all-namespaces --no-headers |\
+                            grep -E -v 'kube-system|docker-registry|mavenrepo|ponnet|test' | wc -l
+                            """
+                            return allpods_deleted.toInteger() == 0
+                        }
+                    }
+                }
+            }
+
+            stage('Add Helm repositories') {
+                sh returnStdout: true, script: """
+                helm repo add cord https://charts.opencord.org
+                helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator
+                helm repo update
+                """
+
+                timeout(1) {
+                    waitUntil {
+                        tillerpod_running = sh returnStdout: true, script: """
+                        kubectl -n kube-system get pods | grep tiller-deploy | grep Running | wc -l
+                        """
+                        return tillerpod_running.toInteger() == 1
+                    }
+                }
+
+                timeout(1) {
+                    waitUntil {
+                        cord_repo_present = sh returnStdout: true, script: """
+                        helm repo list | grep cord | wc -l
+                        """
+                        return cord_repo_present.toInteger() == 1
+                    }
+                }
+            }
+
+            stage('Install CORD Platform') {
+                sh returnStdout: true, script: """
+                helm install -f $HELMCONFIG -n cord-platform --version 7.0.0 cord/cord-platform
+                """
+
+                timeout(1) {
+                    waitUntil {
+                        cord_helm_installed = sh returnStdout: true, script: """
+                        helm ls | grep -i cord-platform | wc -l
+                        """
+                        return cord_helm_installed.toInteger() == 1
+                    }
+                }
+            }
+
+            stage('Wait for etcd-operator to be installed') {
+                timeout(10) {
+                    waitUntil {
+                        etcd_operator_installed = sh returnStdout: true, script: """
+                        kubectl get pods | grep -i etcd-operator | grep -i running | wc -l
+                        """
+                        crd_present = sh returnStdout: true, script: """
+                        kubectl get crd | grep -i etcd | wc -l
+                        """
+                        return etcd_operator_installed.toInteger() + crd_present.toInteger() == 6
+                    }
+                }
+            }
+
+            stage('Verify that CORD Kafka service is ready') {
+                timeout(3) {
+                    waitUntil {
+                        kafka_instances_running = sh returnStdout: true, script: """
+                        kubectl get pods | grep cord-platform-kafka | grep -i running | grep 1/1 | wc -l
+                        """
+                        return kafka_instances_running.toInteger() == 1
+                    }
+                }
+            }
+
+            stage('Verify that CORD Zookeeper service is ready') {
+                timeout(3) {
+                    waitUntil {
+                        zookeeper_instances_running = sh returnStdout: true, script: """
+                        kubectl get pods | grep cord-platform-zookeeper | grep -i running | grep 1/1 | wc -l
+                        """
+                        return zookeeper_instances_running.toInteger() == 1
+                    }
+                }
+            }
+
+            stage('Verify that XOS is ready') {
+                timeout(3) {
+                    waitUntil {
+                        xos_core_running = sh returnStdout: true, script: """
+                        kubectl get pods | grep -i xos | grep -i running | grep 1/1 | wc -l
+                        """
+                        return xos_core_running.toInteger() == 6
+                    }
+                }
+            }
+
+            stage('Verify that NEM is ready') {
+                // prometheus
+                timeout(10) {
+                    waitUntil {
+                        prometheus_running = sh returnStdout: true, script: """
+                        kubectl get pods | grep -i prometheus | grep -i running | grep -e "1/1" -e "2/2" | wc -l
+                        """
+                        return prometheus_running.toInteger() == 6
+                    }
+                }
+                // grafana
+                timeout(10) {
+                    waitUntil {
+                        grafana_running = sh returnStdout: true, script: """
+                        kubectl get pods | grep -i grafana | grep -i running | grep 2/2 | wc -l
+                        """
+                        return grafana_running.toInteger() == 1
+                    }
+                }
+
+                // kpi-exporter
+                timeout(10) {
+                    waitUntil {
+                        kpiexporter_running = sh returnStdout: true, script: """
+                        kubectl get pods | grep -i kpi-exporter | grep -v Running | wc -l
+                        """
+                        return kpiexporter_running.toInteger() == 0
+                    }
+                }
+            }
+
+            stage('Verify that Logging is ready') {
+                // elasticsearch
+                elasticsearch_running = sh returnStdout: true, script: """
+                kubectl get pods | grep -i elasticsearch | grep -v Running | wc -l
+                """
+                return elasticsearch_running.toInteger() == 0
+
+                // kibana
+                kibana_running = sh returnStdout: true, script: """
+                kubectl get pods | grep -i kibana | grep -i running | grep 1/1 | wc -l
+                """
+                return kibana_running.toInteger() == 1
+
+                // logstash
+                logstash_running = sh returnStdout: true, script: """
+                kubectl get pods | grep -i logstash | grep -i running | grep 1/1 | wc -l
+                """
+                return logstash_running.toInteger() == 1
+            }
+
+
+            stage('Install COMAC-Platform') {
+                sh returnStdout: true, script: """
+                kubectl delete crd network-attachment-definitions.k8s.cni.cncf.io || true
+                helm install -n comac-platform --set mcord-setup.sriov_vfio.devicepci=04:00.0 --set mcord-setup.sriov_netdevice.devicepci=04:00.0 --version 0.0.2 cord/comac-platform
+                """
+            }
+
+            stage('Verify and redploying OMEC-CNI when problem happens') {
+                // verification
+                timeout(1) {
+                    waitUntil {
+                        network_definition_crd_exist = sh returnStdout: true, script: """
+                        kubectl get crd -o json | jq -r '.items[].spec | select(.group=="k8s.cni.cncf.io").names.kind' |\
+                        grep -E 'NetworkAttachmentDefinition' | wc -l
+                        """
+                        return network_definition_crd_exist.toInteger() == 1
+                    }
+                }
+
+                // verification: mcord-setup pods will be deployed for each machine
+                timeout (1) {
+                    waitUntil {
+                        num_sriov_pods = sh returnStdout: true, script: """
+                        kubectl get pods -n kube-system | grep sriov | wc -l
+                        """
+                        return num_sriov_pods.toInteger() == deployment_config.nodes.size()
+                    }
+                }
+
+                // redeployment: facing "MountVolume.Setup failed", mcord-setup will be redeployed
+                max_retry_index = 100;
+                for (int i = 0; i<max_retry_index; i++) {
+                    // warming-up period
+                    sh returnStdout: true, script: "sleep 30"
+
+                    sh script: """
+                    init_num_sriov=\$(kubectl get pods -n kube-system | grep sriov | grep Init | wc -l);
+                    for pod in \$(kubectl get pods -n kube-system | grep sriov | grep Init | awk '{print \$1}');
+                    do
+                        echo \$pod is initializing
+                        num_err_msgs=\$(kubectl describe pods \$pod -n kube-system | tail -4 | grep -E 'MountVolume.SetUp failed' | wc -l)
+                        if [ \$num_err_msgs > 0 ]; then
+                            kubectl delete pod \$pod -n kube-system --force --grace-period=0
+                        fi
+                    done
+                    """
+
+                    sriov_all_ready = sh returnStdout: true, script: """
+                    kubectl get pods -n kube-system | grep sriov | grep Running | wc -l
+                    """
+                    if (sriov_all_ready.toInteger() == deployment_config.nodes.size()) {
+                        break;
+                    }
+                }
+
+                // verification: tillerpod
+                // Sometimes tillerpod is up, but it's not ready to accept deployment yet
+                // use helm ls to make sure it's ready.
+                timeout(1) {
+                    waitUntil {
+                        helm_client_working = sh returnStatus: true, script: "helm ls"
+                        return helm_client_working == 0
+                    }
+                }
+
+                // Before Start to deploy services, we need to take 10 seconds wait
+                // Cooling down period
+                sh returnStdout: true, script: "sleep 10"
+            }
+
+            stage('Wait for etcd-cluster to be installed') {
+                timeout(10) {
+                    waitUntil {
+                        etcd_cluster_running = sh returnStdout: true, script: """
+                        kubectl get pods | grep etcd-cluster | grep -i running | grep 1/1 | wc -l
+                        """
+                        return etcd_cluster_running.toInteger() == 1
+                    }
+                }
+            }
+
+
+            stage('Verify that M-CORD Profile is ready') {
+                timeout(10) {
+                    waitUntil {
+                        mcord_tosca_completed = sh returnStdout: true, script: """
+                        kubectl get pods | grep -i comac-platform-mcord-tosca-loader | grep -i completed | wc -l
+                        """
+                        return mcord_tosca_completed.toInteger() == 1
+                    }
+                }
+            }
+
+            stage('Verify that base-kubernetes is ready') {
+
+                timeout(5) {
+                    waitUntil {
+                        base_kubernetes_tosca_completed = sh returnStdout: true, script: """
+                        kubectl get pods | grep -i comac-platform-base-kubernetes-tosca-loader | grep -i completed | wc -l
+                        """
+                        return base_kubernetes_tosca_completed.toInteger() == 1
+                    }
+                }
+            }
+
+            stage("Deploy M-CORD Services") {
+                sh returnStatus: true, script: """
+                helm install -f $HELMCONFIG --set mme.type=openmme --set mme.conf.mme.mcc.dig1=3 --set mme.conf.mme.mcc.dig2=0 --set mme.conf.mme.mcc.dig3=2 --set mme.conf.mme.mnc.dig1=7 --set mme.conf.mme.mnc.dig2=2 --set mme.conf.mme.mnc.dig3=0 --set enb.host=119.0.0.10 -n mcord-services cord/mcord-services
+                """
+
+                timeout (3) {
+                    waitUntil {
+                        // We should have 5 statefulsets: hss, hssdb, mme, spgwc, spgwu
+                        mcord_services_running = sh returnStdout: true, script: """
+                        kubectl get statefulset.apps -o json | jq '.items[].metadata.name' | grep -v cord-platform | wc -l
+                        """
+                        return mcord_services_running.toInteger() == 5
+                    }
+                }
+            }
+
+            stage("Deploy CDN-Remote Services") {
+                sh returnStatus: true, script: """
+                helm install -f $HELMCONFIG -n cdn-remote --set remote_streaming.antmedia_ip=${deployment_config.nodes[0].ip} \
+                --set stream_name=360 --set remote_streaming.video_quality=360 cord/cdn-remote
+                """
+
+                timeout (3) {
+                    waitUntil {
+                        // Are AntMedia server and ffMPEG containers ready?
+                        cdn_remote_service_running = sh returnStdout: true, script: """
+                        kubectl get statefulset.apps -o json | jq '.items[].metadata.name' | grep -E 'antmedia|remote-streaming' | wc -l
+                        """
+                        return cdn_remote_service_running.toInteger() == 2
+                    }
+                }
+
+            }
+
+            stage("Deploy CDN-Local Services") {
+                //Is SPGW-U ready?
+                timeout(3) {
+                    waitUntil {
+                        spgwu_running = sh returnStdout: true, script: """
+                        kubectl get pods | grep spgwu | grep Running | grep 1/1 | wc -l
+                        """
+                        return spgwu_running.toInteger() == 1
+                    }
+                }
+
+                cdn_local_service_deployed = sh returnStatus: true, script: """
+                spgwu_ip=\$(kubectl exec -it spgwu-0  -- ip -4 addr show dev sgi-net | grep inet | awk '{print \$2}' | awk -F '/' '{print \$1}');
+                helm install -f $HELMCONFIG -n cdn-local --set remote_ip=${deployment_config.nodes[0].ip} --set stream_name=360 \
+                --set spgwu_sgiip=\$spgwu_ip cord/cdn-local
+                """
+                return cdn_local_service_deployed == 0
+
+                timeout(3) {
+                    waitUntil {
+                        // Is NGINX ready?
+                        cdn_local_service_running = sh returnStdout: true, script: """
+                        kubectl get statefulset.apps -o json | jq '.items[].metadata.name' | grep -E 'nginx-rtmp' | wc -l
+                        """
+                        return cdn_local_service_running.toInteger() == 1
+                    }
+                }
+
+            }
+
+            // To-Do: SEBA profile and VNF deployment codes will be added
+
+            if ( params.configurePod ) {
+                dir ("${configBaseDir}/${configToscaDir}/mcord") {
+                    stage('Configure MCORD - Fabric') {
+                        timeout(1) {
+                            waitUntil {
+                                out_fabric = sh returnStdout: true, script: """
+                                curl -s -H "xos-username:admin@opencord.org" -H "xos-password:letmein" -X POST \
+                                --data-binary @${configFileName}-fabric-cavium.yaml http://${deployment_config.nodes[0].ip}:30007/run |\
+                                grep -i "created models" | wc -l
+                                """
+                                return out_fabric.toInteger() == 1
+                            }
+                        }
+                    }
+                }
+            }
+
+            currentBuild.result = 'SUCCESS'
+        } catch (err) {
+            println err.message
+            currentBuild.result = 'FAILURE'
+            step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false])
+        }
+        echo "RESULT: ${currentBuild.result}"
+    }
+}
\ No newline at end of file
