0% found this document useful (0 votes)
11 views

DevOps Engineer 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)
11 views

DevOps Engineer 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
You are on page 1/ 4

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 app.zip 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 README.md 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 README.md 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 http://localhost:5002/api/welcome

• you should see the following by visiting: http://localhost:3000/

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


[email protected] 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 README.md file to the repository root that explains about the project. You will need to
add instructions to the created README.md 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 env.js 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
README.md 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
README.md 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 ‘log.txt’ 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: http://example.com/api/saveFile
• 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/README.md 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?

You might also like