Collect Build Issues - Declarative Pipeline Syntax

JFrog Integrations Documentation

Content Type
Integrations
ft:sourceType
Paligo

The build-info can include the issues which were handled as part of the build. The list of issues is automatically collected by Jenkins from the git commit messages. This requires the project developers to use a consistent commit message format, which includes the issue ID and issue summary, for example:

HAP-1364 - Replace tabs with spaces

The list of issues can be then viewed in the Builds UI in Artifactory, along with a link to the issue in the issues tracking system.

The information required for collecting the issues is provided through a JSON configuration. This configuration can be provided as a file or as a JSON string.

Here's an example for issues collection configuration.

{
    'version': 1,
    'issues': {
        'trackerName': 'JIRA',
        'regexp': '(.+-[0-9]+)\\s-\\s(.+)',
        'keyGroupIndex': 1,
        'summaryGroupIndex': 2,
        'trackerUrl': 'http://my-jira.com/issues',
        'aggregate': 'true',
        'aggregationStatus': 'RELEASED'
    }
}

Configuration file properties:

Property name

Description

Version

The schema version is intended for internal use. Do not change!

trackerName

The name (type) of the issue tracking system. For example, JIRA. This property can take any value.

trackerUrl

The issue tracking URL. This value is used for constructing a direct link to the issues in the Artifactory build UI.

keyGroupIndex

The capturing group index in the regular expression used for retrieving the issue key. In the example above, setting the index to "1" retrieves HAP-1364 from this commit message:

HAP-1364 - Replace tabs with spaces

summaryGroupIndex

The capturing group index in the regular expression for retrieving the issue summary. In the example above, setting the index to "2" retrieves the sample issue from this commit message:

HAP-1364 - Replace tabs with spaces

aggregate

Set to true, if you wish all builds to include issues from previous builds.

aggregationStatus

If aggregate is set to true, this property indicates how far in time should the issues be aggregated. In the above example, issues will be aggregated from previous builds, until a build with a RELEASE status is found. Build statuses are set when a build is promoted using the jfrog rt build-promote command.

regexp

A regular expression used for matching the git commit messages. The expression should include two capturing groups - for the issue key (ID) and the issue summary. In the example above, the regular expression matches the commit messages as displayed in the following example:

HAP-1364 - Replace tabs with spaces

Here's how you set issues collection in the pipeline script.

rtCollectIssues (
    serverId: 'Artifactory-1',
    config: '''{
        "version": 1,
        "issues": {
            "trackerName": "JIRA",
            "regexp": "(.+-[0-9]+)\\s-\\s(.+)",
            "keyGroupIndex": 1,
            "summaryGroupIndex": 2,
            "trackerUrl": "http://my-jira.com/issues",
            "aggregate": "true",
            "aggregationStatus": "RELEASED"
        }
    }''',
)

In the above example, the issues config is embedded inside the rtCollectIssues closure. You also have the option of providing a file which includes the issues configuration. Here's how you do this:

rtCollectIssues (
    serverId: 'Artifactory-1',
    configPath: '/path/to/config.json'
)

If you'd like add the issues information to a specific build-info, you can also provide build name and build number as follows:

rtCollectIssues (
    serverId: 'Artifactory-1',
    configPath: '/path/to/config'
    buildName: 'my-build',
    buildNumber: '20',
    // Optional - Only if this build is associated with a project in Artifactory, set the project key as follows.
    project: 'my-project-key'
)

Note

To help you get started, we recommend using the Github Examples.