Search code examples
curltfsjfrog-cli

curl command to replace existing folder


I am using JFrog to store all the artifacts. I am using curl cmd to replace the artifact. Below is the curl cmd, the problem it doesn't replace/ overwrite the 'WINX64.zip'.

curl -X PUT -u user1:$(pwd) http://xyz:8080/artifactory/xyzFolder/winx64/WINX64.zip 
 -T  C:\artifacts\localMachine\Test.zip -v 

Please correct me on curl, I am not familiar with this cmd.

To give additional Info, I am updating this from tfs build. I am not familiar TFS JFrogDeployer. Basically whenever build is completed, I want the WINX64.zip from above path to be updated everytime build is completed. It can be curl or by any other method.

Hope I am clear, anymore Info please do me know.


Solution

  • You could use the following curl script:

    curl -u username:password -X PUT "http://localhost:8046/artifactory/xxx/windows.zip" -T filepath/xxx.zip
    

    Here is my example in build:

    Orgin artifact:

    enter image description here

    Build definition:

    enter image description here

    Artifacts can be generated in the previous tasks in $(build.artifactstagingdirectory). Then i use the curl command to upload the artifacts to jfrog.

    The existing zip file will be replaced.

    enter image description here

    On the other hand, you also could use this Azure Devops extension: JFrog Artifactory to upload the files.

    Here is the doc about Jfrog Rest API.