This article was originally published in 2017.02.15
IBM UrbanCode Deploy (now IBM DevOps Deploy) offers a source configuration and an automation plug-in for downloading artifacts from JFrog Artifactory into IBM UrbanCode Deploy. The plug-ins are compatible with Artifactory versions 3.0 and higher. For help installing plug-ins, see Installing plug-ins in IBM UrbanCode Deploy. See the appropriate instructions for the integration that you are using: source or configuration plugins.
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, use the Maven Source Config plug-in and for NuGet type package, use the stand-alone NuGet Source Config plug-in. For importing from Docker type repositories in Artifactory, use the Docker Source Config plug-in, and offer a documentation page on Docker-Artifactory configuration. 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
Importing Snapshots with the Artifactory Source Configuration plug-in is not recommended. When imported, all files within the Snapshot are imported with the Artifactory Snapshot name as the UrbanCode Deploy Version Name, such as 3.8-SNAPSHOT
. Because of this, snapshots can only be imported into UrbanCode Deploy one time. Successive imports fail to create a new version with the following message even if the containing files change.
UrbanCode Deploy already contains version
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, 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 the commons-web-util
artifact in Artifactory. It has one version in Artifactory titled 801714. If multiple versions exist for the artifact, they are imported into UrbanCode Deploy as separate component versions. To import this version, we set the following configuration in the Component.
Artifactory repository showing Repo, Group ID, Artifact ID, Version, and Contents
Example component configuration using the Artifactory plug-in
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 is 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 detects 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 Urban Code Deploy Version properties. File Extension specifies which extensions to included during import. The following shows our version after it is imported into UrbanCode Deploy and the artifacts copied to codestation.
Example component version in UrbanCode Deploy after import
Using the Artifactory Automation plug-in
The Artifactory Automation plug-in is designed with steps to do the following:
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
file that the API uses to read 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:
maven-metadata.xml
sample-1.pom
sample-2.pom
sample-3.pom
For these version contents, only these files will be downloaded:
sample-1.pom
sample-2.pom
sample-3.pom
If the desired outcome is to only download the latest build, skip to the Download Latest Build for Snapshot step.
Configuration Example for Download version (maven) step
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.
Configuration Example for Download version (non-Maven) step[/caption]
Download NuGet package
This step downloads the specified NuGet package from Artifactory.
Configuration example for download NuGet package step
Promote Build
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 Build Number properties must specify an existing build in Artifactory, while Build Status is the new status by which to set the build.
Configuration example for the Promote Build step
Set Item Properties
Set Properties allows the user to set properties on Artifactory files and folders. The formatting for the properties field is line delimited as follows:
key=value
key2=value2
.
.
If path is set to a folder and the Recursive box is checked, the files and folders below inherit the specified properties as well.
Configuration example for the Set Item properties step
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. If the snapshot folder specified contains the following, only sample-3.pom
is downloaded. .
maven-metadata.xml
sample-1.pom
sample-2.pom
sample-3.pom
Configuration Example for Download Latest Build for Snapshot step
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:
zip
tar
tar.gz
tgz
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 downloads an archive file titled maven-example-9-buildarchive.zip
.
Configuration example for Retrieve Build Artifacts Archive step
#UrbanCodeDeploy