Merge "Running the BBR Scale job every 4 hours"
diff --git a/jjb/comac-in-a-box.yaml b/jjb/comac-in-a-box-gerrit.yaml
similarity index 91%
rename from jjb/comac-in-a-box.yaml
rename to jjb/comac-in-a-box-gerrit.yaml
index 8fa4a6f..7eac98b 100644
--- a/jjb/comac-in-a-box.yaml
+++ b/jjb/comac-in-a-box-gerrit.yaml
@@ -1,15 +1,15 @@
 # COMAC in a box test for helm-charts repo
 
 - job-template:
-    id: 'comac-in-a-box'
+    id: 'comac-in-a-box-gerrit'
     name: '{name}'
     project-type: pipeline
 
-    pipeline-script: 'comac-in-a-box.groovy'
+    pipeline-script: 'comac-in-a-box-gerrit.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 from job-template {id} from ci-management/jjb/comac-in-a-box-gerrit.yaml <br />
       Created by Jeremy Ronquillo, jeremyr@opennetworking.org <br />
       Copyright (c) 2020 Open Networking Foundation (ONF)
 
@@ -55,7 +55,7 @@
       - string:
           name: GERRIT_REFSPEC
           default: '$GERRIT_REFSPEC'
-          description: 'Gerrit ref to fetch.' 
+          description: 'Gerrit ref to fetch.'
       - string:
           name: gitUrl
           default: '{gerrit-server-url}/$GERRIT_PROJECT'
diff --git a/jjb/pipeline/comac-in-a-box-gerrit.groovy b/jjb/pipeline/comac-in-a-box-gerrit.groovy
new file mode 100644
index 0000000..dc2be39
--- /dev/null
+++ b/jjb/pipeline/comac-in-a-box-gerrit.groovy
@@ -0,0 +1,77 @@
+// 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-gerrit 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 ("Environment Setup"){
+      steps {
+        sh label: 'Run COMAC-in-a-box reset-test', script: """
+          echo $HOME
+          cd $HOME/automation-tools/comac-in-a-box/
+          sudo make reset-test
+          """
+        sh label: 'Cleanup Docker Images', script: '''
+          sudo docker rmi -f $(sudo docker images --format '{{.Repository}} {{.ID}}' | grep 'none' | awk '{print $2}') || true
+          sudo docker rmi -f $(sudo docker images --format '{{.Repository}}:{{.Tag}}' | grep 'openmme') || true
+          sudo docker rmi -f $(sudo docker images --format '{{.Repository}}:{{.Tag}}' | grep 'ngic') || true
+          sudo docker rmi -f $(sudo docker images --format '{{.Repository}}:{{.Tag}}' | grep 'c3po') || true
+          '''
+        sh label: 'helm-charts Repo Fresh Clone', script: """
+          cd $HOME/cord/
+          sudo rm -rf helm-charts/
+          git clone https://gerrit.opencord.org/helm-charts
+          """
+      }
+    }
+
+    stage ("Fetch Helm-Charts Changes"){
+      steps {
+        sh label: 'Fetch helm-charts Gerrit Changes', script: """
+          cd $HOME/cord/helm-charts/
+          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: """
+          cd $HOME/automation-tools/comac-in-a-box/
+          sudo make reset-test
+          sudo make test
+          """
+      }
+    }
+  }
+}
diff --git a/jjb/pipeline/comac-in-a-box.groovy b/jjb/pipeline/comac-in-a-box.groovy
deleted file mode 100644
index a4a4688..0000000
--- a/jjb/pipeline/comac-in-a-box.groovy
+++ /dev/null
@@ -1,58 +0,0 @@
-// 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 2c9ffe4..39ac206 100644
--- a/jjb/verify/helm-charts.yaml
+++ b/jjb/verify/helm-charts.yaml
@@ -16,8 +16,8 @@
           branch: 'cord-6.0'
           name-extension: '-cord6.0'
           timed-trigger: '{once-a-day}'
-      - 'comac-in-a-box':
-          name: 'comac-in-a-box'
+      - 'comac-in-a-box-gerrit':
+          name: 'comac-in-a-box-gerrit'
 
 - job-group:
     name: 'verify-helm-charts-jobs'