The jfrog
cli for Artifactory can be used for searching for artifacts across multiple servers configured in ~/.jfrog/jfrog-cli.conf
:
jfrog rt s repo_name/path/to/artifact*
The URL in the result is only the part relative to the server base URL, and does not contain any reference to the server where the artifact was found:
[
{
"path": "repo_name/path/to/artifact.tar"
}
]
I know could traverse the list of servers in the config file, or use the REST API, but I would prefer if the cli could return it. I haven't found any option to tell jfrog
to include the server URL in the result, so it looks like this is not possible. Hopefully I am wrong.
The URL is to be sent in a downstream event to other components which have no clue what an ARM is.
Sample jfrog-cli.conf
{
"artifactory": [
{
"url": "https://arm1.foo.bar/artifactory/",
"apiKey": "AKEY",
"serverId": "1",
"isDefault": true
},
{
"url": "https://arm2.foo.bar/artifactory/",
"apiKey": "ANOTHERKEY",
"serverId": "2",
"isDefault": false
}
],
"Version": "1"
}
The
jfrog
cli does not search across the list of configured servers. Instead the--server-id
option forjfrog rt s
should be used, orjfrog rt use <server id>
used to set the default server, see https://www.jfrog.com/confluence/display/CLI/CLI+for+JFrog+Artifactory#CLIforJFrogArtifactory-UsingaPredefinedArtifactoryServer.This updates the
isDefault
setting totrue
for the given server, andfalse
for the rest. I would not recommend using this way in scripts, since there will be interference if more than one is executing at a time.The servers should be looped over one by one, and the server URL picked from the jfrog-cli.conf JSON, or using the
jfrog rt c show <server id>
command. Some python code: