Skip to content

Commit fde2fa1

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

2 files changed

Lines changed: 22 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: 21 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,26 @@ class ArtifactoryBuild(ArtifactoryObject):
2829

2930
_uri = "build"
3031

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

0 commit comments

Comments
 (0)