Skip to main content

No project description provided

Project description

T4-CICD Project

Project to build a CI/CD System.

User Set Up Instruction for Using the Application

This cli application requires a MongoDB service, a Docker Engine service, and an AWS S3 Service.

Setting up the Docker Engine Service

The cli application will automatically use any Docker Engine running in your computer background. You can install one following instructions from the Official

Setting up the MongoDB Service

You can use a local or remote MongoDB Service. You will need to save the URL to the MongoDB service into a .env file in your project folder, or in your environment variable. Example below shows the MONGO_DB_URL set up for local and remote MongoDB service.

# Local
MONGO_DB_URL="mongodb://localhost:27017/"

# Remote, replace the <db_username>, <db_password> and <cluster_address>
MONGO_DB_URL="mongodb+srv://<db_username>:<db_password>@<cluster_address>/"

Instructions for setting up local MongoDB service. Download the MongoDB Community Server from https://www.mongodb.com/try/download/community-kubernetes-operator

Follow the instructions for self-managed deployments https://www.mongodb.com/docs/manual/administration/install-community/

To view the database, use MongoDB Compass (came together with MongoDB installation)

Setting up the AWS S3 Service

S3 bucket names must be globally unique across all AWS accounts. In order for Upload Artifact feature to work, developer needs to specify a unique name in their configuration file artifact_upload_path: "<UNIQUE_BUCKET_NAME>".

global:
  pipeline_name: "cicd_pipeline"
  docker: #...
  artifact_upload_path: <UNIQUE_BUCKET_NAME>

You need to copy and paste the following AWS credentials into ~/.aws/credentials file. The credentials you provided must be able to create a bucket and upload into S3.

aws_access_key_id=<your_id>
aws_secret_access_key=<your_secret_access_key>
aws_session_token=<your_session_token> #if applicable

You also need to set up the target region in your .env file or set it as environment variable.

DEFAULT_S3_LOC=<AWS_REGION>
# example set to us-west-2
DEFAULT_S3_LOC='us-west-2'

Installation Instruction from Project GitHub Folder

Reference for Poetry and Click here

Prerequisite:

  1. Installed Python 3.12 from official website
  2. Installed pipx and poetry
# Install pipx
python -m pip install --user pipx
python -m pipx ensurepath

# Then go to your environment variable on windows/OS, check the path added and
# update lowercase to uppercase if necessary
# restart your window/OS.

# installation of poetry using pipx
pipx install poetry
  1. Activated Virtual Environment
# navigate to the project directory
# First create your virtual environment using venv,
# Give it a name like myenv, if you use other name, add it to the .gitignore file
# venv come with standard python package
python -m venv myenv

# Activate your virtual environment. For bash terminal
source <your_venv_dir>/Scripts/activate

# Example when you name venv as myenv
# for Windows
source myenv/Scripts/activate
# for Mac / Unix
source myenv/bin/activate

The alternative way to activate the virtual environment is to run poetry shell. This is less recommended as the downside of this approach is any command not starting with poetry will run using your background environment package instead from the virtual environment.

poetry shell

Installation, Lint & Test

# This will install all dependencies, and the project itself into your venv
poetry install

# Run pylint for src directory, --fail-under score to be 10
poetry run pylint ./src --fail-under=10

# Run pytest with coverage, note current passing coverage score is set at 50%
poetry run pytest

# to test if you can run the command
poetry run cid pipeline

Development - Managing Dependencies

Reference for dependencies management.

Remember to check the pyproject.toml file to ensure the dependency is added/removed

# Adding new dependency for general
poetry add <dependency/lib/package>

# Adding new dependency for development environment only
poetry add <dependency/lib/package> --group dev

# Remove dependencies
poetry remove <dependency/lib/package>
# Remove dependencies from development environment
poetry remove <dependency/lib/package> --group dev

Development - Using Logging

Steps:

  • Get logger from util.common_utils get_logger() function
  • supplied arguments if required
  • By Default a debug.log file will be created at a parent directory where your run the command, you can change its location. ie, if you run the command under directory /temp/t4-cicd, a debug.log will be at /temp

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

t4_cicd-0.1.0.tar.gz (49.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

t4_cicd-0.1.0-py3-none-any.whl (54.1 kB view details)

Uploaded Python 3

File details

Details for the file t4_cicd-0.1.0.tar.gz.

File metadata

  • Download URL: t4_cicd-0.1.0.tar.gz
  • Upload date:
  • Size: 49.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for t4_cicd-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d580c296043ca4a702926220aed26f072e44d0bc4e6ccc1a734c67a1545ecb0c
MD5 f101aa6b8b2b3736ef9cd637995d82b2
BLAKE2b-256 76bf79c18041fe9b880ce1be6d1ea4b313205c0831e4bffc56a60c92c7cc4862

See more details on using hashes here.

File details

Details for the file t4_cicd-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: t4_cicd-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 54.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for t4_cicd-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9f5191f28adf1a38f7a9903ab2e8b655421f786a7bd4d1005d784db87464fce3
MD5 78689ec381e52a9d7aaff6548e891a1b
BLAKE2b-256 e88406af43b0ac34965ecdaa3254929e6af47d63c4f1b7806959f81cc33a2a3d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page