make helm-charts API test run periodically and after merge

Change-Id: Ib46cf19cba79bbf475258c33f9d2da54301aca70
diff --git a/jjb/defaults.yaml b/jjb/defaults.yaml
index 3a40136..d4b4232 100644
--- a/jjb/defaults.yaml
+++ b/jjb/defaults.yaml
@@ -27,6 +27,15 @@
     # build timeout (minutes)
     build-timeout: 10
 
+    # timed trigger defaults, crontab syntax
+    # H = random value hashed by name of job
+    every-hour: "H * * * *"
+    every-four-hours: "H */4 * * *"
+    every-six-hours: "H */6 * * *"
+    every-eight-hours: "H */8 * * *"
+    twice-a-day: "H */12 * * *"
+    once-a-day: "H 0 * * *"
+
     # The most frequently used type of build node
     # see other build node types under "Cloud > Amazon EC2" at
     #  https://jenkins.opencord.org/configure
diff --git a/jjb/pipeline/chart-api-test-helm.groovy b/jjb/pipeline/chart-api-test-helm.groovy
index 89021e4..9149221 100644
--- a/jjb/pipeline/chart-api-test-helm.groovy
+++ b/jjb/pipeline/chart-api-test-helm.groovy
@@ -42,18 +42,6 @@
       }
     }
 
-    stage('patch') {
-      steps {
-        sh """
-           pushd cord
-           PROJECT_PATH=\$(xmllint --xpath "string(//project[@name=\\\"${gerritProject}\\\"]/@path)" .repo/manifest.xml)
-           repo download "\$PROJECT_PATH" "${gerritChangeNumber}/${gerritPatchsetNumber}"
-           popd
-           """
-      }
-    }
-
-
     stage('minikube') {
       steps {
         /* see https://github.com/kubernetes/minikube/#linux-continuous-integration-without-vm-support */
diff --git a/jjb/triggered-api-test.yaml b/jjb/triggered-api-test.yaml
new file mode 100644
index 0000000..5c56f1b
--- /dev/null
+++ b/jjb/triggered-api-test.yaml
@@ -0,0 +1,49 @@
+---
+# CORD API tests using cord-tester, triggered by merge or schedule
+
+- job-template:
+    id: triggered-api-test
+    name: 'verify_{project}{name-extension}_triggered-api-test'
+    description: |
+      Triggers an api test in a pipeline post-merge or on a schedule.
+      Created by {id} job-template from ci-management/jjb/triggered-api-test.yaml, using pipeline: {pipeline_script}
+
+    triggers:
+      - cord-infra-gerrit-trigger-merge:
+          gerrit-server-name: '{gerrit-server-name}'
+          project-regexp: '^{project}$'
+          branch-regexp: '{branch-regexp}'
+          file-include-regexp: '{all-files-regexp}'
+          dependency-jobs: '{dependency-jobs}'
+      - timed: '{timed-trigger}'
+
+    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: '60'
+          jenkins-ssh-credential: '{jenkins-ssh-credential}'
+
+    parameters:
+      - string:
+         name: executorNode
+         default: 'ubuntu16.04-basebuild-4c-8g'
+         description: 'Name of the Jenkins node to run the job on'
+
+      - string:
+         name: manifestUrl
+         default: '{gerrit-server-url}/{cord-repo-manifest}'
+         description: 'URL to the repo manifest'
+
+      - string:
+         name: manifestBranch
+         default: '$GERRIT_BRANCH'
+         description: 'Name of the repo branch to use'
+
+    project-type: pipeline
+    concurrent: true
+
+    dsl: !include-raw-escape: pipeline/{pipeline_script}
diff --git a/jjb/verify/helm-charts.yaml b/jjb/verify/helm-charts.yaml
index 03918a1..37ca0de 100644
--- a/jjb/verify/helm-charts.yaml
+++ b/jjb/verify/helm-charts.yaml
@@ -8,6 +8,9 @@
     jobs:
       - 'verify-helm-charts-jobs':
           branch-regexp: '{modern-branches-regexp}'
+      - 'post-merge-helm-charts-jobs':
+          branch-regexp: '{modern-branches-regexp}'
+          timed-trigger: '{every-four-hours}'
 
 - job-group:
     name: 'verify-helm-charts-jobs'
@@ -19,7 +22,9 @@
           dependency-jobs: 'verify_helm-charts_tag-collision'
       - 'verify-sonarqube':
           dependency-jobs: 'verify_helm-charts_helm-lint'
-      - 'api-test':
-          dependency-jobs: 'verify_helm-charts_sonarqube'
-          pipeline_script: 'chart-api-test-helm.groovy'
 
+- job-group:
+    name: 'post-merge-helm-charts-jobs'
+    jobs:
+      - 'triggered-api-test':
+          pipeline_script: 'chart-api-test-helm.groovy'