Use include-regions to limit packer build paths 84/11184/6
authorThanh Ha <thanh.ha@linuxfoundation.org>
Mon, 11 Jun 2018 23:04:14 +0000 (19:04 -0400)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Tue, 12 Jun 2018 01:14:38 +0000 (21:14 -0400)
Issue: RELENG-1022
Change-Id: I283400e5ac2473e2eabb883c44a2a1e705b312ee
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
jjb/lf-ci-jobs.yaml

index 668342a..cc4399b 100644 (file)
             - file-id: jjbini-sandbox
               target: '$HOME/.config/jenkins_jobs/jenkins_jobs.ini'
 
-- lf_packer_file_paths: &lf_packer_file_paths
-    name: lf-packer-file-paths
-    file-paths:
-      - compare-type: ANT
-        pattern: 'packer/vars/{platforms}.json'
-      - compare-type: ANT
-        pattern: 'packer/templates/{templates}.json'
-      - compare-type: ANT
-        pattern: 'packer/provision/*.sh'
-      - compare-type: ANT
-        pattern: 'packer/provision/{templates}.yaml'
-      - compare-type: ANT
-        pattern: 'packer/provision/local-{templates}.yaml'
-      - compare-type: ANT
-        pattern: 'packer/provision/lib/**'
-
 - lf_packer: &lf_packer_common
     name: lf-packer-common
     # Provide configuration common in packer jobs.
 - lf_packer_merge: &lf_packer_merge
     name: lf-packer-merge
 
-    ######################
-    # Default parameters #
-    ######################
-
-    gerrit_merge_triggers:
-      - change-merged-event
-      - comment-added-contains-event:
-          comment-contains-value: remerge$
-
     #####################
     # Job Configuration #
     #####################
     # yamllint disable-line rule:key-duplicates
     <<: *lf_packer_merge
 
+    ######################
+    # Default parameters #
+    ######################
+
     git-url: '$GIT_URL/$GERRIT_PROJECT'
 
+    gerrit_merge_triggers:
+      - change-merged-event
+      - comment-added-contains-event:
+          comment-contains-value: remerge$
+
+    #####################
+    # Job Configuration #
+    #####################
+
     scm:
       - lf-infra-gerrit-scm:
           git-url: '{git-url}'
               branches:
                 - branch-compare-type: ANT
                   branch-pattern: '**/{branch}'
-              <<: *lf_packer_file_paths
+              file-paths:
+                - compare-type: REG_EXP
+                  pattern: 'packer\/provision\/.*\.sh'
+                - compare-type: REG_EXP
+                  pattern: 'packer\/provision\/{templates}\.yaml'
+                - compare-type: REG_EXP
+                  pattern: 'packer\/provision\/local-{templates}\.yaml'
+                - compare-type: REG_EXP
+                  pattern: 'packer\/templates\/{templates}\.json'
+                - compare-type: REG_EXP
+                  pattern: 'packer\/vars\/{platforms}\.json'
 
 - job-template:
     name: '{project-name}-packer-merge-{platforms}-{templates}'
     # yamllint disable-line rule:key-duplicates
     <<: *lf_packer_merge
 
+    #####################
+    # Job Configuration #
+    #####################
+
     properties:
       - github:
           url: '{git-url}/{github-org}/{project}'
       - github
       - pollscm:
           cron: ''
-      - lf-infra-github-pr-trigger:
+
+      - github-pull-request:
           trigger-phrase: '^remerge$'
           only-trigger-phrase: true
-          status-context: 'Packer {platforms}-${templates} Merge'
+          status-context: 'Packer {platforms}-{templates} Merge'
           permit-all: false
           github-hooks: true
-          github-org: '{github-org}'
-          github_pr_whitelist: '{obj:github_pr_whitelist}'
-          github_pr_admin_list: '{obj:github_pr_admin_list}'
+          org-list:
+            - '{github-org}'
+          white-list: '{obj:github_pr_whitelist}'
+          admin-list: '{obj:github_pr_admin_list}'
+          # included-regions MUST match Gerrit Trigger file-paths
+          included-regions:
+            - 'packer\/provision\/.*\.sh'
+            - 'packer\/provision\/{templates}\.yaml'
+            - 'packer\/provision\/local-{templates}\.yaml'
+            - 'packer\/templates\/{templates}\.json'
+            - 'packer\/vars\/{platforms}\.json'
 
 #################
 # Packer Verify #
           comment-contains-value: recheck$
 
     gerrit_trigger_file_paths:
-      - compare-type: ANT
-        pattern: 'packer/vars/**.json'
-      - compare-type: ANT
-        pattern: 'packer/templates/**.json'
-      - compare-type: ANT
-        pattern: 'packer/provision/**.sh'
-      - compare-type: ANT
-        pattern: 'packer/provision/lib/**'
+      - compare-type: REG_EXP
+        pattern: 'packer\/.*'
+
+    # github_included_regions MUST match gerrit_trigger_file_paths
+    github_included_regions:
+      - 'packer\/.*'
 
     #####################
     # Job Configuration #
     # yamllint disable-line rule:key-duplicates
     <<: *lf_packer_verify
 
+    ######################
+    # Default parameters #
+    ######################
+
     git-url: '$GIT_URL/$GERRIT_PROJECT'
 
+    #####################
+    # Job Configuration #
+    #####################
+
     scm:
       - lf-infra-gerrit-scm:
           git-url: '{git-url}'
     # yamllint disable-line rule:key-duplicates
     <<: *lf_packer_verify
 
+    #####################
+    # Job Configuration #
+    #####################
+
     properties:
       - github:
           url: '{git-url}/{github-org}/{project}'
           jenkins-ssh-credential: '{jenkins-ssh-credential}'
 
     triggers:
-      - lf-infra-github-pr-trigger:
+      - github-pull-request:
           trigger-phrase: '^recheck$'
           only-trigger-phrase: false
           status-context: 'Packer Verify'
           permit-all: true
           github-hooks: true
-          github-org: ''
-          github_pr_whitelist:
-            - ''
-          github_pr_admin_list:
-            - ''
+          included-regions: '{obj:github_included_regions}'