Build Integration

Table of Contents

Introduction

Assimilating Artifactory into a continuous integration build process is really straight forward - you simply treat The CI server as a regular build client and, as such, The CI server will resolve dependencies from Artifactory and deploy artifacts into a dedicated repository inside Artifactory.

The Build Integration feature of Artifactory takes this integration one big step forward, by making Artifactory and your CI server closely integrated to provide fully-reproducible builds and full visibility of deployed artifacts, used dependencies and information about build environment.

By using the Build Integration add-on you will:

  • Be able to see all the builds that published their build results to Artifactory.
  • Explore each build's modules, including published artifacts and dependencies with their scope.
  • Get the information about the original build environment.
  • Check if a specific artifact is required/a result of a build, including alerting if such an artifact
  • Manipulate all the artifacts and/or dependencies from a specific build as a single unit (move, copy, export etc.).
  • Get bidirectional links between build and artifact information inside Hudson and Artifactory pages.

Hudson and Other CI Integrations

Though the current Build Integration only supports the Hudson as the CI server, similar integrations with TeamCity and Bamboo, as well as other build technologies stacks, are currently being worked-on - stay tuned.

The difference between the open source and the commercial version of Build Integration
When using the OSS version of Artifactory, Build Integration includes the Generic BuildInfo View and the ability to traverse and view build information using Artifactory's REST APIs.
Module Artifacts and Dependencies View, Repository View of Builds and the ability to export and manipulate build items require the Artifactory Power Pack.

Setting-up Hudson

The Hudson Plug-in

To integrate with Hudson you will need to install the OSS Artifactory Hudson Plug-in from Hudson's Plug-ins Manager.
The plug-in provides:

  • Easy setup for deploying to Artifactory.
  • Enhanced deployment that transfers to Artifactory additional important build information.
  • UI integration allowing going from a Hudson build directly to Artifactory.

Installing and Configuring the Plug-in

To install the Hudson Artifactory plug-in please follow the instructions on Hudson's Plug-in Center.
The configuration involves two steps:

  1. Setting up Hudson to know your Artifactory server.
  2. Pointing a Hudson Maven build at a target local repository in Artifactory to which deploy the build results - Hudson will query Artifactory's available target repositories using Artifactory's REST API and allow you to select one.

It is recommended that you also configure Hudson to use Artifactory for dependency resolution. This is not currently part of the plug-in and is done the regular way a Maven build is configured, typically by changing the settings.xml of the user running Hudson.

Inspecting and Managing Builds

Builds and Per-Build History

After you have run a build in Hudson that deploys to Artifactory, you can immediately see the corresponding build results inside Artifactory. A new 'Builds' menu item lists all known Hudson projects that published their build results:

Each build corresponds to its Hudson project (job) counterpart and contains a build history of all runs, that reflect the build history in Hudson:

For each build item in the history you can drill down into and get more fine details about it, as explained in the next section. You can also view the build in Hudson by selecting 'Show in CI Server' and go back to Artifactory from the Hudson UI, as seen below:

To view build information users need to have a 'deployer' permission on some repository path (at minimum).

Build-level Information

Drilling-down into the single build level, each build contains tree parts of information:

  1. Visual general build information about the build and its environment.
  2. Visual views for modules with their artifacts and dependencies.
  3. Generic view of the build information in XML format.

General Build Information

This section contains general information about the build properties, including other environmental details that are otherwise lost if we want to replay the build in a later point in time (e.g. JDK used, system architecture etc.).

It is also from here, that you can save the build's artifacts and/or dependencies as a Smart Search Result, for further manipulation, as we will see later.

Build Modules

Each build publishes module(s) into Artifactory, which are seen on this view, together with the number of artifacts and dependencies which they contain:

Module Artifacts and Dependencies

If we drill even further down, we will be able to inspect each module's published artifacts and dependencies. Note that deployed artifacts are collected with their types, and dependencies contain the scope(s) that the dependencies were used in during the build. You can also go from each item to its tree view in Artifactory and view other details about it.

Generic BuildInfo View

The generic BuildInfo view displays an JSON representation of the data that is used to form the visual build information in Artifactory. This can be used by REST or for debugging and is also exposed in the basic OSS version of Artifactory. See towards the end of this chapter for more information about the BuildInfo object.

Exporting and Manipulating Build Items

From the build's general information panel, you can save the build's artifacts and/or dependencies as a Smart Search Result and then manipulate it in order to promote it to another repository, copy it or export all the items to disk to have an external distributable unit of the build with all its dependencies and artifacts.

Repository View of Builds

Artifacts inside Artifactory are also aware of their possible association to builds. When an artifact is associated with a build, either as a published artifact or as a dependency it is visible on a new Builds tab (when selecting the artifact in the tree view).
Moreover, you will also receive warnings when trying to remove from the UI, an artifact that is associated with one or more builds and which without, build reproducibility will be affected.

You can navigate directly from the Builds view to the build information in Artifactory or to the build page in Hudson:

Artifacts association with builds is kept no matter if you move or copy the artifact inside Artifactory, since this association is maintained by the artifact's checksum which remains constant, regardless of the artifact's location.

Behind the Scenes

Behind the scenes the Hudson plug-in performs two major tasks:

  1. It deploys all the artifacts in one go to Artifactory. This is done in an optimized fast way and only at the end of the build, which guarantees a more coherent deployment when building multi-module projects (the Maven's way deploys at the end of each sub-module cycle, which can result in partial deployments if the build fails in a late module).
  2. It sends a BuildInfo data object to Artifactory via REST at the end of deployment. BuildInfo is a structured JSON object that contains all the data about the build environment, artifacts and dependencies, in a standard and open way.
    Inside Artifactory, the BuildInfo object is transformed into an XML representation which is visible in the generic XML view per build.
    You can find latest BuildInfo Java-bindings artifacts here and the source here.
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Feb 19

    michel morizot says:

    hello, just to warn that the buildinfo link is broken : http://repo.jfrog.org/...
    1. Feb 23

      Yoav Landman says:

      Fixed. Thanks!

      Fixed. Thanks!


Copyright © 2009 JFrog Ltd.