from __future__ import with_statement from alembic import context from sqlalchemy import engine_from_config, pool from releng_common import log # this is the Alembic Config object, which provides # access to the values within the .ini file in use. config = context.config # Interpret the config file for Python structlog. # This line sets up loggers basically. logger = log.get_logger() # add your model's MetaData object here # for 'autogenerate' support # from myapp import mymodel # target_metadata = mymodel.Base.metadata from flask import current_app config.set_main_option('sqlalchemy.url', current_app.config.get('SQLALCHEMY_DATABASE_URI')) target_metadata = current_app.extensions['migrate'].db.metadata # other values from the config, defined by the needs of env.py, # can be acquired: # my_important_option = config.get_main_option("my_important_option") # ... etc. def run_migrations_offline(): """Run migrations in 'offline' mode.
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from shipit_dashboard.models import (BugResult, BugContributor, BugAnalysis, Contributor) from shipit_dashboard import SCOPES_ADMIN from flask_login import current_user from releng_common import log import html logger = log.get_logger('shipit_dashboard.serializers') def serialize_contributor(contributor, link=None): """ Helper to serialize a contributor & its role """ assert isinstance(contributor, Contributor) out = { 'id': contributor.id, 'email': contributor.email, 'name': contributor.name, 'avatar': contributor.avatar_url, 'karma': contributor.karma or 0, 'comment_public': contributor.comment_public or '', } if current_user.has_permissions(SCOPES_ADMIN): # Only admins can see/edit the private comment out['comment_private'] = contributor.comment_private or ''
import pickle from flask import abort, request from sqlalchemy.orm.exc import NoResultFound from sqlalchemy.exc import IntegrityError from releng_common.auth import auth from releng_common.db import db from releng_common import log from shipit_dashboard.helpers import gravatar from shipit_dashboard.models import (BugAnalysis, BugResult, Contributor, BugContributor, PatchStatus) from shipit_dashboard.serializers import (serialize_analysis, serialize_bug, serialize_contributor, serialize_patch_status) from shipit_dashboard import SCOPES_USER, SCOPES_BOT, SCOPES_ADMIN logger = log.get_logger('shipit_dashboard.api') def ping(): """ Test service availability """ logger.info('Got ping request. Sending pong...') return 'pong' @auth.require_scopes([SCOPES_USER, SCOPES_BOT]) def list_analysis(): """ List all available analysis """
import pickle import requests from flask import current_app from flask import json from flask.cli import with_appcontext from libmozdata import bugzilla from libmozdata.patchanalysis import bug_analysis, parse_uplift_comment from sqlalchemy.orm.exc import NoResultFound from releng_common.db import db from shipit_dashboard.encoder import ShipitJSONEncoder from shipit_dashboard.helpers import compute_dict_hash from shipit_dashboard.models import BugAnalysis, BugResult logger = log.get_logger('shipit_dashboard.workflow') class BugSync(object): """ Helper class to sync bugs between Bugzilla & remote server """ def __init__(self, bugzilla_id): self.bugzilla_id = bugzilla_id self.on_remote = [] self.on_bugzilla = [] self.raw = None class Workflow(object):
import requests from flask import current_app from flask import json from flask.cli import with_appcontext from libmozdata import bugzilla from libmozdata.patchanalysis import bug_analysis, parse_uplift_comment from sqlalchemy.orm.exc import NoResultFound from releng_common.db import db from shipit_dashboard.encoder import ShipitJSONEncoder from shipit_dashboard.helpers import compute_dict_hash from shipit_dashboard.models import BugAnalysis, BugResult logger = log.get_logger('shipit_dashboard.workflow') class BugSync(object): """ Helper class to sync bugs between Bugzilla & remote server """ def __init__(self, bugzilla_id): self.bugzilla_id = bugzilla_id self.on_remote = [] self.on_bugzilla = [] self.raw = None class Workflow(object):