Usage

To use jenkins-job-builder-addons in a project:

import jenkins_jobs_addons

Folders

The Folder plugin handles creating CloudBeesFolder Jenkins Jobs. You man specify folder in the project-type attribute of the Job definition.

Requires the Jenkins CloudBees Folder Plugin.

arg str primary-view:
 

Name of the default view to show for this folder.

arg list health-metrics:
 

A list of metrics to use as a health check. Must be one of the following:

  • worst-child-health-metric

Job example:

name: folder_test
project-type: folder
primary-view: "Test Primary View"
health-metrics:
  - worst-child-health-metric
class jenkins_jobs_addons.folders.Folder(registry)[source]

Bases: jenkins_jobs.modules.base.Base

Class built off Base

root_xml(data)[source]

Called after data is parsed. Returns xml representing a job :arg dict data: the YAML data structure

sequence = 0

Views

Views show job status.

Component: views
Macro:views
Entry Point:jenkins_jobs.views
class jenkins_jobs_addons.views.Views(registry)[source]

Bases: jenkins_jobs.modules.base.Base

component_list_type = 'views'
component_type = 'view'
gen_xml(parser, xml_parent, data)[source]
sequence = 20
jenkins_jobs_addons.views.all_view(parser, xml_parent, data)[source]

All view

Parameters:
  • filter-executors (bool) – only those build executors will be shown that could execute the jobs in this view.
  • filter-queue (bool) – only jobs in this view will be shown in the queue.
  • folder (bool) – Wether or not this view is in a folder.

Example:

views:
  - all:
      filter-executors: false
      filter-queue: false
jenkins_jobs_addons.views.build_pipeline_view(parser, xml_parent, data)[source]

Build Pipeline View requires the Jenkins Build Pipeline Plugin.

Parameters:
  • filter-executors (bool) – only those build executors will be shown that could execute the jobs in this view.
  • filter-queue (bool) – only jobs in this view will be shown in the queue.
  • folder (bool) – Wether or not this view is in a folder.
  • name (str) – The name of this view.
  • first-job (str) – Select the initial or parent Job in the build pipeline view.
  • display-number-of-builds (int) – Select the number of build pipelines to display in the view.
  • build-view-title (str) – The title of this view.
  • console-output-link-style (str) –

    One the following:

    • This Window
    • New Window
    • Light Box (default)
  • trigger-only-latest-job (bool) –

    Select this option to restrict the display of a Trigger button to only the most recent successful build pipelines. This option will also limit retries to just unsuccessful builds of the most recent build pipelines.

    • True: Only the most recent successful builds displayed on the
      view will have a manual trigger button for the next build in the pipeline.
    • False: All successful builds displayed on the view will have a
      manual trigger button for the next build in the pipeline.
  • always-allow-manual-trigger (bool) – Select this option if you want to be able to execute again a successful pipeline step. If the build is parameterized, this will re-execute the step using the same parameter values that were used when it was previously executed.
  • start-with-parameters (bool) – Select this option if you want to show the pipeline definition header in the pipeline view. If this option is not selected, then a pipeline that has never been run will not show any details about its jobs and appear like a blank form. Job details will only appear after the pipeline has been run at least once.
  • show-pipeline-parameters-in-header (bool) – Select this option if you want to display the parameters used to run the latest successful job in the pipeline’s project headers.
  • show-pipeline-parameters (bool) – Select this option if you want to display the parameters used to run the first job in each pipeline’s revision box.
  • refresh-frequency (bool) – Frequency at which the Build Pipeline Plugin updates the build cards in seconds
  • css-url (str) – Link to override style sheet

Example:

views:
  - build_pipeline:
      filter-executors: false
      filter-queue: false
      folder: true
      first-job: testjob
      name: testbuild 
      build-view-title: "Test Build Pipeline"
      display-number-of-builds: 10
      console-output-link-style: "Light Box"
      csss-url: ""
      trigger-only-latest-job: false
      always-allow-manual-trigger: false
      show-pipeline-parameters: false
      show-pipeline-parameters-in-header: false
      start-with-parameters: false
      refresh-frequency: 3
      show-pipeline-definition-in-headers: false
jenkins_jobs_addons.views.delivery_pipeline_view(parser, xml_parent, data)[source]

Delivery Pipeline View requires the Jenkins Delivery Pipeline Plugin.

Parameters:
  • filter-executors (bool) – only those build executors will be shown that could execute the jobs in this view.
  • filter-queue (bool) – only jobs in this view will be shown in the queue.
  • folder (bool) – Wether or not this view is in a folder.
  • name (str) – The name of this view.
  • components (dict) –

    The components (jobs) for this pipeline:

    • name (str): Name of the pipeline, usually the name of the
      component or product.
    • first-job (str): First job in the pipeline. Usually the
      build/compile job. The build number/build display name will be used as the version in later tasks or stages. If using folders, it should be a full path to the job.
  • number-of-pipelines (int) – Number of pipelines instances shown for each pipeline.
  • show-aggregated-pipeline (bool) – Show an aggregated view where each stage shows the latest version being executed.
  • number-of-columns (int) – Number of columns used for showing pipelines. Useful for multiple components in the view to show them beside each others.
  • sorting (int) – How to sort the pipeline in the view. Only applicable for several pipelines. Can be sorted by latest activity or by name.
  • update-interval (int) – How often will the view be updated in seconds.
  • allow-pipeline-start (bool) – Start a new pipeline build.
  • allow-manual-triggers (bool) – If a task is manual (Build other projects (manual step) from Build Pipeline Plugin, show a button.
  • allow-rebuild (bool) – Rebuild a task.
  • show-avatars (str) – Show avatars pictures instead of names of the people involved in a pipeline instance. Use the Avatar Plugin or the Gravatar Plugin. or similar to set avatar picture for contributors.
  • show-changes (bool) – Show SCM change log for the first job in the pipeline. If Repository browser is configured, link to change will be created to the repository browser.
  • show-description (bool) – Show build description connected to a task.
  • show-promotions (bool) – Show promotions from the Promoted Builds Plugin. <https://wiki.jenkins-ci.org/display/JENKINS/Promoted+Builds+Plugin>_
  • show-total-buildtime (bool) – Show total build time of a pipeline. If there are multiple routes in a pipeline, total build time is calculated as the sum of the build times in the longest route.
  • css-url (str) – Possibility to override CSS for the normal view. Enter the full url to the custom CSS.
  • fullscreen-css-url (str) – Possibility to override CSS for the fullscreen view. Enter the full url to the custom CSS.
  • regexp-first-jobs (list) – Find jenkins job matching regular expression. ^build-(.+?)-project

Example:

views:
  - delivery_pipeline:
      filter-executors: false
      filter-queue: false
      folder: true
      components:
        - name: Build
          first-job: testjob
      name: testbuild 
      build-view-title: "Test Build Pipeline"
      number-of-pipelines: 3
      show-aggregated-pipeline: false
      number-of-columns: 1
      sorting: none
      show-avatars: false
      update-interval: 1
      show-changes: false
      allow-manual-triggers: false
      show-total-buildtime: false
      allow-rebuild: false
      allow-pipeline-start: false
      show-description: false
      show-promotions: false