0

Is there a way to get the binary HASH code(SHA1, SHA256) from artifactory through jfrog cli? Or at least to download only binaries with specific HASH.

I tried to use the props like below, but it does not work.

jfrog rt download --props "sha1=506438fbfc4a029ffee8b001fdce3c2cbd5541ec --server-id af-server.com afrepo/test_repo/test.txt

SHA-1 for one artifatory artifact"

Community
  • 1
  • 1
brane
  • 585
  • 6
  • 20

1 Answers1

2

an Artifact sha-1 is not a property but but an item.field. You can therefore query an artifact by sha1 using the field name (it is actually "actual_sha1") using AQL. You can use AQL with curl (see some examples here) or with the CLI using spec files (examples here)

(Note that the AQL structure is slightly different between spec files and curl)

With all that said, your sha1 search example would look like this.

CLI command:

jfrog rt s --spec="/MyPath/MySpecFile"

Spec file

{  "files": [
{
  "aql": {
    "items.find": 
                  {
      "repo": "my-local-repo",
      "actual_sha1": {"$eq": "6aebc7357ba46916aab5e9d29b3f8e7180cd7089"}
                  }
         }
}]}
Ortsigat
  • 1,259
  • 7
  • 8