Skip to content

mirsadraee/cd1807-Project-Ensuring-Quality-Releases

 
 

Repository files navigation

Ensuring Quality Releases

In this project, we'll develop and demonstrate our skills in using a variety of industry leading tools, especially Microsoft Azure, to create disposable test environments and run a variety of automated tests with the click of a button. Additionally, we'll monitor and provide insight into our application's behavior, and determine root causes by querying the application’s custom log files.

Getting Started

Instructions for how to get a copy of the project running on your local machine.

Dependencies

The following dependecies of the project are needed;

  • Azure CLI

  • Terraform

  • JMeter

  • Postman

  • Python

  • Selenium

    Download the latest Chrome driver. You will also need to add the chromedriver to PATH.

    pip install -U selenium
    sudo apt-get install -y chromium-browser

    Execute the /automatedtesting/selenium/login.py file to open the demo site.

Altogether, our pipeline will create a number of resources:

✅ A resource group

✅ An App Service

✅ A Virtual Network

✅ A Network Security Group

✅ A Virtual Machine

Our demo REST API is deployed as part of our App Service, and our tests are executed against the REST API from the virtual machine created by Terraform as part of the CI/CD pipeline.

Installation

Step by step explanation of how to get a dev environment running.

List out the steps

Dev Environment - Terraform

To get started, we have firstly to loging to azure over

az login

Setup Terraform Variables

1- Replace the subscription variable values in the Terraform/terraform.tfvars based on the provided information by Azure Credentials:

subscription_id = "xxxx"
client_id = "xxxx"
client_secret = "xxxx"
tenant_id = "xxxx"

2- Update the resource Group and Location variables in Terraform/terraform.tfvars:

location = "East US"
resource_group_name = "Azuredevops"
application_type = "myApplication"

Configure the Storage Account and teh State Backend

for Terraform to save its state when run as a part of the CI/CD pipeline later. Here are the commands for Mac/Linux users:

chmod +x configure-tfstate-storage-account.sh
./configure-tfstate-storage-account.sh

Update terraform/environments/test/main.tf

Replace the values below in main.tf with the output from the Azure CLI.

terraform {
    backend "azurerm" {
            storage_account_name = "tstatexxxx"
            container_name       = "tfstate"
            key                  = "test.terraform.tfstate"
            access_key           = "xxxx"
    }
}

Update terraform/modules/vm/vm.tf

Update the terraform/modules/vm/input.tf file with the variables/values. Verify/update the terraform/modules/vm/vm.tf file with the variables declared in the input.tf. Once your VM will be ready using the final pipeline, you will have to SSH log into the machine to run Selenium functional (UI) tests. For SSH into the VM, either have an "admin_username/admin_password" pair in the vm.tf file or use SSH key pair, as explained in the next point.

Run Terraform Commands Ensure the variables in the input.tf files are properly referenced in the modules and main.tf file. Ensure the values from the terraform.tfvars file are properly referenced in the main.tf file.

After you have checked the main.tf and all modules in the terraform/modules/ directory, you can run these commands in your local terminal to deploy an Ubuntu Linux VM and the associated resources (vNetwork, security group, app service, and a public IP):

## Assuming you are in the terraform/environments/test/ directory
terraform init
## Run "terraform init -upgrade" if you have changed the file contents/path
terraform plan
terraform apply

You should see a successful deployment message, and your Azure portal should have the following resources, as shown in the snapshot below.

Here, we have the deployment message.

Here, we destroy the resources as we will deploy them again using the CI/CD Pieline.

terraform destroy

Setup an Initial Pipeline

The objective of this step is to set up a minimalistic DevOps pipeline to ensure the pipeline is set up correctly, before adding multiple stages to it.

The main steps are:

  • create Azure project and Service Connection
  • Create an Agent Pool and an Agent
  • Configure the Agent (VM) - Install Docker
  • Configure the Agent (VM) - Install Agent Services
  • Create a DevOps Pipeline (Connect to GitHub repository, Select the GitHub Repository, Configure the Existing Azure Pipelines YAML file, and Edit/Review the azure-pipeline.yaml)

Prepare a VM Image

Final Pipeline

Logging and Monitoring

Testing

Explain the steps needed to run any automated tests

Break Down Tests

Explain what each test does and why

Examples here

Project Instructions

This section should contain all the student deliverables for this project.

Built With

  • Item1 - Description of item
  • Item2 - Description of item
  • Item3 - Description of item

Include all items used to build project.

License

License

About

cd1807 Project Ensuring Quality Releases starter material

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 38.9%
  • HTML 36.2%
  • HCL 15.6%
  • CSS 5.5%
  • Shell 2.3%
  • Python 1.3%
  • ASP.NET 0.2%