示例#1
0
文件: cli.py 项目: alex/services
# 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 __future__ import absolute_import

from backend_common import log
import taskcluster

logger = log.get_logger()


def taskcluster_cache(
    namespace='gecko.v2',
    decision_task_namespace='latest.firefox.decision',
):
    """ TODO: add description
    """

    logger.info('Querying taskcluster for list of branches in "%s" '
                'namespace.' % namespace)

    # taskcluster api's we need to query
    index = taskcluster.Index()
    queue = taskcluster.Queue()

    branches = dict()
    for branch in index.listNamespaces(namespace, dict(limit=1000))\
                       .get('namespaces', []):

        branch_name = branch.get('name')
示例#2
0
import pickle
from flask import abort, request
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.exc import IntegrityError
from backend_common.auth import auth
from backend_common.db import db
from backend_common import log
from shipit_uplift.helpers import gravatar
from shipit_uplift.models import (BugAnalysis, BugResult, Contributor,
                                  BugContributor, PatchStatus)
from shipit_uplift.serializers import (serialize_analysis, serialize_bug,
                                       serialize_contributor,
                                       serialize_patch_status)
from shipit_uplift import SCOPES_USER, SCOPES_BOT, SCOPES_ADMIN

logger = log.get_logger('shipit_uplift.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
    """
示例#3
0
# 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_uplift.models import (BugResult, BugContributor, BugAnalysis,
                                  Contributor, PatchStatus)
from shipit_uplift import SCOPES_ADMIN
from flask_login import current_user
from backend_common import log
import html

logger = log.get_logger('shipit_uplift.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 ''
示例#4
0
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from __future__ import absolute_import

import pickle

from flask import abort, request
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.exc import IntegrityError
from backend_common import log
from backend_common.auth0 import auth0
from backend_common.db import db

from shipit_signoff.models import SignoffStep, SigningStatus, Signature

logger = log.get_logger('shipit_signoffs.api')

# provided by https://auth.mozilla.auth0.com/.well-known/openid-configuration
AUTH0_FIELDS = [
    "openid",
    "profile",
    "offline_access",
    "name",
    "given_name",
    "family_name",
    "nickname",
    "email",
    "email_verified",
    "picture",
    "created_at",
    "identities",