Creating a new report

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.

When creating a report, you should consider the type of data you want to explore and how you can filter that data set to refine it. Ask yourself these questions when creating a report:

  • What is the problem you want to explore?

  • What data can you use for the report? Do you want to explore problems with pull requests, failing builds, or something else?

  • Where would that data originate: Jenkins, Jira, GitHub, or some place else?

These questions can help identify the basic structure of your report: the data you need to query to build a report to answer your questions.

Creating a report

When you create a report, start by selecting a data type from the Data type field on the report editor. This selection determines the data source, such as Jenkins or GitHub. As you type, data types matching your input display below the field. You can also scroll this list to find the data type best suited to the report you want to create.

Refer to the report editor section for explanation about the editor’s features and capabilities.

To create a new report:

  1. From Products, select Reports.

  2. Select Create report.

  3. Enter a report name in the first text box.

  4. Select a data type from the Data type drop-down.

  5. Enter criteria in Criteria, the large text box under the Data type field. For example, to select all open pull requests with no reviews and no assigned reviewers, after selecting githubPullRequests in the Data type field, you can use:

    state ='OPEN' and pullRequestReviews.size() = 0 and reviewRequests.size() = 0
    Refer to SDM query language for information about building queries.
  6. Once the criteria query data is retrieved, basic report columns are auto-populated. Select the + to add additional columns or select the pencil icon to edit a column.

    Refer to Using columns and grouping section for instructions on how to use columns for grouping and additional math functions like average, count, minimum, maximum, truncate, and more.
  7. Select Save report.

Example report

Let’s say that you want to determine which open GitHub pull requests created within the last two days do not have a review. To build the report, you would start with the githutPullRequests data type and enter the following in the Criteria field:

state = 'OPEN' and createdAt < now('-2 day') and pullRequestReviews.size() = 0
Refer to SDM query language for information about building queries.

Once the criteria is entered, the report automatically generates four columns for repository, pull request number, title, and author. You can also use the + to add columns and data selection to the tabular report.

The final report looks like this:

View of open PRs without reviewers report

Using columns and grouping

You can use grouping by editing a column.

All group functions are always followed by a period (.) and a filter: by.author.login. The available types are automatically populated based upon the report’s data type and the content of the data. The filter author.login can use count but not sum because no numeric values are available.

Refer to Report editor section for details on available features and math functions.

To use grouping:

  1. Select Reports.

  2. Select the report you wish to modify.

  3. Select the pencil icon next to the column to edit.

  4. Select Group on the Edit column dialog.

  5. Enter the selector you wish to use, such as by followed by a period (.).

  6. Enter the type you wish to use or select one from the list.

  7. Select Save.

Example report using groups in columns

Let’s say that you want to build a report that shows the total build count and failures over the past 30 days for a specific product. You would start this report by selecting a data type and entering criteria:

  • Data type: builds

  • Criteria: job.products.any(name="Great Stuff") and startedAt > now('-30 days')

Using the builds data type selects any data that is classified as a build, such as Jenkins build jobs. The query entered in Criteria lists any jobs associated with a product with the name "Great Stuff" and that were run within the last 30 days.

Next, let’s say you want to list job names, total build count for each job, and the total number of failures. You can use Group for each of these columns to group the data and then count and filter based upon criteria you select. These

Column title Group or Field Filter Results

Job

Group

by.job.displayName

Lists the job names

Total build name

Group

count

Counts the number of builds for each job

Total failures

Group

count.filter(result = 'FAILURE')

Counts the number of failures for the builds for each job

Additional information

For additional information, refer to:

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