fix macros that needed indent, add Jenkinsfile lint tool

Change-Id: Ifad9ff9b8b5e4099cc1ea3d61e18d279002aa974
diff --git a/jjb/cord-macros.yaml b/jjb/cord-macros.yaml
index fec8d43..c4709dd 100644
--- a/jjb/cord-macros.yaml
+++ b/jjb/cord-macros.yaml
@@ -39,38 +39,38 @@
 - trigger:
     name: cord-infra-gerrit-trigger-patchset
     triggers:
-      gerrit:
-        server-name: '{gerrit-server-name}'
-        dependency-jobs: '{dependency-jobs}'
-        silent-start: true
-        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: '{project-regexp}'
-            branches:
-              - branch-compare-type: REG_EXP
-                branch-pattern: '{branch-regexp}'
+      - gerrit:
+          server-name: '{gerrit-server-name}'
+          dependency-jobs: '{dependency-jobs}'
+          silent-start: true
+          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: '{project-regexp}'
+              branches:
+                - branch-compare-type: REG_EXP
+                  branch-pattern: '{branch-regexp}'
 
 # trigger on gerrit commits/merges
 - trigger:
     name: cord-infra-gerrit-trigger-merge
     triggers:
-      gerrit:
-        server-name: '{gerrit-server-name}'
-        dependency-jobs: '{dependency-jobs}'
-        silent-start: True
-        trigger-on:
-          - change-merged-event
-        projects:
-          - project-compare-type: REG_EXP
-            project-pattern: '{project-regexp}'
-            branches:
-              - branch-compare-type: REG_EXP
-                branch-pattern: '{branch-regexp}'
+      - gerrit:
+          server-name: '{gerrit-server-name}'
+          dependency-jobs: '{dependency-jobs}'
+          silent-start: True
+          trigger-on:
+            - change-merged-event
+          projects:
+            - project-compare-type: REG_EXP
+              project-pattern: '{project-regexp}'
+              branches:
+                - branch-compare-type: REG_EXP
+                  branch-pattern: '{branch-regexp}'
diff --git a/jjb/cord-test/cord-test-pipeline.yaml b/jjb/cord-test/cord-test-pipeline.yaml
index f8e9f87..466a80c 100644
--- a/jjb/cord-test/cord-test-pipeline.yaml
+++ b/jjb/cord-test/cord-test-pipeline.yaml
@@ -98,7 +98,7 @@
 
     triggers:
       - gerrit:
-         server-name: 'CORD Gerrit'
+         server-name: '{gerrit-server-name}'
          trigger-on:
            - patchset-created-event:
                exclude-drafts: false
diff --git a/jjb/shell/jflint.sh b/jjb/shell/jflint.sh
new file mode 100755
index 0000000..8ece6b7
--- /dev/null
+++ b/jjb/shell/jflint.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+
+# jflint.sh - lint for Jenkins declarative pipeline jobs
+#
+# curl commands from: https://jenkins.io/doc/book/pipeline/development/#linter
+
+set -e -u -o pipefail
+
+JENKINS_URL=https://jenkins-new.opencord.org/
+JF_LIST=()
+
+# if no args, and there's a Jenkinsfile in cwd, check it
+if [ ! -n "$1" ] && [ -f "Jenkinsfile" ] ; then
+  JF_LIST+=("Jenkinsfile")
+else
+# iterate over all args, check if they exist, then add to list of jenkinsfiles to check
+  for arg in "$@"; do
+    if [ -f "$arg" ]; then
+      JF_LIST+=($arg)
+    else
+      echo "File does not exist: ${arg}"
+      exit 1;
+    fi
+  done
+fi
+
+# JENKINS_CRUMB is needed if your Jenkins master has CRSF protection enabled as it should
+JENKINS_CRUMB=$(curl "$JENKINS_URL/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,\":\",//crumb)")
+
+for target in "${JF_LIST[@]-}"; do
+  echo "Checking '${target}'"
+  curl -X POST -H "${JENKINS_CRUMB}" -F "jenkinsfile=<${target}" $JENKINS_URL/pipeline-model-converter/validate
+done
+