Exemple #1
0
 def _issue_build_request(self, snap: Entry) -> Entry:
     dist = self._lp.distributions["ubuntu"]
     archive = dist.main_archive
     return snap.requestBuilds(
         archive=archive,
         pocket="Updates",
     )
Exemple #2
0
    def _wait_for_build_request_acceptance(
        self, build_request: Entry, timeout=30
    ) -> None:
        # Not be be confused with the actual build(s), this is
        # ensuring that Launchpad accepts the build request.

        while timeout > 0 and build_request.status == "Pending":
            logger.debug("Waiting on Launchpad build request...")
            logger.debug(
                f"status={build_request.status} error={build_request.error_message}"
            )
            time.sleep(1)

            # Refresh status.
            build_request.lp_refresh()
            timeout -= 1

        if build_request.status == "Failed":
            # Build request failed.
            self.cleanup()
            raise errors.RemoteBuilderError(builder_error=build_request.error_message)
        elif build_request.status == "Pending":
            # Timed out.
            self.cleanup()
            raise errors.RemoteBuilderNotReadyError()
        elif build_request.status != "Completed":
            # Shouldn't end up here.
            self.cleanup()
            raise errors.RemoteBuilderError(
                builder_error="Unknown builder error - reported status: {}".format(
                    build_request.status
                )
            )
        elif not build_request.builds.entries:
            # Shouldn't end up here either.
            self.cleanup()
            raise errors.RemoteBuilderError(
                builder_error="Unknown builder error - no build entries found."
            )

        build_number = _get_url_basename(build_request.self_link)
        logger.debug(f"Build request accepted: {build_number}")
Exemple #3
0
 def _issue_build_request(self, snap: Entry) -> Entry:
     dist = self._lp.distributions["ubuntu"]
     archive = dist.main_archive
     return snap.requestBuilds(
         archive=archive,
         channels={
             "core18": self._core18_channel,
             "snapcraft": self._snapcraft_channel,
         },
         pocket="Updates",
     )