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. This status can be set when a build is promoted in Artifactory. |
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.
server = Artifactory.server 'my-server-id' 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" } }""" buildInfo.issues.collect(server, config) server.publishBuildInfo buildInfo
Note
To help you get started, we recommend using the Github Examples.