Artifactory brings continuous integration to Visual Studio Team Services(VSTS) through the Visual Studio Team Services Artifactory Plugin.
This guide is a walk-through of how to setup the Artifactory VSTS integration.
- In this example we will work with GitHub source code management - you can fork an example project from the following GitHub page (we will use the the "MyLogger" project).
- VSTS account, you can create free account by entering to the following link.
- (Optional) JFrog CLI for windows - the plugin using the JFrog CLI in order to perform actions against Artifactory - in case we want to use specific version of JFrog CLI, we need to download it and add the file to our GitHub repository.
1. install the JFrog Artifactory Integration plugin from the Marketplace:
* Sign in to your VSTS account and go to the marketplace. You can find the plugin in the Build and Release section where it is named JFrog Artifactory Integration.
* On the VSTS Artifactory Plugin page, click "Install".
* Select the account to which you want to apply the plugin and confirm installation.
2. Create new project:
3. Add new services for Artifactory server and GitHub:
In order for VSTS to communicate with Artifactory and GitHub, we need to create services.
* In order to create service for Artifactory server, please use the "Generic" option - the service include the following information: server URL (please make sure to not add '/' at the end), username and password.
* In order to connect VSTS with your GitHub account, please use the "GitHub" option and follow the instructions.
4. Create Build definitions.
The build definitions include the tasks which VSTS will perform in order to build the project and deploy it to Artifactory, for our example we need to define 5 tasks:
- Task 1: Get sources - downloading the project source code:
- Task 2: Nuget Restore - resolving the nuget dependencies of the project - please set the right path to the project solution.
- Task 3: Build Solution - compiling and build the source files - please set the right path to the project solution.
- Task 4: Nuget Packager - creating the nuget package from the compiled file - please set it to the project .csproj file or to the .nuspec file.
- Task 5: JFrog Artifactory Deployer - deploying the artifact to Artifactory (using JFrog CLI).
Please select the Artifactory server which you have configured as the service and enter the target repository name.
Also, in case you want to use sepcific version of JFrog CLI, please set the path to jfrog.exe (JFrog CLI) at your repository (marked in blue).
in addition, edit the "Path to the Artifacts" field according to the files you want to deploy - the default folder for the build agents is"$(Agent.BuildDirectory)s", in our case we want to deploy only the nuget packages , therefore we will use: "$(Agent.BuildDirectory)s(*)[.]nupkg" - the deployer is using JFrog CLI syntax.
You can read more about JFrog CLI at the following link.
If you would like to deploy Build Info to Artifactory, please check the "Enable build information" option.
5. Save and Queue the build!
Note: the information which inserted at the "Setup JFrog Artifactory" page is use for UI connection at the "JFrog Artifactory" tab and not affecting the build results.