def build(self, scratch: bool = False): cmd = [self.fedpkg_exec, "build", "--nowait"] if scratch: cmd.append("--scratch") out = run_command( cmd=cmd, cwd=self.directory, error_message="Submission of build to koji failed.", fail=True, output=True, ) logger.info("%s", out)
def init_ticket(self, keytab: str = None): # TODO: this method has nothing to do with fedpkg, pull it out if not self.fas_username or not keytab or not Path(keytab).is_file(): logger.info("won't be doing kinit, no credentials provided") return cmd = [ "kinit", f"{self.fas_username}@FEDORAPROJECT.ORG", "-k", "-t", keytab, ] return utils.run_command_remote( cmd=cmd, error_message="Failed to init kerberos ticket:", fail=True )
def build( self, scratch: bool = False, nowait: bool = False, koji_target: Optional[str] = None, srpm_path: Optional[Path] = None, ): """ build in koji :param scratch: scratch (temporary) build or not? :param nowait: False == wait for the build to finish :param koji_target: koji target to build in (`koji list-targets`) :param srpm_path: use selected SRPM for build, not dist-git repo & ref :return: """ cmd = [self.fedpkg_exec, "build"] if scratch: cmd.append("--scratch") if nowait: cmd.append("--nowait") if koji_target: cmd += ["--target", koji_target] if srpm_path: cmd += ["--srpm", str(srpm_path)] try: utils.run_command_remote( cmd=cmd, cwd=self.directory, error_message="Submission of build to koji failed.", fail=True, ) except PackitCommandFailedError as ex: # fail on the fedpkg side, the build is triggered if ( "watch_tasks() got an unexpected keyword argument 'ki_handler'" in ex.stderr_output ): logger.info( "The 'fedpkg build' command crashed which is a known issue: " "the build is submitted in koji anyway." ) logger.debug(ex.stdout_output) else: raise
def init_ticket(self, keytab: str = None): # TODO: this method has nothing to do with fedpkg, pull it out if not keytab: logger.info("won't be doing kinit, no credentials provided") return if keytab and Path(keytab).is_file(): cmd = [ "kinit", f"{self.fas_username}@FEDORAPROJECT.ORG", "-k", "-t", keytab, ] else: # there is no keytab, but user still might have active ticket - try to renew it cmd = ["kinit", "-R", f"{self.fas_username}@FEDORAPROJECT.ORG"] return run_command(cmd=cmd, error_message="Failed to init kerberos ticket:", fail=True)