How to use the zuul.reporter.gerrit.GerritReporter function in zuul

To help you get started, we’ve selected a few zuul examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wikimedia / integration-config / tests / test_zuul_scheduler.py View on Github external
def test_pipelines_have_report_action_to_gerrit(self):
        not_reporting = ['post', 'publish', 'codehealth']
        required_actions = ['success', 'failure']
        reporting_pipelines = [
            p for p in self.getPipelines()
            if p.name not in not_reporting]

        for pipeline in reporting_pipelines:
            for action in required_actions:
                reporters = pipeline.__getattribute__(action + '_actions')
                self.assertTrue(
                    # At least one reporter is to Gerrit
                    any([isinstance(reporter, GerritReporter)
                         for reporter in reporters]
                        ),
                    'Pipeline %s must have a GerritReporter on %s got %s' % (
                        pipeline.name, action, reporters)
                )
github wikimedia / integration-config / tests / test_zuul_scheduler.py View on Github external
def test_postmerge_gerrit_review_command(self):
        pipe = self.getPipeline('postmerge')
        # Pick the first Gerrit success reporter
        gerrit_reporter = [r for r in pipe.success_actions
                           if isinstance(r, GerritReporter)][0]

        # There is no verified/code-review configured:
        self.assertEquals(
            {'tag': 'autogenerated:ci'},
            gerrit_reporter.reporter_config)

        gerrit = GerritConnection('fake_gerrit',
                                  {'server': 'localhost', 'user': 'john'})
        # Fake ssh (stdout, stderr) so the command is returned by review()
        gerrit._ssh = lambda x: ['', x]
        cmd = gerrit.review('some/project', '12345,42', 'hello world',
                            gerrit_reporter.reporter_config)
        self.longMessage = True
        self.assertEquals(
            'gerrit review --project some/project '
            '--message "hello world" --tag autogenerated:ci 12345,42',