コード例 #1
0
    def get(self):
        """The get handler method is called from a cron job.

    It expects no parameters and has no output. It checks all current bisect try
    jobs and send comments to an issue on the issue tracker if a bisect job has
    completed.
    """
        credentials = rietveld_service.Credentials(
            rietveld_service.GetDefaultRietveldConfig(),
            rietveld_service.PROJECTHOSTING_SCOPE)
        issue_tracker = issue_tracker_service.IssueTrackerService(
            additional_credentials=credentials)

        jobs_to_check = try_job.TryJob.query(
            try_job.TryJob.status == 'started').fetch()
        for job in jobs_to_check:
            try:
                if job.use_buildbucket:
                    logging.info('Checking job %s with Buildbucket job ID %s.',
                                 job.key.id(),
                                 getattr(job, 'buildbucket_job_id', None))
                else:
                    logging.info('Checking job %s with Rietveld issue ID %s.',
                                 job.key.id(),
                                 getattr(job, 'rietveld_issue_id', None))
                _CheckJob(job, issue_tracker)
            except Exception as e:  # pylint: disable=broad-except
                logging.error('Caught Exception %s: %s', type(e).__name__, e)
コード例 #2
0
def _IssueURL(job):
  """Returns a URL for information about a bisect try job."""
  if job.use_buildbucket:
    hostname = app_identity.get_default_version_hostname()
    job_id = job.buildbucket_job_id
    return 'https://%s/buildbucket_job_status/%s' % (hostname, job_id)
  else:
    config = rietveld_service.GetDefaultRietveldConfig()
    host = (config.internal_server_url if job.internal_only else
            config.server_url)
    return '%s/%d' % (host, job.rietveld_issue_id)
コード例 #3
0
  def _CommentOnRecoveredBug(cls, bug_id):
    """Adds a comment and close the bug on Issue tracker."""
    bug = ndb.Key('Bug', bug_id).get()
    if bug.status != bug_data.BUG_STATUS_OPENED:
      return
    bug.status = bug_data.BUG_STATUS_RECOVERED
    bug.put()
    comment = cls._RecoveredBugComment(bug_id)

    credentials = rietveld_service.Credentials(
        rietveld_service.GetDefaultRietveldConfig(),
        rietveld_service.PROJECTHOSTING_SCOPE)
    issue_tracker = issue_tracker_service.IssueTrackerService(
        additional_credentials=credentials)
    issue_tracker.AddBugComment(bug_id, comment)
コード例 #4
0
    def get(self):
        """The get handler method is called from a cron job.

    It expects no parameters and has no output. It checks all current bisect try
    jobs and send comments to an issue on the issue tracker if a bisect job has
    completed.
    """
        credentials = rietveld_service.Credentials(
            rietveld_service.GetDefaultRietveldConfig(),
            rietveld_service.PROJECTHOSTING_SCOPE)
        issue_tracker = issue_tracker_service.IssueTrackerService(
            additional_credentials=credentials)

        # Set privilege so we can also fetch internal try_job entities.
        datastore_hooks.SetPrivilegedRequest()

        jobs_to_check = try_job.TryJob.query(
            try_job.TryJob.status == 'started').fetch()
        all_successful = True
        for job in jobs_to_check:
            try:
                if job.use_buildbucket:
                    logging.info('Checking job %s with Buildbucket job ID %s.',
                                 job.key.id(),
                                 getattr(job, 'buildbucket_job_id', None))
                else:
                    logging.info('Checking job %s with Rietveld issue ID %s.',
                                 job.key.id(),
                                 getattr(job, 'rietveld_issue_id', None))
                _CheckJob(job, issue_tracker)
            except Exception as e:  # pylint: disable=broad-except
                logging.error('Caught Exception %s: %s\n%s',
                              type(e).__name__, e, traceback.format_exc())
                all_successful = False
        if all_successful:
            utils.TickMonitoringCustomMetric('UpdateBugWithResults')
コード例 #5
0
def _RietveldIssueURL(job):
    config = rietveld_service.GetDefaultRietveldConfig()
    host = config.internal_server_url if job.internal_only else config.server_url
    return '%s/%d' % (host, job.rietveld_issue_id)