Skip to content

Commit f509a7f

Browse files
author
Eero Aaltonen
committed
feat: add method to get build runs of build name
1 parent 5eea273 commit f509a7f

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

pyartifactory/models/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class BuildRun(BaseModel):
4848
"""Models artifactory build runs."""
4949

5050
uri: str
51-
buildsNumber: Optional[List[Run]] = None
51+
buildsNumbers: Optional[List[Run]] = None
5252

5353

5454
class BuildArtifact(BaseModel):

pyartifactory/objects/build.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
BuildPromotionRequest,
1818
BuildPromotionResult,
1919
BuildProperties,
20+
BuildRun,
2021
)
2122
from pyartifactory.objects.object import ArtifactoryObject
2223

@@ -28,6 +29,23 @@ class ArtifactoryBuild(ArtifactoryObject):
2829

2930
_uri = "build"
3031

32+
def get_build_runs(self, build_name: str) -> BuildRun:
33+
"""Provides information about the build runs for the given build name.
34+
35+
:param build_name: Build name to be retrieved
36+
:return: BuildRun model object containing server response
37+
"""
38+
try:
39+
response = self._get(
40+
f"api/{self._uri}/{build_name}",
41+
)
42+
print(response.json())
43+
logger.debug("Build Runs successfully retrieved")
44+
except requests.exceptions.HTTPError as error:
45+
self._raise_exception(error)
46+
47+
return BuildRun(**response.json())
48+
3149
def get_build_info(
3250
self,
3351
build_name: str,

0 commit comments

Comments
 (0)