Use include-regions to limit Py build paths 90/11190/3
authorThanh Ha <thanh.ha@linuxfoundation.org>
Tue, 12 Jun 2018 01:56:39 +0000 (21:56 -0400)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Tue, 12 Jun 2018 02:10:44 +0000 (22:10 -0400)
Limit python build paths for GitHub builds similar to what is already
happening with Gerrit versions of these jobs.

Also reorganize the code structure so that the common anchor does not
contain job specific config.

Issue: RELENG-1022
Change-Id: Ieb16ca14cfda425a3efdad0beb346839f6b4aa84
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
jjb/lf-python-jobs.yaml

index 680228a..a647d9e 100644 (file)
@@ -51,7 +51,6 @@
 
     archive-artifacts: >
       **/*.log
-    nexus-iq-cli-version: 1.44.0-01
 
     #####################
     # Job Configuration #
     build-timeout: 60
     git-url: '$GIT_URL/$PROJECT'
     java-version: openjdk8
+    nexus-iq-cli-version: 1.44.0-01
     staging-profile-id: ''  # Unused in this job
     stream: master
     submodule-recursive: true
 
-    gerrit_clm_triggers:
-      - comment-added-contains-event:
-          comment-contains-value: run-clm$
     gerrit_trigger_file_paths:
       - compare-type: ANT
-        pattern: '**'
+        pattern: '.*'
+
+    # github_included_regions MUST match gerrit_trigger_file_paths
+    github_included_regions:
+      - '.*'
 
     #####################
     # Job Configuration #
           default: '{nexus-iq-cli-version}'
           description: Nexus IQ CLI package to download and use.
 
-    triggers:
-      # Build weekly on Saturdays
-      - timed: 'H H * * 6'
-      - gerrit:
-          server-name: '{gerrit-server-name}'
-          trigger-on: '{obj:gerrit_clm_triggers}'
-          projects:
-            - project-compare-type: ANT
-              project-pattern: '{project}'
-              branches:
-                - branch-compare-type: ANT
-                  branch-pattern: '**/{branch}'
-              file-paths: '{obj:gerrit_trigger_file_paths}'
-          skip-vote:
-            successful: true
-            failed: true
-            unstable: true
-            notbuilt: true
     wrappers:
       - credentials-binding:
           - username-password-separated:
     # yamllint disable-line rule:key-duplicates
     <<: *lf_python_xc_clm
 
+    ######################
+    # Default parameters #
+    ######################
+
+    gerrit_clm_triggers:
+      - comment-added-contains-event:
+          comment-contains-value: run-clm$
+
+    #####################
+    # Job Configuration #
+    #####################
+
     scm:
       - lf-infra-gerrit-scm:
           jenkins-ssh-credential: '{jenkins-ssh-credential}'
           submodule-recursive: '{submodule-recursive}'
           choosing-strategy: default
 
+    triggers:
+      # Build weekly on Saturdays
+      - timed: 'H H * * 6'
+      - gerrit:
+          server-name: '{gerrit-server-name}'
+          trigger-on: '{obj:gerrit_clm_triggers}'
+          projects:
+            - project-compare-type: ANT
+              project-pattern: '{project}'
+              branches:
+                - branch-compare-type: ANT
+                  branch-pattern: '**/{branch}'
+              file-paths: '{obj:gerrit_trigger_file_paths}'
+          skip-vote:
+            successful: true
+            failed: true
+            unstable: true
+            notbuilt: true
+
 - job-template:
     name: '{project-name}-python-clm-{stream}'
     id: github-python-xc-clm
           jenkins-ssh-credential: '{jenkins-ssh-credential}'
 
     triggers:
-      - lf-infra-github-pr-trigger:
+      # Build weekly on Saturdays
+      - timed: 'H H * * 6'
+      - github-pull-request:
           trigger-phrase: '^run-clm$'
           only-trigger-phrase: false
           status-context: 'CLM'
           permit-all: true
           github-hooks: true
-          github-org: ''
-          github_pr_whitelist:
-            - ''
-          github_pr_admin_list:
-            - ''
+          included-regions: '{obj:github_included_regions}'
 
 ########################
 # Python Sonar with Tox #
     stream: master
     submodule-recursive: true
 
-    gerrit_sonar_triggers:
-      - comment-added-contains-event:
-          comment-contains-value: run-sonar$
     gerrit_trigger_file_paths:
-      - compare-type: ANT
-        pattern: '**'
+      - compare-type: REG_EXP
+        pattern: '.*'
+
+    # github_included_regions MUST match gerrit_trigger_file_paths
+    github_included_regions:
+      - '.*'
 
     #####################
     # Job Configuration #
               however to use a specific version of the sonar-maven-plugin we
               can call "org.codehaus.mojo:sonar-maven-plugin:3.3.0.603:sonar".
 
-    triggers:
-      - timed: '{obj:cron}'
-      - gerrit:
-          server-name: '{gerrit-server-name}'
-          trigger-on: '{obj:gerrit_sonar_triggers}'
-          projects:
-            - project-compare-type: 'ANT'
-              project-pattern: '{project}'
-              branches:
-                - branch-compare-type: 'ANT'
-                  branch-pattern: '**/master'
-              file-paths: '{obj:gerrit_trigger_file_paths}'
-          skip-vote:
-            successful: true
-            failed: true
-            unstable: true
-            notbuilt: true
-
     builders:
       - shell: !include-raw-escape:
           # Workaround issue where the tox run later breaks the lftools virtualenv.
     # yamllint disable-line rule:key-duplicates
     <<: *lf_tox_sonar
 
+    ######################
+    # Default parameters #
+    ######################
+
+    gerrit_sonar_triggers:
+      - comment-added-contains-event:
+          comment-contains-value: run-sonar$
+
+    #####################
+    # Job Configuration #
+    #####################
+
     scm:
       - lf-infra-gerrit-scm:
           jenkins-ssh-credential: '{jenkins-ssh-credential}'
           submodule-recursive: '{submodule-recursive}'
           choosing-strategy: default
 
+    triggers:
+      - timed: '{obj:cron}'
+      - gerrit:
+          server-name: '{gerrit-server-name}'
+          trigger-on: '{obj:gerrit_sonar_triggers}'
+          projects:
+            - project-compare-type: 'ANT'
+              project-pattern: '{project}'
+              branches:
+                - branch-compare-type: 'ANT'
+                  branch-pattern: '**/{branch}'
+              file-paths: '{obj:gerrit_trigger_file_paths}'
+          skip-vote:
+            successful: true
+            failed: true
+            unstable: true
+            notbuilt: true
+
 - job-template:
     name: '{project-name}-tox-sonar'
     id: github-tox-sonar
           jenkins-ssh-credential: '{jenkins-ssh-credential}'
 
     triggers:
-      - lf-infra-github-pr-trigger:
+      - github-pull-request:
           trigger-phrase: '^run-sonar$'
           only-trigger-phrase: false
           status-context: 'Python Sonar'
           permit-all: true
           github-hooks: true
-          github-org: ''
-          github_pr_whitelist:
-            - ''
-          github_pr_admin_list:
-            - ''
+          included-regions: '{obj:github_included_regions}'
 
 ##############
 # Tox Verify #
     build-days-to-keep: 7
     build-timeout: 15
     git-url: '$GIT_URL/$GERRIT_PROJECT'
+    parallel: true
     python-version: python2
     stream: master
     submodule-recursive: true
     tox-dir: ''
     tox-envs: ''
 
+    gerrit_trigger_file_paths:
+      - compare-type: REG_EXP
+        pattern: '.*'
+
+    # github_included_regions MUST match gerrit_trigger_file_paths
+    github_included_regions:
+      - '.*'
+
     #####################
     # Job Configuration #
     #####################
       - draft-published-event
       - comment-added-contains-event:
           comment-contains-value: recheck$
-    gerrit_trigger_file_paths:
-      - compare-type: ANT
-        pattern: '**'
-
-    parallel: true
 
     #####################
     # Job Configuration #
       - github-pull-request:
           trigger-phrase: '^recheck$'
           only-trigger-phrase: false
-          status-context: 'JJB Verify'
+          status-context: 'Tox Verify'
           permit-all: true
           github-hooks: true
-          auto-close-on-fail: false
+          included-regions: '{obj:github_included_regions}'