How to test images built on cloud

An image is a single file that is a complete copy of the structure and contents of a disk’s file system. Software deliveries such as operating system distributions or discs with pre-installed products can be distribute via images. Depending on the cloud provider, there are dissimilar habits to building an image.

Our blog post: “How do I create an image in a cloud marketplace?” There are step-by-step instructions for creating a mist image.

After creating such an image, designers often face a lengthy manual process to test the shaped code.

But wouldn’t it be abundant better to deploy an image with just one click and then test it?

The third part of the blog sequences on cloud markets is devote to the topic: “In what way to test a copy bent in the fog?”.

Test workflow – with fair one mouse click

To bypass a long and tedious process where developers manually test their code, a CI/CD pipeline can be use to have a more robust and reliable testing process.Also gitlab CI/CD, Packer, Terraform, then shell scripts can be rummage-sale. The idea is that developers can deploy and test images with a button.

With Packer, you can create and host an image on a cloud provider, Terraform then takes the created image and deploys a virtual machine with that image. With the virtual machine running, test scripts can be run (checking if a specific port is open, checking if the login works, testing the natural functionalities of the product, etc.).

After the test scripts are ready, Terraform destroys any resources created on the cloud provider that was provisioned during the test.

All steps summarized:

test images

Step 1:  The developer approves the code

2 – Activate the build image with Packer

3: Packer creates the image and returns the image id (e.g., id=xyz)

4: Start the VM with image id = XYZ

5 – Terraform starts the VM and returns the IP address of that VM

6: Test the VM with IP from Step 5

7: Saved test results

8 – Destroy the test virtual machine

9 – Test the destroyed virtual machine

Gitlab CI/CD – process automation

Without GitLab CI/CD, investors would first manually image Cloud with Packer. Once the image has been create and hosted at a cloud provider, the developer would advance to make a cybernetic machine based on the create image. The VM creation process was typically done through the cloud provider’s console.

After completing the virtual machine, the developer would manually test the photo to check, for example, whether the website can be access from the browser, whether the login page can be accessed, the actual functionality of the product, etc.

With GitLab CI/CD, you can automate this entire process. GitLab CI/CD orchestrates all communication between Packer, Terraform and test scripts and ensures the correct execution order.

Packer – creating the image

Once the developer commits to the GitLab repository, once the image creation process is complete, the image  host at a cloud provider. Each image has its unique ID. GitLab CI/CD must know the ID of a specific item because, with this image ID, the next step can be taken: boot a virtual machine with this image ID with Terraform.

Terraform: Start a virtual machine

Designers already have a Terraform configuration for launching virtual machines (this is a kind of template that tells Terraform pardon kind of computer-generated mechanism to run). In Terraform, the shape is writes, where to start the virtual machine (which network, subnet, etc.), and what type of machine to create (how many CPU cores, disk space, GB of RAM, etc.). Terraform gets the image ID from the previous step as input.

There is also a parameter for the image id, and this image id comes from Packer. Terraform can launch that specific virtual machine based on all this information (network, subnet, disk space, amount of CPU cores, and image ID).

Once the device is start, GitLab CI/CD knows the IP address of this machine because with this IP address because the next step, e.g., B. testing the VM, can be performe

Test scripts automatically

To test the virtual machine, the test scripts need to know, among other things, the machine’s IP address under test. Using shell scripts, we can verify connectivity with the instance provided by Terraform, and more importantly, we can demonstrate the actual capabilities of the image we are building.

Paths to the cloud with Libelle software

Want to learn more about the cloud? Then please visit our corresponding blog category.

We at the Libelle IT Group also rely on the advantages of the cloud and provide various solutions. Also Use the cloud versions of Libelle DataMasking (AWS/Microsoft Azure), Libelle SystemCopy (AWS/Microsoft Azure), or Libelle CloudShadow (IBM Cloud).

Leave a Reply

Your email address will not be published.