コード例 #1
0
    def retry_build(cls, builder_id, build_number):
        if not (util.is_valid_id(builder_id)
                and util.is_valid_id(build_number)):
            return False

        build_url = 'https://{}/api/v2/builders/{}/builds/{}'.format(
            config.BUILDBOT_SERVER_HOST, builder_id, build_number)
        username = os.getenv('EWS_ADMIN_USERNAME')
        password = os.getenv('EWS_ADMIN_PASSWORD')
        session = requests.Session()
        response = session.head('https://{}/auth/login'.format(
            config.BUILDBOT_SERVER_HOST),
                                auth=(username, password))
        if (not response) or response.status_code not in (200, 302):
            _log.error(
                'Authentication to {} failed. Please check username/password.'.
                format(config.BUILDBOT_SERVER_HOST))
            return False

        json_data = {
            'method': 'rebuild',
            'id': 1,
            'jsonrpc': '2.0',
            'params': {
                'reason': 'retried-by-user'
            }
        }
        response = session.post(build_url, json=json_data)

        if response and response.status_code == 200:
            _log.info(
                'Successfuly submitted retry request for build: {}'.format(
                    build_url))
            return True

        _log.error('Failed to retry build: {}, http response code: {}'.format(
            build_url, response.status_code))
        return False
コード例 #2
0
    def _get_commit_queue_patches_from_bug(cls, bug_id):
        if not util.is_valid_id(bug_id):
            _log.warn('Invalid bug id: "{}"'.format(bug_id))
            return []

        bug_url = '{}rest/bug/{}/attachment'.format(config.BUG_SERVER_URL,
                                                    bug_id)
        bug = cls.fetch_data_from_bugzilla_with_authentication(bug_url)
        if not bug:
            return []
        bug_json = bug.json().get('bugs')
        if not bug_json or len(bug_json) == 0:
            return []

        commit_queue_patches = []
        for patch_json in bug_json.get(str(bug_id)):
            if cls._is_patch_cq_plus(patch_json) == 1:
                commit_queue_patches.append(patch_json.get('id'))

        return commit_queue_patches
コード例 #3
0
ファイル: bugzilla.py プロジェクト: fr0l/webkit
    def _get_commit_queue_patches_from_bug(cls, bug_id):
        if not util.is_valid_id(bug_id):
            _log.warn('Invalid bug id: "{}"'.format(bug_id))
            return []

        bug_url = '{}rest/bug/{}/attachment'.format(config.BUG_SERVER_URL, bug_id)
        api_key = os.getenv('BUGZILLA_API_KEY', None)
        if api_key:
            bug_url += '?api_key={}'.format(api_key)
        bug = util.fetch_data_from_url(bug_url)
        if not bug:
            return []
        bug_json = bug.json().get('bugs')
        if not bug_json or len(bug_json) == 0:
            return []

        commit_queue_patches = []
        for patch_json in bug_json.get(str(bug_id)):
            if cls._is_patch_cq_plus(patch_json) == 1:
                commit_queue_patches.append(patch_json.get('id'))

        return commit_queue_patches
コード例 #4
0
    def is_valid_result(cls, step_id, build_id, result, state_string, started_at, complete_at):
        if not (util.is_valid_id(step_id) and util.is_valid_id(build_id)):
            return False

        return True
コード例 #5
0
    def is_valid_result(cls, patch_id, build_id, builder_id, number, result, state_string, started_at, complete_at=None):
        if not (util.is_valid_id(patch_id) and util.is_valid_id(build_id) and util.is_valid_id(builder_id) and util.is_valid_id(number)):
            return False

        return True