Create your author custom artifacts in DevTest Labs


Step 1: Connect to public GitHub Repository to find Artifacts folder

Step 2: Clone VSTS Repository on your local Machine

Step 3: Getting Artifact definition file



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.

0-Artifact source definitions

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.

1-1 Connect to public GitHub Repository to find Artifacts folder

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.

1-2 Windows-VSO-download-and-run-script folder

5. In this folder you will find artifact file .json, which is Artifact definition file that contains all meta data that makes Artifact. JSON (JavaScript Object Notation) is a lightweight data-interchange format, which is based on a subset of the JavaScript Programming Language and is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. It contains also script file that you want to refer within your Artifact definition. Click on Artifact definition file Artifactsfile.json.
6. In Artifacts definition file you will see that it contains the Title, Description and other Parameters.

1-3 Artifact definition file Artifact JSON

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.

2-1 Clone VSTS Repository on your local Machine

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.

2-2 Clone the VSTS Git Repository GitBash

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-1 Getting Artifact definition file

3. In the new window select all text and copy it.

3-2 Getting Artifact definition file copy the script

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.

3-3 Getting Artifact definition file and editing in json editor

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.

3-4 Artifacts folder in json edtior

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.

3-5 Create the Artifact definition file

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.

3-6 Paste the content from Artifact definition file

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.

3-7 Commit the changes in Repository

17. Navigate back to VSTS Git Repository and refresh the page to see if the changes are synced.

3-8 VSTS Git Repository synced changes


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.


Share This: