devopshq / artifactory

dohq-artifactory: a Python client for Artifactory
https://devopshq.github.io/artifactory/
MIT License
273 stars 144 forks source link

Copy directory #402

Closed RobinMaub closed 1 year ago

RobinMaub commented 1 year ago

Hi Team,

Is it possible to add a feature in the next release, to help copying a directory ? depending on the language, we have to keep some data with the package and it becomes impossible to copy a directory using your fabulous tool.

Do you have any temporary help doing that ?

Best,

allburov commented 1 year ago

@RobinMaub Hi! Doesn't .copy work with folder too? https://github.com/devopshq/artifactory#copy-artifacts

Could you give a bit more information about the case - what do you want to do, what you have tried, which errors it shows.

deviumgroup commented 1 year ago

@RobinMaub Hi! Doesn't .copy work with folder too? https://github.com/devopshq/artifactory#copy-artifacts

Could you give a bit more information about the case - what do you want to do, what you have tried, which errors it shows.

He is probably referring to uploading a directory recursively, can you do that?

RobinMaub commented 1 year ago

Yes exactly. I have a directory with a lot of files composing my package and stuff attached to. I would call "copy(directory, dest)" to move the entire data in a single row :)

allburov commented 1 year ago

Got it. It won't be 'single transaction' operation - if an error happens due to a network issue the folder will be corrupted.

We'd suggest uploading it as an archive - like tar or zip one. As I see the library already supports it - it can upload an archive AND extract it to the folder as a single operation.

Atomically deploy artifacts from archive: this will automatically extract the contents of the archive on the server preserving the archive's paths. This is primarily useful when you want Artifactory to see all the artifacts at once, e.g., for indexing purposes.

https://github.com/devopshq/artifactory#uploading-artifacts https://www.jfrog.com/confluence/display/JFROG/Artifactory+REST+API#ArtifactoryRESTAPI-DeployArtifactsfromArchive

path = ArtifactoryPath(
    "http://my-artifactory/artifactory/libs-snapshot-local/myapp/1.0"
)
path.mkdir()

path.deploy_file(
    "./myapp-1.0.tar.gz", explode_archive=True, explode_archive_atomic=True
)

Please have a look and let me know if it covers your case or not!

RobinMaub commented 1 year ago

Yes it is perfect ! Many thanks for that