def packit_base(ctx, debug, fas_user, keytab): """Integrate upstream open source projects into Fedora operating system.""" c = Config.get_service_config() c.debug = debug or c.debug c.fas_user = fas_user or c.fas_user c.keytab_path = keytab or c.keytab_path ctx.obj = c if ctx.obj.debug: set_logging(level=logging.DEBUG) logger.debug("logging set to DEBUG") else: set_logging(level=logging.INFO) logger.debug("logging set to INFO")
def get_testing_farm_check() -> str: config = Config.get_service_config() if config.deployment == Deployment.prod: return PACKIT_PROD_TESTING_FARM_CHECK return PACKIT_STG_TESTING_FARM_CHECK
def get_build_check() -> str: config = Config.get_service_config() if config.deployment == Deployment.prod: return PACKIT_PROD_CHECK return PACKIT_STG_CHECK
def config(self): if self._config is None: self._config = Config.get_service_config() return self._config
from flask import Flask, abort, request, jsonify from packit.utils import set_logging from packit_service.celerizer import celery_app from packit_service.config import Config class PackitWebhookReceiver(Flask): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) set_logging(level=logging.DEBUG) app = PackitWebhookReceiver(__name__) config = Config.get_service_config() logger = logging.getLogger("packit_service") @app.route("/healthz", methods=["GET", "HEAD", "POST"]) def get_health(): # TODO: add some interesting stats here return jsonify({"msg": "We are healthy!"}) @app.route("/webhooks/github", methods=["POST"]) def github_webhook(): msg = request.get_json() if not msg: logger.debug("/webhooks/github: we haven't received any JSON data.")