Skip to end of metadata
Go to start of metadata

Overview

Artifactory brings continuous integration to Azure DevOps and Team Foundation Server (TFS) through the JFrog Artifactory Extension. 

 The JFrog Artifactory extension for Azure DevOps supports:

  • Resolving your build dependencies from Artifactory. 
  • Deploying your build artifacts to Artifactory. 
  • Gaining full traceability of your builds by capturing your build-info from your builds and publishing to Artifactory.

Source Code

The extension is an open-source project on GitHub which you can freely browse and fork.


Installation and Setup

Installing the Extension

The Artifactory extension for Azure DevOps is available in the Visual Studio Marketplace.

To install the Artifactory extension, execute the following steps:

  1. Go to the Visual Studio Marketplace and sign in to your account.
  2. Select the JFrog Artifactory extension located in the Build and Release section.
  3. In the Artifactory Extension page, click Install.
  4. Select the account to which you want to apply the extension and confirm installation.

Installing the Build Agent

To run the Artifactory tasks, the build agents use three tools: 

  • JFrog CLI: Runs all the Artifactory tasks.
  • Maven Extractor: Runs the Artifactory Maven task.
  • Conan client:  Runs the Artifactory Conan task.

Running Artifactory Conan tasks

The Artifactory Conan tasks uses the conan client. The conan client cannot be installed using the Automatic Installation or the Artifactory Tools Installer but is required to be manullay installed. To install conan on an agent, read the Install Conan section.

The tools can be installed on the build agents using one of the following methods.

Page Contents

Automatic Installation

If the build agent has access to the internet, JFrog CLI and the Maven Extractor are downloaded and installed automatically on the agent the first time they are required.

Artifactory Tools Installer

If your agent has no internet access, you can configure the pipeline to download JFrog CLI and the Maven Extractor from an Artifactory instance, which is configured to proxy Bintray. 

  1. Create two remote repositories in Artifactory:
    1. A repository for downloading JFrog CLI.
      Set the URL of the JFrog CLI repository to https://jfrog.bintray.com/jfrog-cli-go/ 
    2. A repository for downloadinbg the Maven Extractor.
      Set the URL of the Maven Extractor repository to: http://jcenter.bintray.com
    In the following examples, the JFrog CLI repository is set as  jfrog-cli and Maven Extractor repository is  jcenter. You can rename the two repositories to meet your needs.
  2. Make sure to configure the Artifactory server with the jfrog-cli and jcenter repositories in Azure DevOps, as described in the Configuring the Artifactory Service Endpoint section.
  3. Add the Artifactory Tools Installer task to your build or release pipeline.
  4. Select the Artifactory service you configured.
  5. Select jfrog-cli as the target repository to download the JFrog CLI .
    If your pipeline uses the Artifactory Maven task, select jcenter as the repository to download the Maven Extractor.


Manual Installation 

Installing JFrog CLI

The extension runs JFrog CLI in the background to run many of its operations. The extension automatically downloads and installs the JFrog CLI on the build agent the first time it's required. However, if your build agent does not have access to the internet, the build will fail when attempting to download JFrog CLI and you'll need to download and install it manually.

To install JFrog CLI on an agent with no internet access:

  1. Create the directory structure on your agent's file-system: <agent_dir>/<agent_work_dir>/_jfrog/current/.
  2. Download the latest JFrog CLI version from Bintray. Please make sure to download the executable matching your agent's operating system.
  3. Copy the downloaded JFrog executable to the "current" directory you created.
Installing the Maven Extractor 

When triggering the Artifactory Maven task, JFrog CLI automatically downloads the Maven Extractor jar to the build agent the first time it's required. However, if your build agent does not have access to the internet, the build will fail when attempting to download the file. You'll therefore need to download and install it manually.

To install the Maven Extractor jar on an agent with no internet access:

  1. Create the directory structure on your agent's file-system: <agent_dir>/<agent_work_dir>/_jfrog/.jfrog/dependencies/maven.
  2. Download the build-info-extractor-maven3-2.11.1-uber.jar and place it inside the "maven" directory you created.
Installing Conan

For the build agent to be able to run conan builds, do the following:

  1. Access the agent and install conan by following these steps.
  2. Confirm that the conan executable is available in the Path environment variable of the user which runs the build on the agent.

Using TFS 2015

Prerequisites

Node.JS version 8 and above

The build agent requires using Node.JS version 8 and above. To check which version of Node.JS is running on the build agent:

  1. Navigate to the Worker\Handlers\Node folder located under theAgent home.
  2. From the terminal, run node -v.


To upgrade Node.JS on the build agent:

  • Replace the existing node.exe file on the agent with the node.exe file with the required version located in the Worker\Handlers\Node folder under the agent home.

Configuring the Artifactory Service Endpoint

To allow your builds to work with Artifactory, you'll need to configure your Artifactory instance as a Service endpoint.

  1. Access your Azure DevOps project and click Project Settings > CI/CD > Service endpoints > New service connection and select Artifactory.
  2. Configure the details of the Artifactory instance.

Failing to access Artifactory

Make sure that the URL of the Artifactory instance does not end with a slash.
Still cannot access Artifactory?


For security reasons, Artifactory SaaS supports only TLS 1.2. Since not all TFS versions support TLS 1.2, you may need to enable TLS 1.2 on TFS.

To enable TLS 1.2 on TFS:
 
1. Create a file and name and name it: Microsoft.PowerShell_profile.ps1
2. Add the following line to the file:


[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

3. Place the file in the following location on the TFS machine: C:\Users\<username>\Documents\WindowsPowerShell

Make sure <username> matches the name of the user running TFS and the build agents.

Downloading Generic Dependencies from Artifactory

The Artifactory Generic Download task supports downloading your build dependencies from Artifactory to the build agent. 
The task triggers JFrog CLI to perform the download in the background and is defined using File Specs and can also be configured to capture the build-info. 
The task stores the downloaded files as dependencies in the build-info which can later be published to Artifactory using the Artifactory Publish Build-Info task.

When configuring the task, do the following:

  1. Select your configured Artifactory service endpoint.
  2. Specify whether you'd like define the File Spec through the task UI or have the task read the spec from a file.
  3. Set the File Spec content or a path to the File Spec.
  4. Set the other task options.

Uploading Generic Artifacts to Artifactory

The Artifactory Generic Upload task supports uploading your generated build artifacts from the build agent's local file system to Artifactory. 
The task triggers JFrog CLI to perform the upload in the background. 
The artifacts are defined using File Specs and can also be configured to capture build-info as it stores the uploaded files as artifacts in the build-info. The captured build-info can be later published to Artifactory using the Artifactory Publish Build-Info task.

When configuring the task, do the following:

  1. Select your configured Artifactory service endpoint.
  2. Specify whether you'd like define the File Spec through the task UI or have the task read the spec from a file.
  3. Set the File Spec content or a path to the File Spec.
  4. Set the other task options.

Triggering Builds

You can trigger the following builds.

Triggering Maven Builds

The Artifactory Maven task allows triggering Maven builds, while resolving dependencies and deploying artifacts from and to Artifactory.

The task can also be configured to capture build-info and store the downloaded and uploaded artifacts as build dependencies and build artifacts. The captured build-info can be later published to Artifactory using the Artifactory Publish Build-Info task.

For more information on Maven repositories, see Artifactory Maven Repository.

Triggering Npm Builds

The Artifactory Npm task allows triggering npm builds, while resolving npm dependencies and deploying npm packages from and to Artifactory.

The task can be also configured to capture build-info and store the uploaded files as artifacts in it. The captured build-info can be later published to Artifactory using the Artifactory Publish Build-Info task.

For information on npm repositories, see Artifactory Npm Registry.

Triggering Nuget Builds

The Artifactory Nuget task allows triggering nuget restore while resolving nuget dependencies from Artifactory. It also allows publishing nuget packages to Artifactory. The task can be also configured to capture build-info and store the uploaded files as artifacts in it. The captured build-info can be later published to Artifactory using the Artifactory Publish Build-Info task.

For more information on Nuget repositories, see Artifactory Nuget Repositories.

Triggering Conan Builds

Conan is a package manager for C and C++.

The Artifactory Conan task allows triggering a conan build while resolving conan dependencies from a conan repository in Artifactory. It also allows publishes conan packages to an Artifactory conan repository. The task can be also configured to capture build-info and store the downloaded and uploaded packages as build dependencies and artifact. The captured build-info can be later published to Artifactory using the Artifactory Publish Build-Info task.

The tasks supports the config installadd remotecreate and upload conan commands. In addition, it supports a custom option, allowing to configure the task to execute any conan command. The full documentation of cona is available at the conan web site.


For more informtion on Conan repositories, see Artifactory Conan Repositories.

Pushing and Pulling Docker Images to and from Artifactory

The Artifactory Docker task allows pushing and pulling docker images to and from a docker repository in Artifactory. The task can be also configured to capture build-info for the pushed or pulled image. In addition to details about the build and the build environment, the build info includes the image layers as build dependencies and build artifacts. The task stores build info locally on the build agent. The stored build-info can be later published to Artifactory using the Artifactory Publish Build-Info task.

For more information on Docker and Artifactory, see Artifactory Docker Registry.

Publishing Build Info to Artifactory

The Artifactory Generic Download and Artifactory Generic Upload tasks can be configured to collect and store build-info locally. The collected build info can be then published to Artifactory using the Artifactory Publish Build Info task.

For more information about Build Info, see Artifactory Build Integration.

When configuring the task, select your configured Artifactory service endpoints and specify whether you'd like to collect environment variables from the agent and add them to the build-info.

After the build-info is published to Artifactory, it can be accessed from the Artifactory tab in the Build Results.

BuildInfo

Promoting Published Builds in Artifactory

To support the artifacts life-cycle, Artifactory supports promoting published builds from one repository to another.

The Artifactory Build Promotion task promotes a build, by either copying or moving the build artifacts and/or dependencies to a target repository. 
This task can be added as part of a Build or Release pipeline.

Run these steps to configure the Artifactory Build Promotion task:

  1. Select the configured Artifactory Service, to which the build has been published.
  2. Specify the name of a Target repository to which the build should be promoted.
  3. Set the Status of the build and optionally add a Comment. These details will be visible as part of the Build History in the Artifactory UI.
  4. (Optional) Set a Source repository for the promotion. 
  5. Unselect the Copy/move build dependencies field to move or copy only the build artifacts the target repository.
  6. To copy and not to move the artifacts to the target repository, select the Copy artifacts option to copy the artifacts to the target repository.
  7. Select Dry run to test the promotion prior to running the build promotion.

BuildInfo

Using Build Promotion in a Release

You can control the life cycle of your artifacts by promoting them from one Artifactory repository to another. Build Promotion can come in handy when embedding it as part of release pipeline in Azure DevOps. To help you achieve this, follow these steps for creating a release which includes the Artifactory Build Promotion task.

  1. Create a new Release.
  2. Click Environment and select a template for the release.
  3. Click Artifact and select Build as the source type.
  4. Fill out the rest of the form details and make sure to select Specify at the time of release creation as the Default version. Selecting this option allows you to select the version (i.e build number) to promote, when creating a release).
  5. Add and configure the Artifactory Build Promotion task as one of your release pipeline tasks. 
    The task uses a build number which will be selected later on, upon creating a release.
  6. That's it your done!
    Now you can create the release. The build number that you'll choose is that one which will be promoted in Artifactory.

Scanning Published Builds with JFrog Xray

The Artifactory Xray Scan task allows triggering a build scan with JFrog Xray. For the build to be scanned, it first needs to be published to Artifactory using the Artifactory Publish BuildInfo task. When the scan is triggered, Artifactory will pass on the build to Xray, which will then scan the build artifacts. The scan is synchronous, meaning it will wait for the scan to finish.

If the Allow fail build task option is set and Xray is configured to fail the build, the build pipeline will fail, if vulnerabilities are found.


Using Published Artifacts in a Release

Artifacts which were published to Artifactory can be made available for a Release Pipeline. There are two ways to achieve this.

The first way is to  use the Artifactory Download task to download the files during the release. Read more about this in the Downloading Generic Dependencies from Artifactory section.

You can also set Artifactory as an artifact source for the release. This allows downloading the artifacts for a build which was previously published to Artifactory. Read more about publishing builds to Artifactory in the Publishing Build Info to Artifactory section.

Follow these steps to add Artifactory as an artifact source to a Release.

  1. Create a new Release and click on Artifacts | Add




  2. Select the Artifactory source type.




  3. Select an Artifactory service, a build name, and the default version to use.




    That's it! You're done.
    Now, when initiating the Release, the artifacts associated with the defined build are downloaded to the release agent.

Discarding Published Builds from Artifactory

To discard old runs of a build from Artifactory, add the Artifactory Discard Builds to the pipeline.

Run these steps to configure the task.

  1. Select the configured Artifactory Service, on which you'd like the builds to be discarded.
  2. Type the name of the build.
  3. Optionally set the maximum days to keep build runs. Build runs which are older will be discarded.
  4. Optionally set the maximum number of builds to keep.
  5. Optionally set of build runs in the form of 10,11,12,... to keep and not to discard.
  6. Check the Delete artifacts checkbox, to also delete the build artifacts and not only the build meta-data.
  7. Check the Async checkbox, to make the action asynchronous. In this case, the pipeline will not wait for the action to finish, but the pipeline will not be notified in case of a failure.

Release Notes

1.6.2 (July 9th, 2019)
  1. Bug fix: Npm task may fail with 'panic: runtime error: index out of range' (new JFrog CLI version).
1.6.1 (July 4th, 2019)
  1. Disable JFrog CLI's usage reporting.
1.6.0 (July 1st, 2019)
  1. New 'npm ci' command in Artifactory Npm task.
  2. Add 'Build info threads' attribute to Npm install task.
  3. Support forward slashes in File Specs on windows agents (new JFrog CLI version).
  4. Nuget build-info - Do not include projects which are detached from the solution (new JFrog CLI version).
1.5.0 (February 3rd, 2019)
  1. Allow downloading JFrog CLI and the Maven Extractor from Artifactory.
  2. Allow setting custom build name and number as part of the Artifactory tasks configuration.
  3. New Artifactory Discard Builds task.
1.4.1 (January 2nd, 2018)
  1. Added Artifactory as an artifacts-source for a release pipeline.
1.3.1 (November 26th, 2018)
  1. New Artifactory Xray Scan task.
  2. Added docker pull support to the Artifactory Docker task.
1.2.2 (October 15th, 2018)
  1. Use vsts-task-tool-lib to download JFrog CLI as a tool.
1.2.1 (October 8th, 2018)
  1. Support HTTP_PROXY, HTTPS_PROXY and NO_PROXY environment variables when downloading JFrog CLI.
1.2.0 (October 1st, 2018)
  1. New Artifactory Conan task.
  2. New Artifactory Docker task.
1.1.1 (September 12th, 2018)
  1. Fixed nuget push when the nupkg path includes wildcards.
1.1.0 (August 30th, 2018)
  1. New Artifactory Maven, Artifactory NPM and Artifactory Nuget tasks.
  2. Support reading File Specs from files in the Artifactory Download and Upload tasks. 
  3. New "
  4. The "" fields was added to all tasks which support collecting build-info and removed from the Artifactory Publish Info task.
1.0.6 (August 15th, 2018)
  1. Reduced the extension size.
  2. Bug fix - Paths with white-spaces are not working properly on Windows agents.
1.0.4 (August 12th, 2018)
  1. Bug fix: Modified the Artifactory Generic Upload and Download tasks to use System.DefaultWorkingDirectory by default.
  2. Bug fix: Artifactory Generic Upload and Download tasks failed with error on Release.
  3. Artifactory Promotion task: Change Source and Target Repository fields to be drop down lists.
1.0.3 (August 9th, 2018)
  1. Bug fix: Generic Upload and Generic Download tasks on Windows can fail when using variables.
1.0.2 (July 30th, 2018)
  1. New Generic Upload and Generic Download tasks.
  2. New Promotion task.
  3. New Publish Build Info task.
  • No labels