Artifactory

From Omnia
Jump to navigation Jump to search

jfrog cli

Installation - https://jfrog.com/getcli/

Debian/Ubuntu:

wget -qO - https://releases.jfrog.io/artifactory/jfrog-gpg-public/jfrog_public_gpg.key | sudo apt-key add -
echo "deb https://releases.jfrog.io/artifactory/jfrog-debs xenial contrib" | sudo tee -a /etc/apt/sources.list &&    sudo apt update &&
sudo apt install -y jfrog-cli-v2-jf &&
jf intro

Redhat:

wget -qO - https://releases.jfrog.io/artifactory/jfrog-gpg-public/jfrog_public_gpg.key | sudo apt-key add -
echo "deb https://releases.jfrog.io/artifactory/jfrog-debs xenial contrib" | sudo tee -a /etc/apt/sources.list &&    sudo apt update &&
sudo apt install -y jfrog-cli-v2-jf &&
jf intro

Ping server:

jf rt ping
 ok

Show config:

jf c s  # jf config show

Add artifactory:

jf c add  # jf config add
    server id: simple name
    url: http://artifactory.example.com/
      save and continue (assuming the urls are correct)
    username: your username
    pass/api: your password or api key
    reverse proxy?  likely no

Search file:

jf rt s [repo/pattern]  # pattern can use wild cards
Example:
# jf rt s myrepo/test/BUILD_NUMBER
13:42:58 [đŸ””Info] Searching artifacts...
13:42:58 [đŸ””Info] Found 1 artifact.
[
  {
    "path": "myrepo/test/BUILD_NUMBER",
    "type": "file",
    "size": 38,
    "created": "2023-07-26T18:25:55.912Z",
    "modified": "2023-07-28T00:32:13.868Z",
    "sha1": "b43cda47086846025ca5aaa6256372bc2550xxxx",
    "sha256": "62cce4682d3700b62d5dba0a098b65af928149576f614c51f5c7a03b99xxxxx",
    "md5": "bd11639e2c9022ce8ab12d1eda61xxx"
  }
]

API

Test Connection

GET /api/v1/system/ping
curl -X GET "http://ARTIFACTORY_SERVER_HOSTNAME:8082/distribution/api/v1/system/ping"

Ref: https://jfrog.com/help/r/jfrog-rest-apis/test-connection

Get System Info

GET /api/v1/system/info
curl -u myUser:myP455w0rd! -X GET "http://ARTIFACTORY_SERVER_HOSTNAME:8082/distribution/api/v1/system/info"

ref: https://jfrog.com/help/r/jfrog-rest-apis/get-system-info

keywords