Skip to content

Commit

Permalink
add support for docker image operation
Browse files Browse the repository at this point in the history
  • Loading branch information
zhan9san committed Mar 6, 2024
1 parent b116902 commit b6ad3a9
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions artifactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -2321,6 +2321,33 @@ def from_aql(self, result):
)
return obj

def get_docker_images(self, docker_repo):
"""
Get Docker image list from docker repo
:param docker_repo: Docker repository to list
:return: List[image]
"""
url = f"{self.drive.rstrip('/')}/api/docker/{docker_repo}/v2/_catalog"
r = self.session.get(url)
raise_for_status(r)
content = r.json()

return content["repositories"]

def get_docker_image_tags(self, docker_repo, docker_image):
"""
Get Docker image list from docker repo
:param docker_repo: Docker repository
:param docker_image: Docker image to list
:return: List[tag]
"""
url = f"{self.drive.rstrip('/')}/api/docker/{docker_repo}/v2/{docker_image}/tags/list"
r = self.session.get(url)
raise_for_status(r)
content = r.json()

return content["tags"]

def promote_docker_image(
self,
source_repo,
Expand Down

0 comments on commit b6ad3a9

Please sign in to comment.