Skip to content

Commit

Permalink
add get_logtext endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
GeneMyslinsky committed Sep 23, 2023
1 parent f09be17 commit 39c0f0e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ujenkins/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,7 @@ def _validate_retry_argument(retry: dict) -> None:
@staticmethod
def _return_text(response: Response) -> str:
return response.text

@staticmethod
def _return_response(response: Response) -> str:
return response.text, response.headers
11 changes: 11 additions & 0 deletions ujenkins/endpoints/builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,17 @@ def get_info(self, name: str, build_id: Union[int, str]) -> dict:
f'/{folder_name}/job/{job_name}/{build_id}/api/json'
)

def get_output_logtext(self, name: str, build_id: Union[int, str], start=0) -> str:

folder_name, job_name = self.jenkins._get_folder_and_job_name(name)
return self.jenkins._request(
'POST',
f'/{folder_name}/job/{job_name}/{build_id}/logText/progressiveText',
headers={"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"},
data={'start': start},
_callback=self.jenkins._return_response,
)

def get_output(self, name: str, build_id: Union[int, str]) -> str:
"""
Get console output of specified build.
Expand Down

0 comments on commit 39c0f0e

Please sign in to comment.