This project was created for the DevWeek Jan 2024 hands-on CI/CD session. It features a Python application with external dependencies, demonstrating dependency management and CI/CD tool integration. The primary components are web_scraper.py and calculator_cli.py, showcasing practical examples of CI/CD pipelines in Python development.
To get started, ensure you have the following tools and accounts:
- Git (preferably with BitBucket)
- Gitflow workflow methodology
- Jenkins for Continuous Integration (CI)
- Poetry for dependency management
- Docker for containerization
- Clone the Repository:
git clone [repository URL]- Set up the Python Environment:
poetry shell- Install Dependencies:
poetry install- To run the web scraper:
poetry run python cicd_intro/web_scraper.py- To use the calculator CLI:
poetry run python cicd_intro/calculator_cli.py- Code Checkout:
- Automated via Jenkins on every push.
- Environment Setup and Dependency Installation:
- Automated environment setup and dependency installation using Poetry.
- Code Quality and Linting:
- Code linting with flake8 integrated into the CI pipeline.
- Unit Testing:
- Automated testing using
pytest, with results reported in the pipeline.
The steps include deployment to AWS CodeArtifact and Docker containerization.
The CI steps for calculator_cli.py are similar to those for web_scraper.py. These include:
- Code Checkout:
- Automated via Jenkins on every push.
- Environment Setup and Dependency Installation:
- Automated environment setup and dependency installation using Poetry.
- Code Quality and Linting:
- Code linting with flake8 integrated into the CI pipeline.
- Unit Testing:
- Automated testing using
pytest, with results reported in the pipeline.
- Automated testing using
For calculator_cli.py, the CD process involves containerizing the application using Docker. The steps include:
- Build Docker Image:
- A Docker image is created based on the instructions defined in the
Dockerfile.
- A Docker image is created based on the instructions defined in the
- Push to Docker Registry:
- The Docker image is then pushed to a Docker registry (AWS ECR).
- Deploy Docker Container:
- The latest Docker image is pulled from the registry and deployed to the appropriate environment.
(Include common issues and their solutions here.)