About the report editor

CloudBees SDM is a preview, with early access for select preview members. Product features and documentation are frequently updated. If you find an issue or have a suggestion, please contact CloudBees Support. Learn more about the preview program.

The report editor has these fields:

Report name

The title of your report.

Data type

Determines the type of data the report will return and depends upon the services integrated with CloudBees SDM.

Report criteria

Filters the data to be returned.

Fields

Builds the actual tabular report from the data defined in the data type and criteria.

Examples and Schema browser

The Code samples section to the right of the report editor provides Examples and a Schema database search.

You can use any of the reports listed on Examples as a starting point for your own reports. For more information, refer to Example reports.

The Schema browser provides a searchable list of available data types. You can use these data types and fields to populate the Criteria field in the report editor.

Data types

You can use one of the data types present in CloudBees SDM and contained in the System of Record to query data for a report or a policy. The data type you select is based upon the data source you wish to use, such as Jenkins, Jira, GitHub, and others.

Each query can only return one data type and its associations, but it’s possible to query across many different types to help refine your selection.

Refer to the data types reference section for detailed information.

Refer to SDM query language for information about building queries.

Criteria

The Criteria field allows data selection criteria to be specified based on the data type selected, including easily accessing and associating to related data using path expressions like author.login. The . lets you traverse the hierarchy. For example, the author field of the githubPullRequest data type is a complex object with a login sub-field that corresponds to the author’s username. If you wanted to select the author based on username, you could use author.login = 'username'.

As an example, if GitHub is integrated, the GithubPullRequest data type can be selected. A criteria filter of state = 'OPEN' could be specified so that the report is only evaluated for open pull requests. An additional criteria of mergeStateStatus = 'DIRTY' would then cause the report to evaluate to true for open pull requests that have a merge status of DIRTY. The report would evaluate to false for all other open pull requests, and these results would not be listed in the tabular report.

You can use the Schema tab to search for specific data types and list all fields associated with a data type.

Refer to SDM query language for information about building queries and Example reports for real-world reports.

Columns

In some reports, you may want more then a simple list in your report. You may want to know the average build time for the past 30 days for a specific product and then be able to count the number of successes and failures.

Using report criteria, you can filter for builds using the builds data type. You can then use the columns in the report to further refine your report.

By default, adding a column to a report displays a simple list of the selected field from the report’s data type. However, you can extend this function by using Group in the Edit column dialog. This dialog provides two options: Field and Group.

  • Field provides an unmodified list: whatever data matches the entry is displayed. This is the default selection when a new column is added.

  • Group can collect entries by a particular entry, count entries, or, for numeric values, can perform basic functions like average, minimum, maximum, and sum.

Instructions for using the Edit column dialog are available in the Creating reports section.

Group data in columns

For all values, grouping lets you group by particular filter, all pull request authors names for example, or count all values that match a filter. If the datatype contains numeric fields, the average, minimum, maximum, and sum fields can be used to retrieve the aggregate values for those fields.

Column order does not matter when you use a group in a column. You can have a group in more then one column but only one group per column. When you use group on a column, it changes the data available in other columns. If a group adds a filter for by.author.login, but other columns are not related to that selection, then the data in those columns is no longer visible.

Group function Use Availability Example column filter

by

Groups like results based upon filter matches

For all values

by.job.displayName

count

Counts the number of results that match the filter

For all values

count.filter(result = 'FAILURE')

average

Takes the average of results matching the filter

For numeric values

average.duration

minimum

Reports the lowest value of the filter

For numeric values

minimum.duration

maximum

Reports the highest value of the results matching the filter

For numeric values

maximum.duration

sum

Adds the results of the numbers matching the filter

For numeric values

sum.changedFiles

Using average calculates the average of the selected numeric set, for example, average.duration calculates the mean duration of successful builds.

Functions available in columns

In addition to using groups in columns, you can use the functions below to transform the data from a field in a report column. These functions let you display data in a more human-readable format, round dates down, and perform basic math functions within a column.

Function Use Availability Example column filter

.moment()

Displays a human-readable format such as 2 days ago when used with empty parentheses (()). You can also use .moment(<format>) using year (YYYY), month (MM), and day (DD) to display a formatted DateTime field.

For DateTime fields

startedAt.moment(YYYY-MM-DD) or startedAt.moment()

truncate

Rounds down a date-time field to the lowest closest value for DAY, WEEK, MONTH, and YEAR.

For DateTime fields

by.startedAt.truncate(DAY)

filter

Filter refines a data set based upon a filter method, such as count. For example, you can use a filter to display a count of failed builds.

Anything that operates on a set of data.

count.filter(result = 'FAILURE')

numeral

Provides a way to format output in a numeric field.

For numeric fields, integer (int) and float.

average.duration.numeral(0.00)

Math functions

Basic math functions: addition (+), subtraction (-), division (/), multiplication (*).

Any numeric field

count.filter(result=`SUCCESS’)*100/count

Example report

Let’s say that you want to determine which open GitHub pull requests do not have a reviewer assigned. To build the report, you would start with the githutPullRequests data type (2) and enter the following in the Criteria field (3):

state ='OPEN' and pullRequestReviews.size() = 0 and reviewRequests.size() = 0
Refer to SDM query language for information about building queries.

Once the criteria is entered, Fields (4) add columns and data selection to generate the tabular report. The first column in determines the column, with the first text box determining the field heading and the second the entries that appear in the column. Each additional field adds another column to the report. In this example, there are three fields (4).

Title Path Sort

Title

title

Ascending

PR URL

url

(optional)

PR owner

author.login

Additional information

For additional information, refer to:

For information about specific data types, refer to the Queryable types section.