Jfrog Rt Cli Upload Example Windows 10

A good API is like a classic car - You want to use it again and again.
A good API is like a classic motorcar – You desire to use it once more and over again.

Most of the interactions with Artifactory will be from your CI/CD tools. It might be your build engine or from your log aggregator. This powerful API can be invoked in any of the standard ways you like to work with any other RESTful APIs (e.g. coil, CLI, your source code, etc').
In many cases, it's the preferred 'gum' for developers when information technology comes to automation. The options are extensive and yous can exercise many useful things with this API. Even so, in this short mail, nosotros volition embrace the well-nigh popular actions you lot 'must have'.

Let'south beginning with the almost common activity: "upload/download binaries". This activity could run automatically from the build automobile to Artifactory using:

gyre -u myUser:myP455w0rd! -Ten PUT "http://localhost:8081/artifactory/my-repository/my/new/antiquity/directory/myAppBuild.exe" -T  ./myAppBuild.exe  And with the JFrog CLI:  jfrog rt u ./myAppBuild.exe my-repository/my/new/artifact/directory/          

As for can come across, you can piece of work with the REST API from any applied science you like. One good option is to use the JFrog CLI.
It is a compact client (written in Go) that provides a unproblematic interface to automate admission to Artifactory. Every bit a wrapper to the API, it offers a way to simplify automation scripts making them more readable and easier to maintain, features such every bit parallel uploads and downloads, checksum optimization and wildcards/regular expressions brand your scripts more efficient and reliable.

Downloading artifacts is i line of Get command:

roll -u myUser:myP455w0rd! -Ten GET http://localhost:8081/artifactory/libs-release-local/ch/qos/logback/logback-archetype/0.9.ix/logback-classic-0.9.nine.jar  And with JFrog CLI:  jfrog rt dl libs-release-local/ch/qos/logback/logback-classic/0.9.9/logback-classic-0.ix.9.jar          

Search

Y'all will be astonished how apace Artifactory will be the i source of truthful to all your binaries and how many of them you have. If you wish to observe a certain package/library or build file – At that place is a powerful search API.
Y'all can exercise some quick searches like this one:

roll -u myUser:myP455w0rd! http://localhost:8081/artifactory/api/search/artifact?proper name=lib&repos=libs-release-local  OR with JFrog CLI: jfrog rt s libs-release-local/lib  { "results": [   {       "uri": "http://localhost:8081/artifactory/api/storage/libs-release-local/org/peak/lib/ver/lib-ver.pom"    },{       "uri": "http://localhost:8081/artifactory/api/storage/libs-release-local/org/acme/lib/ver2/lib-ver2.pom"    }  ] }          

You lot can also search and find interesting data points like in the example below, nosotros wish to query all the files that came out of the build (in this case, Jenkins) and that are bigger than 100Mb.

// Put this: items.discover(   {      "type":"file",      "created_by":"jenkins",      "size":{"$gt":"100000"}    }) .sort({"$desc":["size","proper name"]}) .limit(l)  // Add the query to file: aql-query-1.txt so in the next control, You can execute information technology.  // // Search for the biggest files that our Jenkins built.  // You lot can change it and tune the size/type of the files. // Permit'southward apply curl to become the results curl -uYourUserName:YourPassword -X Post    http://ArtifactoryUrl/artifactory/api/search/aql   -d @aql-query-ane.txt -H \"content-blazon: text/manifestly\"";          

Y'all will get a JSON response that will look like:

{ "results" : [ {   "repo" : "docker-prod-local",   "path" : "docker-app/65",   "name" : "sha256__a56a07bf8a7e40e8580e26b5c7ad51e88e130cce5537bd53aec960de3e9f4e3f",   "type" : "file",   "size" : 182286302,   "created" : "2019-06-10T22:59:11.432Z",   "created_by" : "jenkins",   "modified" : "2019-06-10T22:59:08.982Z",   "modified_by" : "jenkins",   "updated" : "2019-06-10T22:59:xi.433Z" },{   "repo" : "docker-prod-local",   "path" : "docker-framework/69",   "name" : "sha256__a56a07bf8a7e40e8580e26b5c7ad51e88e130cce5537bd53aec960de3e9f4e3f",   "blazon" : "file",   "size" : 182286302,   "created" : "2019-06-10T22:57:22.855Z",   "created_by" : "jenkins",   "modified" : "2019-06-10T22:57:19.454Z",   "modified_by" : "jenkins",   "updated" : "2019-06-10T22:57:22.856Z" },{   "repo" : "docker-stage-local",   "path" : "docker-app/65",   "proper name" : "sha256__a56a07bf8a7e40e8580e26b5c7ad51e88e130cce5537bd53aec960de3e9f4e3f",   "type" : "file",   "size" : 182286302,   "created" : "2019-06-10T22:59:11.432Z",   "created_by" : "jenkins",   "modified" : "2019-06-10T22:59:08.982Z",   "modified_by" : "jenkins",   "updated" : "2019-06-10T22:59:11.433Z" } ], "range" : {   "start_pos" : 0,   "end_pos" : 3,   "total" : three,   "limit" : 3 } }          

At present, you can have this data and get fifty-fifty more data on each docker paradigm or whatsoever other parcel, library, artifact you are using.

Docker

Docker is quite popular these days, and then let's get a listing of all our Docker repositories:

coil -u youUserName:youPassWord http://YouArtifactoryServer.com/artifactory/api/docker/docker-stage-local/v2/_catalog  // The response: {   "repositories" : [ "docker-local-apps", "docker-prod-frameworks" ] }          

Next, we can fetch the list of all the tags of specified Artifactory Docker repository:

//  Get /api/docker/{repo-key}/v2/{paradigm name}/tags/list?n=<due north from the asking>&concluding=<final tag value from previous response>  curl -u youUserName:youPassWord http://YouArtifactoryServer.com/artifactory/api/docker/docker-prod-local/v2/docker-app/tags/listing  // The response: {   "name" : "docker-app",   "tags" : [ "59", "lx", "61", "62", "63", "64", "65", "66", "67", "68" ] }          

The total example

There are many more than options, but it will take (a scrap) more than 5 minutes. Check it out at: Artifactory REST API doc.

Be stiff!

freemanmrsed1986.blogspot.com

Source: https://greenido.wordpress.com/2019/08/13/jfrog-artifactory-rest-api-in-5min/

0 Response to "Jfrog Rt Cli Upload Example Windows 10"

Postar um comentário

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel