def get_flask_application(): configure_sentry( runner_type="packit-service", celery_integration=True, sqlalchemy_integration=True, flask_integration=True, ) app = Flask(__name__) app.register_blueprint(blueprint) app.register_blueprint(builds_blueprint) s = ServiceConfig.get_service_config() # https://flask.palletsprojects.com/en/1.1.x/config/#SERVER_NAME # also needs to contain port if it's not 443 app.config["SERVER_NAME"] = s.server_name app.config["PREFERRED_URL_SCHEME"] = "https" if getenv("DEPLOYMENT") in ("dev", "stg"): app.config["DEBUG"] = True app.logger.setLevel(logging.DEBUG) logger = logging.getLogger("packit_service") logger.info( f"server name = {s.server_name}, all HTTP requests need to use this URL!" ) log_service_versions() # no need to thank me, just buy me a beer logger.debug(f"URL map = {app.url_map}") return app
def get_flask_application(): # Sentry does not work in the service for now # SENTRY_SECRET is not passed to the service pod or container # https://github.com/packit-service/deployment/blob/master/openshift/packit-service.yml.j2 # configure_sentry( # runner_type="packit-service", # celery_integration=True, # sqlalchemy_integration=True, # flask_integration=True, # ) app = Flask(__name__) app.register_blueprint(blueprint) app.register_blueprint(builds_blueprint) s = ServiceConfig.get_service_config() # https://flask.palletsprojects.com/en/1.1.x/config/#SERVER_NAME # also needs to contain port if it's not 443 app.config["SERVER_NAME"] = s.server_name app.config["PREFERRED_URL_SCHEME"] = "https" if getenv("DEPLOYMENT") in ("dev", "stg"): app.config["DEBUG"] = True app.logger.setLevel(logging.DEBUG) logger = logging.getLogger("packit_service") logger.info( f"server name = {s.server_name}, all HTTP requests need to use this URL!" ) log_service_versions() # no need to thank me, just buy me a beer logger.debug(f"URL map = {app.url_map}") return app
def get_srpm_build_logs_by_id(id_): log_service_versions() srpm_build = SRPMBuildModel.get_by_id(id_) if srpm_build: response = ("<html><head>" f"<title>SRPM Build id={id_}</title></head><body>" "SRPM creation logs:<br><br>" f"<pre>{srpm_build.logs}</pre>" "<br></body></html>") return response return f"We can't find any info about SRPM build {id_}.\n"
def copr_build_info(id_): log_service_versions() build = CoprBuildModel.get_by_id(id_) if build: return _get_build_info(build, build_description="Copr build") return f"We can't find any info about Copr build {id_}.\n", 404
def get_srpm_build_logs_by_id(id_): log_service_versions() srpm_build = SRPMBuildModel.get_by_id(id_) if srpm_build: return render_template("srpm_logs.html", id=id_, srpm_build=srpm_build) return f"We can't find any info about SRPM build {id_}.\n", 404
def koji_build_info(id_): log_service_versions() build = KojiBuildModel.get_by_id(id_) if build: return _get_build_info(build, build_description="Koji build") return f"We can't find any info about Koji build {id_}.\n", 404
def get_build_logs_by_id(id_): log_service_versions() build = CoprBuildModel.get_by_id(id_) if build: return _get_build_logs_for_build(build) return f"We can't find any info about COPR build {id_}.\n"