Using the JFrog CLI, there is a command that allows for collecting Git information from the local .git directory and adds it to the build-info. It can also collect the list of tracked project issues (for example, issues stored in JIRA or other bug tracking systems) and add them to the build-info. The issues are collected by reading the git commit messages from the local git log. Each commit message is matched against a pre-configured regular expression, which retrieves the issue ID and issue summary. This guide assumes that your JFrog CLI has already been set up.
For example, if I wanted to collect Github issues from the official JFrog chart Github repository, I would need to have a config file, lets call it issues-config. It contains the following:
Using the standard Github shorthand syntax of linking Github issues to a commit with a # and issue number, I run the following commit message:
$ git commit -m "attempt 2 to fix #1 - test issue"
This will tie issue #1 to this commit. You can see from my regexp that there are 2 groups, ([0-9]+) and (.+). This is what's captured in the following parameters, keyGroupIndex, and summaryGroupIndex. We can see my commit is "attempt 2 to fix #1 - test issue", so it will match from the '#', and adds '1' to the first group (keyGroupIndex) and "test issue" to the second group (summaryGroupIndex). You may need to play around with this regex to get the right formatting for your needs.
e.g, if you need to have the summary before the github issue, $ git commit -m "attempt 2 to fix: test issue - #1", try something like \:\s(.+)\s-\s#([0-9]+), where "test issue" is going to be group 1, and "1" will be group 2, so keyGroupIndex will be 2, and summaryGroupIndex will be 1.
Another example of Github shorthand linking is GH-1 instead of #1, $ git commit -m "attempt 2 to fix: test issue - GH-1". In that case, the regex would be: \:\s(.+)\s-\sGH-([0-9]+). Again, you'll need to set keyGroupIndex to 2, and summaryGroupIndex to 1.
Later on, the keyGroupIndex will contain a link that combines the trackerUrl to the keyGroupIndex. To put this in context of our example, "attempt 2 to fix #1 - test issue" will link "#1" to https://github.com/jfrog/charts/issues/1 in Github linking. So, in our build info, we will be combining our trackerUrl + '/' + keyGroupIndex; https://github.com/jfrog/charts/issues + '/' + 1, giving us the correct linkage. You'll need to get rid of the '#' beforehand to conform to Github's issue URL linking syntax.
Then, run your normal jfrog CLI build commands, followed by this new one:
$ jfrog rt bag <build name> <build number> --config issues-config
After you publish ($ jfrog rt bp <build name> <build number>), navigate to your issues tab, and you should see your newfound github issues. There should also be a issues section in the build-info.json that looks something like this:
"issues": {
"tracker": {
"name": "GITHUB"
},
"aggregateBuildIssues": true,
"affectedIssues": [{
"key": "1",
"url": "https://github.com/jfrog/charts/issues/1",
"summary": "test issue",
"aggregated": false
}]
}
For more information on the config file and the commands, you read about it in our wiki here, under "Collecting Information from Git":
https://www.jfrog.com/confluence/display/CLI/CLI+for+JFrog+Artifactory#CLIforJFrogArtifactory-CollectingBuildInformation
For example, if I wanted to collect Github issues from the official JFrog chart Github repository, I would need to have a config file, lets call it issues-config. It contains the following:
version: 1
issues:
serverID: art
trackerName: GITHUB
regexp: \#([0-9]+)\s-\s(.+)
keyGroupIndex: 1
summaryGroupIndex: 2
trackerUrl: https://github.com/jfrog/charts/issues
aggregate: true
issues:
serverID: art
trackerName: GITHUB
regexp: \#([0-9]+)\s-\s(.+)
keyGroupIndex: 1
summaryGroupIndex: 2
trackerUrl: https://github.com/jfrog/charts/issues
aggregate: true
Using the standard Github shorthand syntax of linking Github issues to a commit with a # and issue number, I run the following commit message:
$ git commit -m "attempt 2 to fix #1 - test issue"
This will tie issue #1 to this commit. You can see from my regexp that there are 2 groups, ([0-9]+) and (.+). This is what's captured in the following parameters, keyGroupIndex, and summaryGroupIndex. We can see my commit is "attempt 2 to fix #1 - test issue", so it will match from the '#', and adds '1' to the first group (keyGroupIndex) and "test issue" to the second group (summaryGroupIndex). You may need to play around with this regex to get the right formatting for your needs.
e.g, if you need to have the summary before the github issue, $ git commit -m "attempt 2 to fix: test issue - #1", try something like \:\s(.+)\s-\s#([0-9]+), where "test issue" is going to be group 1, and "1" will be group 2, so keyGroupIndex will be 2, and summaryGroupIndex will be 1.
Another example of Github shorthand linking is GH-1 instead of #1, $ git commit -m "attempt 2 to fix: test issue - GH-1". In that case, the regex would be: \:\s(.+)\s-\sGH-([0-9]+). Again, you'll need to set keyGroupIndex to 2, and summaryGroupIndex to 1.
Later on, the keyGroupIndex will contain a link that combines the trackerUrl to the keyGroupIndex. To put this in context of our example, "attempt 2 to fix #1 - test issue" will link "#1" to https://github.com/jfrog/charts/issues/1 in Github linking. So, in our build info, we will be combining our trackerUrl + '/' + keyGroupIndex; https://github.com/jfrog/charts/issues + '/' + 1, giving us the correct linkage. You'll need to get rid of the '#' beforehand to conform to Github's issue URL linking syntax.
Then, run your normal jfrog CLI build commands, followed by this new one:
$ jfrog rt bag <build name> <build number> --config issues-config
After you publish ($ jfrog rt bp <build name> <build number>), navigate to your issues tab, and you should see your newfound github issues. There should also be a issues section in the build-info.json that looks something like this:
"issues": {
"tracker": {
"name": "GITHUB"
},
"aggregateBuildIssues": true,
"affectedIssues": [{
"key": "1",
"url": "https://github.com/jfrog/charts/issues/1",
"summary": "test issue",
"aggregated": false
}]
}
For more information on the config file and the commands, you read about it in our wiki here, under "Collecting Information from Git":
https://www.jfrog.com/confluence/display/CLI/CLI+for+JFrog+Artifactory#CLIforJFrogArtifactory-CollectingBuildInformation