Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use glueops helpers #23

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM python:3.11.6-alpine3.18

RUN pip install --upgrade pip

COPY requirements.txt /app/requirements.txt
WORKDIR /app
RUN pip install -r requirements.txt
Expand Down
25 changes: 5 additions & 20 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,17 @@
import logging
import os
import time

import requests
from glueops.setup_logging import configure as go_configure_logging
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just been fully qualifying the reference in my code instead of using an alias

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya, it's basically the same

from kubernetes import client, config

from src.get_github_api_token import get_github_api_token
from src.json_log_formatter import JsonFormatter

#=== configure logging
# json formatter
json_formatter = JsonFormatter()

# stream handler
stream_handler = logging.StreamHandler()
stream_handler.setFormatter(json_formatter)
stream_handler.setLevel(os.getenv(
'PYTHON_LOG_LEVEL',
'INFO'
))

# configure logger
logger = logging.getLogger('PULL_REQUEST_BOT')
logger.setLevel(os.getenv(
'PYTHON_LOG_LEVEL',
'INFO'
))
logger.addHandler(stream_handler)
logger = go_configure_logging(
name='PULL_REQUEST_BOT',
level=os.getenv('PYTHON_LOG_LEVEL', 'INFO')
)

# setting cluster config
try:
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
jwt==1.3.1
kubernetes==27.2.0
requests==2.31.0
requests==2.31.0
glueops-helpers @ https://github.com/GlueOps/python-glueops-helpers-library/archive/refs/tags/v0.2.0.zip
17 changes: 0 additions & 17 deletions src/json_log_formatter.py

This file was deleted.