devopshq / artifactory

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

rename file when uploading artifact #393

Closed LeiYangGH closed 2 months ago

LeiYangGH commented 1 year ago

following official tutorial uploading-artifacts.

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

By default the uploaded artifact will be same name as the local one. Is there parameter to specify a new name for the uploaded artifact?

I tried jfrog rest api and can upload to any file name

requests.put('https://myartifactory/artifactory/sandbox-generic-local/test/anyfilename',
    data=open(r"localfilename",'rb').read(), headers=auth_headers)
donhui commented 1 year ago

as you said, the official tutorial as follows:

from artifactory import ArtifactoryPath

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

path.deploy_file("./myapp-1.0.tar.gz")

you can change the path url and remove path.mkdir(), eg:

from artifactory import ArtifactoryPath

path = ArtifactoryPath(
    "https://myartifactory/artifactory/sandbox-generic-local/test/anyfilename"
)

path.deploy_file("./localfilename")

and it will meet your requirements.

LeiYangGH commented 1 year ago

thanks, let me try