我们如何在 Jfrog aql 语言规范文件中定义多个路径?

问题描述

在定义的规范文件下方,我想在“路径”中添加更多值:{$match} 函数。我的意思是我需要在这种语法中定义多个路径,这可能吗?即: Test/dev 、 Test/qa 、 Test/prod 等。

  "files": [
    {
      "aql": {
        "items.find": {
          "repo": "Testing","path": {"$match":"Test/dev"},"name": {"$match":"*"},"type": "file","$or": [
            {
              "$and": [
                {
                  "created": { "$before":"90d" }
                }
              ]
            }
          ]
        }
      }
    }
  ]
}

解决方法

您可以将它们添加到“or”子句中:

{
  "files": [
    {
      "aql": {
        "items.find": {
          "repo": "Testing","name": { "$match": "*" },"type": "file","created": { "$before": "90d" },"$or": [{ "$match": "Test/dev" },{ "$match": "Test/qa" }]
        }
      }
    }
  ]
}

阅读更多:

  1. AQL documentation
  2. Using File Specs