Have a question? Want to report an issue? Contact JFrog support

Skip to end of metadata
Go to start of metadata

Overview

Artifactory brings continuous integration to Visual Studio Team Services (VSTS) and Team Foundation Server (TFS) through the JFrog Artifactory VSTS Extension. 

 The JFrog Artifactory VSTS extension 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 VSTS Artifactory extension is available in the VSTS Marketplace.

To install the VSTS Artifactory extension, execute the following steps:

  1. Sign in to your VSTS account and go VSTS marketplace. 
  2. Select the JFrog Artifactory extension located under in the Build and Release section.
  3. On the VSTS Artifactory Extension page, click Install.
  4. Select the account to which you want to apply the plugin and confirm installation.
Page Contents

Installing the Build Agent

If the build agent has access to the internet, the tools needed to execute the various Artifactory tasks are installed automatically on the agent the first time they are need, with the exception of conan. Conan needs to be installed manually on the build agent. To install conan on an agent, read the Install Conan section.

If your agent has no online access, you'll need to install the following tools on the build agents manually:

JFrog CLI - for all Artifactory tasks

Maven Extractor - if the Artifactory Maven task is used

Conan - If the Artifactory Cona  task is used.

Install 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.

Follow these steps to install JFrog CLI on an agent which does not have internet access:

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

Install 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.

Follow these steps to install the Maven Extractor jar on an agent which does not have internet access:

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

Install Conan

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

  1. Access the agent and install conan following the steps described here..
  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

To use the Artifactory Extension with TFS 2015, the build agent needs to use version 8 or above of Node.JS.

To check the installed Node.JS version on the build agent, follow these steps:

  1. CD into Worker\Handlers\Node folder located under the agent home.
  2. From the terminal run node -v

To upgrade Node.JS on the build agent, the existing node.exe file on the agent needs to be replaced with the node.exe file of the desired version.
The node.exe file is 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 VSTS project and click Project Settings > CI/CD > Service endpointsNew service connection and select Artifactory.
  2. Configure the details of the Artifactory instance.


Cannot 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 do this, follow these steps:
 
1. Create file named '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 are 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 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.


Read more about maven repositories in the Artifactory Maven Repository documentation

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.


Read more about npm repositories in the Artifactory Npm Registry documentation

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.


Read more about Nuget repositories in the Artifactory Nuget Repositories documentation.

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 install, add remote, create 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.

 

Read more about conan repositories in the Artifactory Conan Repositories documentation.

Pushing Docker Images to Artifactory

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

 

Read more about docker and Artifactory in the Artifactory Docker Registry documentation.

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

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 VSTS. 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.

Release Notes

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