I’ve described already in some previous post very quickly what Artifacts are. They can be different items such as actions that you want to run on the VM, tools that you want to install on a VM or some applications that you want to test. When you are authoring a release definition, you must link the right Artifact sources to your release definition. You will have the possibility to link a release definition to Jenkins project or to Team Build definition.
When authoring a release definition, you link the appropriate artifact sources to your release definition. For example, you might link a release definition to a Team Build definition, or to a Jenkins project. In the process of creating the release, you must specify the exact version of these artifact sources, like the how many builds are coming from Team Build. For Jenkins project you will have to specify which is the version of build that is coming from a Jenkins project.
You must know that once when a release is created, there will be no possibility to change these versions. One single release definition can be linked to many artifact sources; you will just need to specify individual versions for each of these sources in process of creating the release.
Step 1: Connect to public GitHub Repository to find Artifacts folder
You can create Artifact to deploy different actions on you Virtual Machine, such as installing software or application on the Virtual Machine, so that you will be able to test the software or application directly on the Machine. You will see that your created Lab will already have some installed Artifacts, which are sourced on public GitHub Repository.
1. Navigate to your Lab and click on Getting Started button.
2. In the new blade on the right side, click on Sample Artifacts and Scripts link.
3. The link will take you to Public GitHub Repository. Click on Artifacts folder.
4. You will see that each Artifact is saved in his own folder. Click on Windows-VSO-download-and-run-script folder.
6. In Artifacts definition file you will see that it contains the Title, Description and other Parameters.
Step 2: Clone VSTS Repository on your local Machine
1. Navigate to your VSTS Git Repository and click on Clone button.
2. In the window that appears, click on Command Line button.
3. In the new window click on the Copy button.
4. Open GitBash, which you need to have already installed. To clone the VSTS Git Repository, you will need to run copied command. Paste the command and specify the path of local folder in which you will clone this Repository.
Step 3: Getting Artifact definition file
In this step you will use the Artifact definition file of the existing Artifact in public GitHub Repository. You will need to edit this file later for requirements of custom Artifact.
1. Navigate back to public GitHub Repository and click on Artifactfile.json file.
2. In the new window click on Raw button.
3. In the new window select all text and copy it.
4. You will need a code json editor to edit this file. I’d recommend using Visual Studio Code, which is a free tool and available on all platforms, such as Windows, Mac and Linux. Navigate to Visual Studio Code. Click on File and then on Open Folder.
5. Click on Contoso Repo folder.
6. Click on Select Folder button.
7. Then you will need to create a folder which will contain all the Artifact that you will create. Click on Add icon.
8. Type the name of the folder, which is in this example Artifacts.
9. Click again on the add icon and add beneath of Artifacts folder for Artifact that you are going to create now.
10. Go to your folder, which contains that file and drag and drop it in this panel.
11. Now you will need to create the Artifact definition file. Right click on Windows-instalVsoBuildAgent and choose Create a new file.
12. Type the file name Artifactfile.json and it is very important to type that exact file name.
13. Paste the content from Artifact definition file. Change the title and description and update your parameters. When you are done with the update, just click on the Save button.
14. Before you sync the Remote Repository with Local Repository, you will have to commit the changes. Type Create new repo.
15. Click on Okay symbol to commit the changes locally.
16. Right click and click on Sync button.
17. Navigate back to VSTS Git Repository and refresh the page to see if the changes are synced.
Artifact definition files are made from JSON and Expressions which enables you to define what exactly you want to install on VM. In this post I’ve described how easily you can create Custom Artifact by using an existing script for Artifact installation and save it in your private Git repository. You can expose all required parameters so that Lab users can modify the value of each parameter when they create a VM with Artifact.