In the previous article, Creating Virtual Image from Template Executed by Jenkins, we automated the creation of one single image through a Jenkins build. Now, we are going to take it to the next level, and let’s instantiate a group of machines. This will provide the possibility to configure them up in term of networking and other specific roles, so we can execute our software tests in a networked environment.
We will need to execute our previous article build project with several different parameters. To do so, we will need the Multijob plugin, which you can install under Manage Jenkins / Manage Plugins from the main Jenkins page. My build for the previous article is called InstantiateTemplate, if you named yours differently don’t forget to change it. Let’s call this current build CreateComplexEnvironment, because we will later revisit this build to add additional functionalities like configuring networking and so on, by adding smaller build as build steps. As a result, this will become the core of the test environment build.
Before we hop into configuring up the build, which is not that tricky, one more thing. For each of the build run, we are going to build a separate full environment in the build number named subdirectory of D:\working-images\complex, so they will not interfere with each other. Also as a small reminder, my image is named ate-windows-base and my images are located under D:\ate\images. I’m going to create two computers, one named desktop and one named server, both having the build number appended to them at the end. Since currently, I’m creating them from the same image there will be no real differences between them, feel free to use different images or even different number of virtual machines. The numbering serves the purpose of helping to identify which is which in the Hyper-V manager and on the network too, when later we will assign IP address to them as well.
The Build Configuration
MultiJob Phase |
|
Phase name |
Deploying Environment |
Phase jobs |
|
Job name |
InstantiateTemplate |
Kill the phase on: |
Failure (stop the phase execution if the job is failed) |
Abort all other job |
Yes |
Current job parameters |
Yes |
Predifined parameters |
TEMPLATE=ate-windows-base TEMPLATE_DIRECTORY=D:\\ate\\images IMAGE_DIRECTORY=D:\\working-images\\complex\\$BUILD_NUMBER IMAGE=desktop$BUILD_NUMBER |
Job name |
InstantiateTemplate |
Kill the phase on: |
Failure (stop the phase execution if the job is failed) |
Abort all other job |
Yes |
Current job parameters |
Yes |
Predefined parameters |
TEMPLATE=ate-windows-base TEMPLATE_DIRECTORY=D:\\ate\\images IMAGE_DIRECTORY=D:\\working-images\\complex\\$BUILD_NUMBER IMAGE=server$BUILD_NUMBER |
Job execution type |
Running phase jobs sequentially |
Continuation condition to next phase when jobs’ statuses are |
Always |
No comments yet.