anancarv / python-artifactory

Typed interactions with the Jfrog Artifactory REST API
MIT License
55 stars 50 forks source link

[Question] Virtual repository aggregation #81

Closed iiknd closed 3 years ago

iiknd commented 3 years ago

Hi!

Is there any documentation/examples how one should define which repositories are included in the virtual repository?

class VirtualRepository(BaseRepositoryModel):
    """Models a virtual repository."""

    rclass: Literal[RClassEnum.virtual] = RClassEnum.virtual
    repositories: Optional[List[str]] = None

Are the 'repositories' the repo keys?

Another related question, are there any tools that convert between the JFrog Artifactory repository .json format and Base|Local|Remote|VirtualRepository structures? It would be handy to store the .json locally and deploy the changes to Artifactory via python-artifactory?

anancarv commented 3 years ago

Hi @unzap , Sorry for the late answer. For your question related to the virtual repositories, to define repositories to be included, you need to put the list of local repositories keys in the repositories field of the class VirtualRepository. For example:

virtual_repo = VirtualRepository(key="test_virtual_repo", repositories= ["local-rep1", "local-rep2", "remote-rep1", "virtual-rep2"])

For you second question, you can indeed use pydantic to convert JFrog Artifactory repository .json format to the one used in this library. You can see how I do it within the code here: https://github.com/anancarv/python-artifactory/blob/ab2db16e676294fd865a0cbb2a05f91bff64b544/pyartifactory/objects.py#L439