Skip to content

awsactivators/python-app-cicd-deployment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DevWeek Jan 2024 CI/CD Session

Introduction

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.

Prerequisites

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

Project Setup

  1. Clone the Repository:
git clone [repository URL]
  1. Set up the Python Environment:
poetry shell
  1. Install Dependencies:
poetry install

Usage

  • 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

CI/CD Pipeline for web_scraper.py

Continuous Integration (CI)

  1. Code Checkout:
  • Automated via Jenkins on every push.
  1. Environment Setup and Dependency Installation:
  • Automated environment setup and dependency installation using Poetry.
  1. Code Quality and Linting:
  • Code linting with flake8 integrated into the CI pipeline.
  1. Unit Testing:
  • Automated testing using pytest, with results reported in the pipeline.

Continuous Deployment (CD)

The steps include deployment to AWS CodeArtifact and Docker containerization.

CI/CD Pipeline for calculator_cli.py

Continuous Integration (CI)

The CI steps for calculator_cli.py are similar to those for web_scraper.py. These include:

  1. Code Checkout:
    • Automated via Jenkins on every push.
  2. Environment Setup and Dependency Installation:
    • Automated environment setup and dependency installation using Poetry.
  3. Code Quality and Linting:
    • Code linting with flake8 integrated into the CI pipeline.
  4. Unit Testing:
    • Automated testing using pytest, with results reported in the pipeline.

Continuous Deployment (CD)

For calculator_cli.py, the CD process involves containerizing the application using Docker. The steps include:

  1. Build Docker Image:
    • A Docker image is created based on the instructions defined in the Dockerfile.
  2. Push to Docker Registry:
    • The Docker image is then pushed to a Docker registry (AWS ECR).
  3. Deploy Docker Container:
    • The latest Docker image is pulled from the registry and deployed to the appropriate environment.

Troubleshooting and FAQs

(Include common issues and their solutions here.)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors