匹配神器存储库中的多个路径

发布于 2025-01-11 10:23:26 字数 847 浏览 1 评论 0原文

因此,我尝试编写一个 search_spec.json 文件来排除路径为 */latest 或 */develop 的所有 docker 映像(在我的工件存储库中)。但是,我找不到从搜索结果中排除多个路径的解决方案。使用当前的解决方案,我从神器中得到了 400 。有什么想法吗?

{
   "files":[
      {
         "aql":{
            "items.find":{
               "repo":{
                  "$eq":"my-docker-repo"
               },
               "path":{
                  "$nmatch":"**/latest*",
                  "$nmatch":"**/develop*"
               },
               "updated":{
                  "$before":"8w"
               },
               "stat.downloaded":{
                  "$before":"12w"
               }
            }
         },
         "recursive":"true",
         "sortBy":[
            "created"
         ],
         "limit":10000
      }
   ]
}

So I'm trying to write a search_spec.json file to exclude all docker images with path */latest or */develop im my artifactory repo. However I cannot find a solution to exclude multiple paths from the search results. With the current solution I'm getting a 400 from artifactory. Any ideas?

{
   "files":[
      {
         "aql":{
            "items.find":{
               "repo":{
                  "$eq":"my-docker-repo"
               },
               "path":{
                  "$nmatch":"**/latest*",
                  "$nmatch":"**/develop*"
               },
               "updated":{
                  "$before":"8w"
               },
               "stat.downloaded":{
                  "$before":"12w"
               }
            }
         },
         "recursive":"true",
         "sortBy":[
            "created"
         ],
         "limit":10000
      }
   ]
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

耶耶耶 2025-01-18 10:23:26

您可以使用复合标准,使用 $and 运算符。

在您的示例中,将 - 更改

"path":{
   "$nmatch":"**/latest*",
   "$nmatch":"**/develop*"
},

为 -

"$and":[
   {
      "path":{
         "$nmatch":"**/latest*"
      }
   },{
      "path":{
         "$nmatch":"**/develop*"
      }
   }
],

You can use compound criteria for that, using an $and operator.

In your example, change -

"path":{
   "$nmatch":"**/latest*",
   "$nmatch":"**/develop*"
},

to -

"$and":[
   {
      "path":{
         "$nmatch":"**/latest*"
      }
   },{
      "path":{
         "$nmatch":"**/develop*"
      }
   }
],
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文