Пример #1
0
def integration(ctx, configfile, dry_run, log_level):
    ctx.ensure_object(dict)

    init_log_level(log_level)
    config.init_from_toml(configfile)
    gql.init_from_config()
    ctx.obj['dry_run'] = dry_run
Пример #2
0
def test(ctx, configfile, log_level):
    ctx.ensure_object(dict)

    level = getattr(logging, log_level) if log_level else logging.INFO
    logging.basicConfig(format='%(levelname)s: %(message)s', level=level)

    config.init_from_toml(configfile)

    gql.init_from_config()
Пример #3
0
def integration(ctx, configfile, dry_run, validate_schemas, dump_schemas_file,
                log_level, gql_sha_url):
    ctx.ensure_object(dict)

    init_log_level(log_level)
    config.init_from_toml(configfile)
    ctx.obj['dry_run'] = dry_run
    ctx.obj['validate_schemas'] = validate_schemas
    ctx.obj['gql_sha_url'] = gql_sha_url
    ctx.obj['dump_schemas_file'] = dump_schemas_file
def main(configfile, dry_run, log_level, gitlab_project_id, reports_path):
    config.init_from_toml(configfile)
    init_log_level(log_level)
    config.init_from_toml(configfile)
    gql.init_from_config()

    now = datetime.now()
    apps = get_apps_data(now)

    reports = [Report(app, now).to_message() for app in apps]

    for report in reports:
        logging.info(['create_report', report['file_path']])

        if reports_path:
            report_file = os.path.join(reports_path, report['file_path'])

            try:
                os.makedirs(os.path.dirname(report_file))
            except FileExistsError:
                pass

            with open(report_file, 'w') as f:
                f.write(report['content'])

    if not dry_run:
        email_body = """\
            Hello,

            A new report by the App SRE team is now available at:
            https://visual-app-interface.devshift.net/reports

            You can use the Search bar to search by App.

            You can also view reports per service here:
            https://visual-app-interface.devshift.net/services


            Having problems? Ping us on #sd-app-sre on Slack!


            You are receiving this message because you are a member
            of app-interface or subscribed to a mailing list specified
            as owning a service being run by the App SRE team:
            https://gitlab.cee.redhat.com/service/app-interface
            """

        mr_cli = mr_client_gateway.init(gitlab_project_id=gitlab_project_id,
                                        sqs_or_gitlab='gitlab')
        mr = CreateAppInterfaceReporter(reports=reports,
                                        email_body=textwrap.dedent(email_body),
                                        reports_path=reports_path)
        result = mr.submit(cli=mr_cli)
        logging.info(['created_mr', result.web_url])
 def setup_method(self, method):
     config.init_from_toml(fxt.path('config.toml'))
     gql.init_from_config(sha_url=False)
Пример #6
0
def root(ctx, configfile):
    ctx.ensure_object(dict)
    config.init_from_toml(configfile)
    gql.init_from_config()