====
This project is about the design and development of a CI/CD pipeline setup tool that can be used for web API development and deployment on OpenShift. This repository contains the example application of a URL shorterner that we used to test the pipeline. The pipeline setup tool is at https://github.com/yanchen01/cicd-cli.
- Repository on GitHub where API development will take place
- GitHub personal access token with repo level access (instructions here)
- OpenShift instance with server URL and login token
If building pipeline tool from source
- Node.JS
- Clone pipeline setup tool repo and build the tool (requires Node and npm).
npm installto build the applicationnpm linkto add the tool to your $PATH
- Download the precompiled binary for your operating system from the Releases page
- Add the program to the path or copy it into your API's repository (you might want to add to
.gitignore)
cicd setup- Sets up necessary workflow files (Refer to Workflow Files section below)
cicd config- Configure repo name, access tokens, deployment targets
- Commit and push the workflow files to your repo
- The pipeline is ready
- Edit code on a feature branch
- Make a pull request into master
- Pipeline workflows will trigger and run tests
- Manually approve the pull request
- Pipeline will deploy to OpenShift if all tests passed
- Install virtual env on your local machine
- Windows User: python -m venv env
- Mac User: python3 -m venv env
- Enable virtual env
- Windows User: source venv_pc
- Mac User: source venv_unix
- Install dependencies
- Windows User: pip install -r requirements.txt
- Mac User: pip3 install -r requirements.txt
- Run Flask App
- Windows User: python app.py
- Mac User: python3 app.py
- OR run Flask App via Docker Container (docker installed)
- docker build -t flaskapp:latest .
- docker run -it -p 5000:5000 flaskapp
- Optional: docker run -it -d -p 5000:5000 flaskapp (automatically runs in background)
- Flask app runs on http://localhost:5000/
Any of these workflows files/jobs can be manipulated for personalization. Check out more about editing the workflow files here:
https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions
The GitHub actions marketplace has bunch of third party GitHub actions you can add to your workflows:
https://github.com/marketplace?type=actions
-
ci.yml (Triggers on any pull_request)
-
Formatting (User choice of autoyapf PEP-8 style or Black style)
- Changes are automatically pushed to the current branch
-
Unit Test (PyTest)
- Fails if test coverage is under 90%
-
Test Deploy to OpenShift
-
Creates a build config of the name of the current branch
Any necessary integration tests such as Selenium on the OpenShift pipeline should occur here
-
-
Wait for One Hour for Integration Tests on OpenShift
- Pauses for one hour before deleting the testing environment. Run tests on OpenShift during this action
-
Cleaning up OpenShift
- Deletes any config, builds and pods related to the test deploy in step 3
-
cd.yml (Triggers on push to the master branch)
- Deploying Production to OpenShift
- If a build with the name of the repository exists, roll out the changes to that build
- Else, create a build config with the name of the repository and deploy the master branch to OpenShift
- Deploying Production to OpenShift
-
- Final Project Video and Slides
- Project Poster
- Sprint 5 Video and Slides
- Sprint 4 Slides
- Sprint 3 Slides
- Sprint 2 Slides
- Edge Computing Presentation
- Project Description The original proposal by the mentors
- Proposal Our project proposal with preliminary architecture overviews
- Competitor Research
- Final Video