How to use the libmozdata.phabricator.BuildState function in libmozdata

To help you get started, we’ve selected a few libmozdata 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 mozilla / code-review / bot / code_review_bot / workflow.py View on Github external
def update_status(self, revision, state):
        """
        Update build status on HarborMaster
        """
        assert isinstance(state, BuildState)
        if not revision.build_target_phid:
            logger.info(
                "No build target found, skipping HarborMaster update", state=state.value
            )
            return

        if not self.update_build:
            logger.info(
                "Update build disabled, skipping HarborMaster update", state=state.value
            )
            return

        self.phabricator.update_build_target(revision.build_target_phid, state)
        logger.info("Updated HarborMaster status", state=state, revision=revision)
github mozilla / code-review / bot / code_review_bot / workflow.py View on Github external
def update_status(self, revision, state):
        """
        Update build status on HarborMaster
        """
        assert isinstance(state, BuildState)
        if not revision.build_target_phid:
            logger.info(
                "No build target found, skipping HarborMaster update", state=state.value
            )
            return

        if not self.update_build:
            logger.info(
                "Update build disabled, skipping HarborMaster update", state=state.value
            )
            return

        self.phabricator.update_build_target(revision.build_target_phid, state)
        logger.info("Updated HarborMaster status", state=state, revision=revision)
github mozilla / code-review / bot / code_review_bot / workflow.py View on Github external
def run(self, revision):
        """
        Find all issues on remote tasks and publish them
        """
        # Index ASAP Taskcluster task for this revision
        self.index(revision, state="started")

        # Set the Phabricator build as running
        self.update_status(revision, state=BuildState.Work)

        # Analyze revision patch to get files/lines data
        revision.analyze_patch()

        # Find issues on remote tasks
        issues, task_failures = self.find_issues(revision, settings.try_group_id)
        if not issues and not task_failures:
            logger.info("No issues, stopping there.")
            self.index(revision, state="done", issues=0)
            self.update_status(revision, BuildState.Pass)
            return []

        # Publish issues on backend to retrieve their comparison state
        self.backend_api.publish_issues(issues, revision)

        # Publish all issues
github mozilla / code-review / bot / code_review_bot / workflow.py View on Github external
def run(self, revision):
        """
        Find all issues on remote tasks and publish them
        """
        # Index ASAP Taskcluster task for this revision
        self.index(revision, state="started")

        # Set the Phabricator build as running
        self.update_status(revision, state=BuildState.Work)

        # Analyze revision patch to get files/lines data
        revision.analyze_patch()

        # Find issues on remote tasks
        issues, task_failures = self.find_issues(revision, settings.try_group_id)
        if not issues and not task_failures:
            logger.info("No issues, stopping there.")
            self.index(revision, state="done", issues=0)
            self.update_status(revision, BuildState.Pass)
            return []

        # Publish issues on backend to retrieve their comparison state
        self.backend_api.publish_issues(issues, revision)

        # Publish all issues
github mozilla / code-review / bot / code_review_bot / report / phabricator.py View on Github external
def publish_harbormaster(
        self, revision, lint_issues: Issues = [], unit_issues: Issues = []
    ):
        """
        Publish issues through HarborMaster
        either as lint results or unit tests results
        """
        assert lint_issues or unit_issues, "No issues to publish"

        self.api.update_build_target(
            revision.build_target_phid,
            state=BuildState.Work,
            lint=[issue.as_phabricator_lint() for issue in lint_issues],
            unit=[issue.as_phabricator_unitresult() for issue in unit_issues],
        )
        logger.info(
            "Updated Harbormaster build state with issues",
            nb_lint=len(lint_issues),
            nb_unit=len(unit_issues),
        )