Add triggers to jenkins-cfg job 83/8883/1
authorThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 16 Feb 2018 19:55:55 +0000 (14:55 -0500)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 16 Feb 2018 19:55:57 +0000 (14:55 -0500)
Allows the job to run on a timed trigger as well as on patch
merged events. Default timed trigger is run @daily.

Change-Id: I54b04e7814718816fe221a33d80aa1c1574095d7
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
docs/jjb/lf-ci-jobs.rst
jjb/lf-ci-jobs.yaml

index af5ad74..19de22d 100644 (file)
@@ -143,6 +143,8 @@ The format for this file is ``KEY=value`` for example::
 
 :Optional parameters:
 
+    :branch: Git branch to build against. (default: master)
+    :cron: How often to run the job on a cron schedule. (default: @daily)
     :git-url: URL to clone project from. (default: $GIT_URL/$GERRIT_PROJECT)
     :jenkins-silos: Space separated list of Jenkins silos to update
         configuration for as defined in ~/.config/jenkins_jobs/jenkins_jobs.ini
index 8e3d4d9..558d385 100644 (file)
     ######################
 
     branch: master
+    cron: '@daily'
     git-url: '$GIT_URL/$GERRIT_PROJECT'
     jenkins-silos: production sandbox
 
+    gerrit_merge_triggers:
+      - change-merged-event
+      - comment-added-contains-event:
+          comment-contains-value: remerge$
+
+    gerrit_trigger_file_paths:
+      - compare-type: ANT
+        pattern: 'jenkins-config/**'
+
     #####################
     # Job Configuration #
     #####################
           choosing-strategy: default
           jenkins-ssh-credential: '{jenkins-ssh-credential}'
 
+    triggers:
+      - timed: '{obj:cron}'
+      - gerrit:
+          server-name: '{gerrit-server-name}'
+          trigger-on: '{obj:gerrit_merge_triggers}'
+          projects:
+            - project-compare-type: ANT
+              project-pattern: '{project}'
+              branches:
+                - branch-compare-type: ANT
+                  branch-pattern: '**/{branch}'
+              file-paths: '{obj:gerrit_trigger_file_paths}'
+
 - job-template:
     name: '{project-name}-jenkins-cfg-merge'
     id: github-jenkins-cfg-merge
           choosing-strategy: default
           jenkins-ssh-credential: '{jenkins-ssh-credential}'
 
+    triggers:
+      - timed: '{obj:cron}'
+      - github
+      - pollscm:
+          cron: ''
+      - lf-infra-github-pr-trigger:
+          trigger-phrase: '^remerge$'
+          only-trigger-phrase: true
+          status-context: 'Jenkins CFG 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}'
+
 
 ##################
 # JJB DEPLOY JOB #