0% found this document useful (0 votes)
36 views4 pages

DevOps Engineer Assessment Exercise

Uploaded by

Oleg Burca
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views4 pages

DevOps Engineer Assessment Exercise

Uploaded by

Oleg Burca
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

DevOps Engineer Exercise

Introduction (to be shared upfront)

Prerequisites
• Azure DevOps
o sign-up for free and create a new Azure DevOps account
• Docker Hub
o sign up for free and create a Docker Hub account
o create a new private Docker Hub repository
• have your local environment ready for
o running a Flask (2.2.3) application
o running ReactJS application with node and npm
o running docker containers

Notes

You will have 2 hours to perform several tasks related to daily DevOps activities on Azure
DevOps. You are allowed to use any resources (online or from your old projects) except human
help.

Implement the solution to the best of your knowledge. Although the exercise is simple, please
use all the patterns and best practices that you would use for a more complex production
application.

If something is well specified in the task description, follow those instructions precisely. If
something is unspecified, be creative and come up with the solution that you think the best.

Task (available time 2 hours – NOT to be shared upfront)

Preparation

In the shared [Link] file, you find the source code of two applications. One application is a
React front-end application (see frontend folder). The other application is a Flask API (see api
folder). In each folder, you find [Link] files where you see more information on how to
run the applications. Take a couple of minutes to look into the source code of the applications
so you can have a basic understanding about them.

In case you followed the instructions in the [Link] files (don’t be surprised if something
does not work as expected but please try to fix the issue):
• you should see the following by visiting [Link]

• you should see the following by visiting: [Link]

In the Azure DevOps, create a project called devops-assessment and invite


[Link]@[Link] as project administrator(!) for that project.

Adding the applications to version control

Your first task is to store the content of the ZIP file in a Git repository of the Azure DevOps
project you created. You can store the two applications in one single repository. Make sure to
have dev and master branches in the repo. Branches should be configured on a way that
prevents direct push to master.

Add a [Link] file to the repository root that explains about the project. You will need to
add instructions to the created [Link] file throughout the exercise.

Use meaningful commit messages. Once you finished all items under the “Adding the
applications to version control” section, create a pull request and add the changes to master
branch.

Dockerizing the applications

Your next task is to dockerize the two applications on a production ready way and push them to
docker hub.

Note: the welcome message for both the React (REACT_APP_WELCOME) and for the Flask app
(WELCOME) should be configurable at runtime (when container is created/started).
Hint: an [Link] file is already stored under frontend/public folder to help you achieve runtime
configuration for the React application.
Push all added files with meaningful commit messages to the Git repository. Extend the
[Link] file in the root of the repository with instructions on how to perform push to
docker hub in case the application changes.

Once you finished all items under the “Dockerizing the applications” section, create a pull
request and add the changes to master branch.

Running the applications

The next task is to create a file so with a single docker compose command the two applications
can be started in two separate docker containers.

Note: in case you get some CORS policy related error, please troubleshoot, and fix the issue.

Push all added files with meaningful commit messages to the Git repository. Extend the
[Link] file in the root of the repository with instructions on how to start the Docker
containers, how to configure the welcome messages and on what URLs to access the
applications.

Once you finished all items under the “Running the applications” section, create a pull request
and add the changes to master branch.

Pipeline for building and pushing changes

The task is to create a pipeline in Azure DevOps for automatically pushing changes to Docker
Hub once a pull request was merged into master. Use YAML version of Azure Pipelines.

Note: the free Azure DevOps account does not allow you to run the pipeline. The task is only
about creating the pipeline and no need to run it. (Hint: In case you wish to run the pipeline for
testing, you could setup a vsts build agent on your local machine but be aware that this might
be a time-consuming exercise therefore neither recommended nor required.)

Once you finished all items under the “Pipeline for building and pushing changes” section,
create a pull request and add the changes to master branch.

Unix commands

Create a nicely formatted wiki page in the devops-assessment project called “Unix answers”,
copy the below questions to the page and provide answers for the below questions on the wiki
page.
1. Find files that contains the text ‘Hello’ and print both the filename and the matching line
with context to the console. Highlight matches with yellow font color and gray highlight
color.
2. Output the last lines of the ‘[Link]’ file on a way that you see immediately if the log file
was updated. Provide a solution that keeps working if the log file is frequently
recreated.
3. List the size and last modification of all elements above 50kB within the current
directory in a human-readable form. Also cater for symlinks.
4. Call the following API end-point with curl:
• URL: [Link]
• Method: POST
• Authentication: basic with username ‘test’ and password ‘test’ (instead of using ‘-u’
option, please send the credentials in HTTP header)
• The following fields should be sent as multipart/form-data:
• fullname: ‘Test user’
• file: arbitrary file

Improve the pipeline

The task is to improve the pipeline created in the previous task. Extend the pipeline so pushing
changes to Docker Hub happens only if tests for the Flask API are passed. Also publish the test
results to Azure DevOps so test execution result could be seen for each pipeline run.

Note: you find information in the api/[Link] file on how to run the tests for the Flask API.

Once you finished all items under the “Improve the pipeline” section, create a pull request and
add the changes to master branch.

Service Management questions

Create a nicely formatted wiki page in the devops-assessment project called “Service
Management answers”, copy the below questions to the page and provide answers for the
below questions on the wiki page.
1. Why are Incident and Problem Management needed? What is it?
2. Provide the main steps that you would take in a problem management process?
3. Tell us what you understand by a Known error? Provide an example.
4. Why is a change advisory board (CAB) needed?

Common questions

Powered by AI

A Change Advisory Board (CAB) is essential in change management processes because it evaluates and authorizes proposed changes to the IT environment. This governance ensures that changes align with business goals, risks are mitigated, and minimal disruption occurs. Involving a CAB helps prevent unauthorized changes that might lead to outages or issues, thereby maintaining service reliability and quality. The CAB evaluates the potential impact of changes systematically, considering both technical and business perspectives .

Creating 'dev' and 'master' branches in version control serves multiple purposes. The 'dev' branch is used for active development and testing, allowing developers to make changes without affecting the stable codebase in the 'master' branch. The 'master' branch acts as the main branch that contains production-ready code. Using this branch structure helps prevent unauthorized or accidental changes to the 'master' branch by requiring a pull request to merge changes. This ensures that all changes are reviewed and tested before being integrated into the production environment, thus maintaining code quality and stability .

When devising a CI/CD pipeline for Docker applications in Azure DevOps, it is crucial to create the pipeline using YAML for flexibility and version control. This pipeline should be triggered upon merging a pull request into the master branch, automatically building and pushing the Docker images to Docker Hub. It's essential to consider unit tests execution, where successful passing is conditional for the subsequent build and push steps. The pipeline should also publish test results to Azure DevOps to keep track of test execution outcomes for each run. Ensuring meaningful commit messages and updating documentation in README.md is also vital .

Unix commands can find files containing specific text and highlight matches using a combination of 'grep' and 'awk' or 'sed'. For instance, the command 'grep -r --color=always 'Hello' . | awk '{print ""$0""}' combines recursive searching with conditional formatting to highlight matches. 'Grep' searches files for the specified text and 'awk' or 'sed' is used to modify the output by adding ANSI color codes that change text appearance in the console, such as using a yellow font color on a gray background .

When dockerizing applications for production use, one key consideration is ensuring that configuration, such as the welcome message for the React and Flask apps, is runtime-configurable. This can be achieved by configuring environment variables, and using an env.js file for React. Pushing the images to Docker Hub must be done after making sure the application behaves correctly under production settings. It is crucial to document the steps for building and pushing Docker images and ensure meaningful commit messages are used when changes are made to the Git repository .

Runtime configuration for a React application in a Docker container can be achieved by utilizing an env.js file, which is stored under the frontend/public directory. This approach allows the configuration of environment variables, like REACT_APP_WELCOME, at the time the container is created or started, ensuring the application can adapt to different environments without requiring a rebuild of the Docker image .

A typical problem management process in IT service management involves several steps: 1) Problem Identification, where problems are recognized and logged based on incidents; 2) Problem Analysis, where the underlying cause of incidents is investigated; 3) Root Cause Analysis, identifying the root cause through analyzing available data; 4) Workarounds, providing temporary solutions to minimize the impact; 5) Permanent Solutions, resolving the root cause and preventing recurrence; and 6) Review and Closure, assessing the effectiveness of the resolution and documenting learnings .

To handle CORS policy errors when using Docker Compose, it is important to correctly configure the API server to allow requests from different origins. This can typically be achieved by setting appropriate headers such as Access-Control-Allow-Origin on the server side. Another strategy involves ensuring that Docker Compose exposes the services correctly and that they are accessible through the expected ports. Troubleshooting tools can be used to identify and adjust any misconfigured settings in the Docker Compose file .

Azure DevOps pipelines enhance continuous deployment by automating the process of building, testing, and deploying applications, which increases efficiency and reduces human error in deployments. Using Docker within this setup provides consistency across environments by packaging applications with all their dependencies, which ensures that they run reliably regardless of where they are deployed. The synergy of Azure DevOps pipelines and Docker allows for rapid iteration and frequent releases, as updating code and pushing changes to Docker Hub can be automated, thus aligning with DevOps principles of continuous integration and delivery .

To improve a CI/CD pipeline for ensuring quality before deployment to Docker Hub, it should be extended to incorporate a testing phase where the Flask API or any other services undergo automated testing. The pipeline should only proceed to build and deployment steps if all tests pass, thereby enforcing a quality gate. Publishing test results in Azure DevOps creates visibility and accountability for code quality. Additionally, the pipeline can include security scanning and best practice analysis tools to catch potential vulnerabilities and inefficiencies before any further action is taken, thus ensuring high-quality releases .

You might also like