Merge "[EDGEPOD-210]: Add COMAC-in-a-box automation to CORD Jenkins Job"
diff --git a/jjb/comac-in-a-box.yaml b/jjb/comac-in-a-box.yaml
new file mode 100644
index 0000000..09bf652
--- /dev/null
+++ b/jjb/comac-in-a-box.yaml
@@ -0,0 +1,69 @@
+# COMAC in a box test for helm-charts repo
+
+- job-template:
+    id: 'comac-in-a-box'
+    name: '{name}'
+    project-type: pipeline
+
+    pipeline-script: 'comac-in-a-box.groovy'
+
+    description: |
+      Automated build on AMI executor using {pipeline-script}. <br /><br />
+      Created from job-template {id} from ci-management/jjb/charts.yaml <br />
+      Created by Jeremy Ronquillo, jeremyr@opennetworking.org <br />
+      Copyright (c) 2020 Open Networking Foundation (ONF)
+
+    triggers:
+      - gerrit:
+          server-name: '{gerrit-server-name}'
+          dependency-jobs: '{dependency-jobs}'
+          trigger-on:
+            - patchset-created-event:
+                exclude-drafts: true
+                exclude-trivial-rebase: false
+                exclude-no-code-change: true
+            - draft-published-event
+            - comment-added-contains-event:
+                comment-contains-value: '(?i)^.*recheck$'
+          projects:
+            - project-compare-type: REG_EXP
+              project-pattern: 'helm-charts'
+              branches:
+                - branch-compare-type: REG_EXP
+                  branch-pattern: '{all-branches-regexp}'
+              file-paths:
+                - compare-type: REG_EXP
+                  pattern: 'omec/.*'
+                - compare-type: REG_EXP
+                  pattern: 'aether-apps/.*'
+
+    properties:
+      - cord-infra-properties:
+          build-days-to-keep: '{build-days-to-keep}'
+          artifact-num-to-keep: '{artifact-num-to-keep}'
+
+    wrappers:
+      - lf-infra-wrappers:
+          build-timeout: '{build-timeout}'
+          jenkins-ssh-credential: '{jenkins-ssh-credential}'
+
+    parameters:
+      - string:
+          name: buildNode
+          default: 'comac_in_a_box'
+          description: 'Name of the Jenkins executor node to run the job on'
+
+    scm:
+      - lf-infra-gerrit-scm:
+          git-url: '$GIT_URL/$GERRIT_PROJECT'
+          refspec: '$GERRIT_REFSPEC'
+          branch: '$GERRIT_BRANCH'
+          submodule-disable: '{submodule-disable}'
+          submodule-recursive: 'false'
+          submodule-timeout: '{submodule-timeout}'
+          choosing-strategy: gerrit
+          jenkins-ssh-credential: '{jenkins-ssh-credential}'
+
+    concurrent: false
+
+    dsl: !include-raw-escape: pipeline/{pipeline-script}
diff --git a/jjb/pipeline/comac-in-a-box.groovy b/jjb/pipeline/comac-in-a-box.groovy
new file mode 100644
index 0000000..a4a4688
--- /dev/null
+++ b/jjb/pipeline/comac-in-a-box.groovy
@@ -0,0 +1,58 @@
+// Copyright 2020-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.
+
+// comac-in-a-box build+test
+// steps taken from https://guide.opencord.org/profiles/comac/install/ciab.html
+
+pipeline {
+
+  /* no label, executor is determined by JJB */
+  agent {
+    label "${params.buildNode}"
+  }
+
+  options {
+    timeout(time: 1, unit: 'HOURS')
+  }
+
+  stages {
+    stage ("Fetch Helm-Charts Changes"){
+      steps {
+        sh label: 'Fetch helm-charts Gerrit Changes', script: """
+          cd cord/helm-charts/
+          pwd
+          if [ ! -z "${GERRIT_REFSPEC}" ]
+          then
+            echo "Checking out Gerrit patchset: ${GERRIT_REFSPEC}"
+            git fetch ${gitUrl} ${GERRIT_REFSPEC} && git checkout FETCH_HEAD
+          else
+            echo "GERRIT_REFSPEC not provided. Checking out master branch."
+            git checkout master
+          fi
+          """
+      }
+    }
+
+    stage ("Run COMAC-in-a-box"){
+      steps {
+        sh label: 'Run Makefile', script: '''
+          HOME=$(pwd)
+          cd automation-tools/comac-in-a-box/
+          sudo make reset-test
+          sudo make test
+          '''
+      }
+    }
+  }
+}
diff --git a/jjb/verify/helm-charts.yaml b/jjb/verify/helm-charts.yaml
index 137586b..2c9ffe4 100644
--- a/jjb/verify/helm-charts.yaml
+++ b/jjb/verify/helm-charts.yaml
@@ -16,6 +16,8 @@
           branch: 'cord-6.0'
           name-extension: '-cord6.0'
           timed-trigger: '{once-a-day}'
+      - 'comac-in-a-box':
+          name: 'comac-in-a-box'
 
 - job-group:
     name: 'verify-helm-charts-jobs'