سؤال

Note: Although this question involves the Artifactory API it really is more about writing semi-sophisticated cURL commands.

Say I am in a directory that has myapp-1.5.jar in it. Let's also say I have an Artifactory repo located at http://artrepo01:8080/artifactory/libs-release-local.

I want to deploy the JAR to:

libs-release-local/
    myorg/
        myapp/
            1.5/
                myapp-1.5.jar

According to the Artifactory API docs (for Deploy Artifact endpoint), the proper way to do this is via HTTP PUT:

PUT /libs-release-local/my/jar/1.0/jar-1.0.jar
{
    "uri": "http://artrepo01:8080/artifactory/libs-release-local",
    "downloadUri": "http://artrepo01:8080/artifactory/libs-release-local",
    "repo": "libs-release-local",
    "path": "/myorg/myapp/1.5/myapp-1.5.jar",
    "createdBy": "artadmin",
    "mimeType": "application/java-archive",
}

Questions:

  • What would the exact cURL command be to properly HTTP PUT the JAR to this endpoint?
  • When I try curl -X PUT http://artrepo01:8080/artifactory/libs-release-local/myorg/myapp/1.5/myapp.jar (which may or may not be correct in which case don't worry about the question above), I get an error from Artifactory stating that the anonymous user doesn't have write permissions to the repo. I believe this is because my cURL command isn't specifying the createdBy user (artadmin).
  • How do I specify the password for the artadmin user in the PUT call?
هل كانت مفيدة؟

المحلول

Your query is good. Just add username and password using -u flag:

curl -X PUT -u artadmin:password http://artrepo01:8080/artifactory/libs-release-local/myorg/myapp/1.5/myapp-1.5.jar

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top