Triggers

Triggers define what causes a jenkins job to start buliding.

Component: triggers
Macro:trigger
Entry Point:jenkins_jobs.triggers

Example:

job:
  name: test_job

  triggers:
    - timed: '@daily'
gerrit

Trigger on a Gerrit event. Requires the Jenkins Gerrit Trigger Plugin version >= 2.6.0.

Parameters:
  • trigger-on-patchset-uploaded-event (bool) – Trigger on patchset upload
  • trigger-on-change-abandoned-event (bool) – Trigger on change abandoned. Requires Gerrit Trigger Plugin version >= 2.8.0
  • trigger-on-change-merged-event (bool) – Trigger on change merged
  • trigger-on-change-restored-event (bool) – Trigger on change restored. Requires Gerrit Trigger Plugin version >= 2.8.0
  • trigger-on-comment-added-event (bool) – Trigger on comment added
  • trigger-on-draft-published-event (bool) – Trigger on draft published event
  • trigger-on-ref-updated-event (bool) – Trigger on ref-updated
  • trigger-approval-category (str) – Approval category for comment added
  • trigger-approval-value (int) – Approval value for comment added
  • override-votes (bool) – Override default vote values
  • gerrit-build-successful-verified-value (int) – Successful ‘’Verified’’ value
  • gerrit-build-failed-verified-value (int) – Failed ‘’Verified’’ value
  • failure-message (str) – Message to leave on failure
  • projects (list) –

    list of projects to match

    Project:
    • project-compare-type (str) – ‘’PLAIN’‘, ‘’ANT’’ or ‘’REG_EXP’‘
    • project-pattern (str) – Project name pattern to match
    • branch-compare-type (str) – ‘’PLAIN’‘, ‘’ANT’’ or ‘’REG_EXP’‘
    • branch-pattern (str) – Branch name pattern to match
    • file-paths (list) – List of file paths to match (optional)
      File Path:
      • compare-type (str) – ‘’PLAIN’‘, ‘’ANT’’ or ‘’REG_EXP’’ (optional, defaults to ‘’PLAIN’‘)
      • pattern (str) – File path pattern to match
  • skip-vote (dict) –

    map of build outcomes for which Jenkins must skip vote. Requires Gerrit Trigger Plugin version >= 2.7.0

    Outcome:
    • successful (bool)
    • failed (bool)
    • unstable (bool)
    • notbuilt (bool)

You may select one or more gerrit events upon which to trigger. You must also supply at least one project and branch, optionally more. If you select the comment-added trigger, you should alse indicate which approval category and value you want to trigger the job.

Until version 0.4.0 of Jenkins Job Builder, camelCase keys were used to configure Gerrit Trigger Plugin, instead of hyphenated-keys. While still supported, camedCase keys are deprecated and should not be used.

Example:

triggers:
  - gerrit:
      trigger-on-comment-added-event: true
      trigger-approval-category: 'APRV'
      trigger-approval-value: 1
      projects:
        - project-compare-type: 'PLAIN'
          project-pattern: 'test-project'
          branch-compare-type: 'ANT'
          branch-pattern: '**'
          file-paths:
              - compare-type: ANT
                pattern: subdirectory/**
      skip-vote:
          successful: true
          failed: true
          unstable: true
          notbuilt: true
github

Trigger a job when github repository is pushed to Requires the Jenkins GitHub Plugin.

Example:

triggers:
  - github
github-pull-request

Build pull requests in github and report results Requires the Jenkins GitHub Pull Request Builder Plugin.

Parameters:
  • admin-list (list) – the users with admin rights (optional)
  • cron (string) – cron syntax of when to run (optional)
  • white-list (list) – users whose pull requests build (optional)
  • org-list (list) – orgs whose users should be white listed (optional)

Example:

triggers:
  - github-pull-request:
      admin-list:
        - user1
        - user2
      cron: * * * * *
      white-list:
        - user3
        - user4
      org-list:
        - org1
        - org2
pollscm

Poll the SCM to determine if there has been a change.

Parameter :the polling interval (cron syntax)

Example:

triggers:
  - pollscm: "\*/15 * * * \*"
timed

Trigger builds at certain times.

Parameter :when to run the job (cron syntax)

Example:

triggers:
  - timed: "@midnight"

Previous topic

SCM

Next topic

Wrappers

This Page