Artifactory has always helped you to know what’s in your builds. But it can still be hard to know why a build was made.
An exciting feature in the JFrog CLI can help you connect the way you track issues (bugs and feature requests) directly to the builds where they’ve been addressed. So you can know at the click of a mouse why any binary managed by Artifactory was made, and what it has in it.
The best part is, Artifactory’s power is enabled through the tools and workflows you already use, like Git and Atlassian Jira. If your team has sound habits, you can experience the benefits right away.
Users of JFrog’s Artifactory plugin for Jenkins have benefited from this feature for awhile when enabling the plugin’s Jira integration. But if you’re using the JFrog CLI to drive your builds another way, here’s how you can put the feature to work right now.
Managing Builds Better
Artifactory is the preferred binary repository manager for DevOps because it provides insight into your builds. By collecting information about what dependencies were used, what environment settings, and what artifacts were included, Artifactory makes every build you produce fully traceable. You know exactly what’s in every build.
But builds are made because the code in them changed to fix a bug or add a new feature. And those reasons for change are likely found elsewhere, through an issue-tracking system like Jira. Developers who follow best practice tag their source code checkins with the issue ticket(s) their changes resolve.
A powerful JFrog CLI command enables you to collect that issue data from your Git checkins into your build information in Artifactory. Now Artifactory can know every issue that was resolved in a build, list them in the dashboard, and seamlessly provide a link for each to the ticket in your issue-tracker (e.g., Jira).
Here’s how the Artifactory dashboard for build information can look when you’re done, in the Issues tab:
Clicking on any issue (for example, SAM-3) opens the issue tracker (Jira) with the referenced issue ticket:
What You Need
To get started, you’ll have to have a licensed installation of Artifactory. If you don’t have one, you can get a free trial.
JFrog CLI Adept
You’ll need to be acquainted with the JFrog CLI for Artifactory and comfortable using its commands in your CI server scripts to collect and publish build information.
Commit to Good Habits
This powerful new feature relies on the common developer practice when working from an issue ticket to include the ticket information as a message in the commit of the file that fixes the issue.
For example, for a Jira issue with the ticket ID HAP-1007, you might execute the following git command:
$ git commit -m “HAP-1007 - This is a sample issue” [master 69a3146] HAP-1007 - This is a sample issue 1 file changed, 12 insertions(+)
This is a commonly used format. What’s important is that the developers at your organization all follow the same practice and use the same format for issue messages.
What You Do
Create a configuration file
To help the JFrog CLI command work, you’ll need to create a configuration file that specifies the information it needs about your Artifactory server, your commit messages and your issue-tracker.
For example, to work with Jira, you might create a file called jira-cli.conf:
We’ll identify and discuss the most important properties:
The trackerName property is any arbitrary string of your choosing that identifies the issue tracking system you use. Since we are using Jira in this demonstration, we call it “JIRA”.
The regexp property specifies the regular expression format that Artifactory will look for to recognize an issue messages in Git. Here, the regexp property is set so Artifactory expects the Git message format we decided to use for Jira issues:
HAP-1007 – This is a sample issue
When you execute the build-add-git command, all Git messages that match this format will be added to the build-info for build you are about to publish.
If you use a different format in your organization, you must specify a matching regexp property.
The trackerURL is the base URL for your issue-tracking system. Artifactory uses this to construct a hyperlink to the issue when it displays the build information in your dashboard.
The aggregate and aggregationStatus properties tell Artifactory whether to include issues from previous builds in the current build-info, and how far back to do so. Here, the build-info will include all issues from previous builds since the last build promoted to RELEASED status.
When you create your build, you’ll use the JFrog CLI commands for collecting build information, just as you are accustomed to doing. This will typically include uploading your build artifacts to a repository with a new build number, and adding environment variables.
To add the tracked issues to the build information, you’ll use the build-add-git (bag) command. In addition to adding the Git revision and URL from the local .git directory, it will add the commit-time messages that match the regexp property you specified in the configuration file.
For example, for the 3rd build of my-sample-build:
What You Get
Once you complete your build, all of the issues you identified in your Git checkins are available in the build information you publish to Artifactory.
You’ve seen above how this information is displayed in the Issues tab in the Artifactory dashboard. Artifactory displays this from the JSON file of build information, which you can also view from the dashboard, in the Build info JSON tab:
Note that the url property in this example is the link to the issue ticket in Jira, which was automatically constructed from the trackerURL property in the jira-cli.conf configuration file.
A Clear View
The build-add-git command is part of the current JFrog CLI, so you can try using it right away.
It’s all part of JFrog’s mission to speed the path to Liquid Software and continuous updates. Artifactory provides traceability of your builds, so that you not only know where the binaries in them came from, but what they mean to you as well.