Develop a RESTful Service Using Test Driven Development (TDD)
In this module, you will complete Sprint 1 by configuring the capstone project environment and developing the Customer Account microservice using test driven development (TDD). Start development of the microservice on a new branch on your GitHub repo. You will create tests for the RESTful Flask service and write test cases for the read, update, delete, and list functions. to pass these tests. As you develop, you will run nosetests to ensure at least 95% coverage. As your work progresses, you will move the user stories through your kanban board.
Add Continuous Integration (CI) and Security to a Repository
Before starting this module, ensure that you have completed all the steps described in the Hands-on Lab: Develop Your RESTful Service Using Test Driven Development. In addition, you should have a GitHub account and a GitHub repository, a basic understanding of YAML, familiarity with the syntax for GitHub Actions, and a basic knowledge of Python, Pip, and nosetests.
In Lesson 1, you will add a continuous integration workflow using GitHub Actions, which will help you automate the building and testing of your code. You will start by building a plan for Sprint 2 in the guided instructional lab, Sprint 2 Planning. Next, in the Add Continuous Integration hands-on lab, you will configure a GitHub Actions workflow that will be triggered when an event occurs in your repository. As part of Sprint 2, you will create a workflow that will build and test every push or pull request to your repository. You will be moving the corresponding user stories through your kanban board as your work progresses.
Before starting Lesson 2, ensure that you have completed all the steps described in the Hands-on Lab: Add Continuous Integration. In addition, you should have a basic understanding of security headers, cross-origin resource sharing (CORS) policies, Flask-Talisman, and Flask-Cors. You should also have a good understanding of test driven development (TDD) techniques, GitHub Actions, and GitHub operations (branching, merging, committing code, pushing code updates, and creating pull requests).
In Lesson 2, you will add secure code practices for the microservice you built by adding Flask-Talisman for security headers and Flask-Cors to establish CORS policies. To begin, you will assign the relevant story created for this task to yourself and start working on a new branch created for this specific task. To align with TDD practices, you will first write the test case for the security feature you are trying to implement. Once you have added Flask-Talisman for security headers and Flask-Cors to establish CORS policies, commit and push your changes to the repository and make a pull request that will kick off the GitHub Action. You will move the corresponding user stories through your kanban board as your work progresses.
Deploy Your Application to Kubernetes
Before starting this module, ensure that you have completed all the steps described in the Hands-on Lab: Add Security to Your RESTful Service. In addition, you should have a basic understanding of Docker and containerization, Docker commands, Kubernetes and OpenShift, YAML, kubectl, and oc commands. You should have a GitHub account and a GitHub repository, and you should be familiar with the syntax for GitHub Actions.
As part of Sprint 3, you will create a Docker image of your microservice and deploy the same to Kubernetes/OpenShift cluster manually.
You will first find the “Containerize your microservice using Docker” story in the kanban board, move it to "In Progress," and assign it to yourself. Next, you will create the Docker file and then use it to build a Docker image called accounts. You will deploy this image to Kubernetes/OpenShift as part of the next user story, “Deploy your Docker image to Kubernetes.”
You will create new branches for both stories and begin working on them. Once the tasks are completed, you will commit and push your changes from your local environment to your GitHub repository. Finally, you will create pull requests and merge your code to the main or master branch.
You will move the corresponding user stories through your kanban board as your work progresses. When you complete a story, you will move it to "Done" and from there to "Closed."
Build an Automated CD DevOps Pipeline
Before starting this module, ensure that you have completed all the steps described in the Hands-on Lab: Deploy Your Application to Kubernetes. In addition, you should have a basic understanding of Kubernetes and continuous delivery, Tekton pipeline, YAML, kubectl, and oc commands. You should have a GitHub account and a GitHub repository, and you should be familiar with the syntax for GitHub Actions.
For the lab in this module, you will automate the deployment to Kubernetes using the Tekton pipeline so that when the pipeline is triggered, the accounts service will be deployed to Kubernetes without requiring any manual intervention.
To start, you will find the user story "Create a CD pipeline to automate deployment to Kubernetes" in the kanban board, move it from the "Sprint Backlog" to "In Progress," and assign it to yourself.
Next, you will create the CD pipeline, involving tasks for cloning, linting, unit testing, building, and deploying the service to an OpenShift/Kubernetes cluster.
You will also create a Tekton trigger using the Tekton Catalog, such as a commit to your GitHub repository, which will initiate the pipeline run.
You will create a new branch for this story and start working on it. Once the task is completed, you will commit and push your changes from your local environment to your GitHub repository. Finally, you will create pull requests and merge your code to the main or master branch.
You will move the corresponding user stories through your kanban board as your work progresses. When you complete a story, you will move it to "Done" and from there to "Closed."
Final Submission and Peer Review
In this final module, you will complete your submission of screenshots from the hands-on labs for your peers to review and provide URLs for your REST endpoints and GitHub repo links so your peers can review your code. Once you have completed your submission, you will review and grade one of your peers' submissions.