IBM UrbanCode Deploy offers a Source Configuration and an Automation plug-in for downloading artifacts from JFrog Artifactory into IBM UrbanCode Deploy. The plug-ins available are compatible with Artifactory versions 3.0 and higher. For help installing plug-ins, please see Installing plug-ins in IBM UrbanCode Deploy. See the appropriate instructions for the integration that you are using:
Using the Source Configuration plug-in
The Artifactory Source Configuration plug-in is designed to download artifacts from Ivy and Gradle packages in Artifactory. The artifacts are imported and added to a Component Version in IBM UrbanCode Deploy, which can then be deployed to an environment. For importing Maven type packages, we recommend the Maven Source Config plug-in, and for NuGet type packages, we recommend the stand-alone NuGet Source Config plug-in. Depending on how you use your repositories, the Artifactory plug-in contains parameters that may be able to suit your needs for any of the above package types.
Importing Snapshots with the Artifactory Source Configuration plug-in is not recommended. When imported, all files within the Snapshot will be imported with the Artifactory Snapshot name as the UCD Version Name, such as ‘3.8-SNAPSHOT’. Because of this, snapshots can only be imported into UCD one time. Successive imports will fail to create a new version with a ‘UCD already contains version’ message, even if the containing files change. This is the intended functionality as this plug-in is not intended to import Snapshots. If the desired outcome is to import the latest build within a Snapshot from Artifactory, please use the Maven Source Config plug-in.
Example Version Import
The first step when using the Artifactory Source Configuration plug-in is to create a component based on the artifact to be imported. For this example, I’ve created a ‘Web Utility’ component for our ‘commons-web-util’ artifact in Artifactory. It has one version in Artifactory, titled ‘801714’. If multiple versions exist for the artifact, they will be imported into Deploy as separate Component Versions.
To import this version, we set the following configuration in the Component:
The ‘Copy to CodeStation’ property should be selected if our intent is to create a copy of the artifacts from Artifactory in our codestation repository. Otherwise, only metadata will be stored on the component version. To access the artifacts downloaded to codestation from a Component Process, a ‘Download Artifacts’ step should be placed prior to referencing the files in order to access them in the working directory.
If we add property values to the ‘Add Property as Status’ and ‘Add Property as Link’, the plug-in will detect if those properties exist on the Artifactory version and set their values as statuses or links on the component version. All properties from Artifactory are automatically imported as UCD Version properties. ‘File Extension’ specifies which extensions to be included in import. The following shows our version after it is imported into UrbanCode Deploy and the artifacts copied to codestation:
Using the Automation plug-in
The Artifactory Automation plug-in is designed with steps to do the following:
- Download all files under a specified version of a Maven repository
- Download all files under a specified version of a non-Maven repository
- Download a NuGet package from a NuGet repository.
- Change the status of a build, optionally moving or copying the build to a target repository.
- Set properties on an Artifactory file or folder
- Download latest build artifact within a snapshot
- Download an archive file that contains all the artifacts for a specific build.
Download version (Maven)
Download version (Maven) uses the maven-metadata.xml to find the files and versions to download. Because of the querying mechanism used, the group Id must be specified with ‘.’ delimiters instead of ‘/’s. This is reflected inside the maven-metadata.xml that the API uses to read the files. This step operates similar to the Maven Source Configuration plug-in when used with Artifactory hosted repositories. For example, if the specified version folder contains the following:
For these version contents, only these files will be downloaded:
If the desired outcome is to only download the latest build, jump ahead to Download Latest Build for Snapshot
Download version (non-Maven)
Download version (non-Maven) downloads all files contained with-in the artifact path. This step is generally designed to work for repositories with a generic folder structure. If a folder is specified, the agent will query all items beneath the folder structure and download them to the working directory. An option to ‘Download Recursively’ lets the user download subfolders and files beneath the root directory. This functionality requires Artifactory Pro.
Download NuGet package
This step downloads the specified NuGet package from Artifactory.
The Promote Build step allows you to change the status of a build, and optionally move or copy the build to a target repository. The Build Name and Number must specify an existing build in Artifactory, while Build Status is the new status by which to set the build.
Set Item Properties
Set Properties allows the user to set properties on Artifactory files and folders. The formatting for the properties field is line dimilited as follows:
and so on. If path is set to a folder and the ‘Recursive’ box is checked, the files and folders below will inherit the specified properties as well.
Download Latest Build for Snapshot
Download Latest Build for Snapshot retrieves only the latest build artifact within an Artifactory snapshot. Similar to simply downloading versions, the same parameters are input but if the snapshot folder specified contains:
sample-3.pom will be downloaded.
Retrieve Build Artifacts Archive
Retrieve Build Artifacts Archive step downloads the specified build to an archive file. The type options for the archive are given as:
The build name must be specified. Only build number or build status must be specified, and not both. When the step is run, it queries the builds in Artifactory matching these parameters and downloads them as an archive file of the type chosen. The following configuration will download an archive file titled