devopshq/artifactory

rename file when uploading artifact

Closed this issue · 2 comments

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)

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.

thanks, let me try