我正在尝试使用 AQL 来获取所有未升级为“发布”的构建列表。
我们的二进制文件通过状态集成-> aat-> 发布我想获得那些具有提升状态集成和 aat 但不发布的列表。
一个构建示例具有以下状态:
"statuses" : [ {
"status" : "integration",
"timestamp" : "2016-04-20T08:36:42.009+0000",
"user" : "user",
"ciUser" : "changes",
"timestampDate" : 1461141402009
}, {
"status" : "aat",
"repository" : "repo-aat",
"timestamp" : "2016-04-20T08:56:11.843+0000",
"user" : "user",
"ciUser" : "changes",
"timestampDate" : 1461142571843
}, {
"status" : "aat",
"repository" : "repo-aat",
"timestamp" : "2016-04-20T08:58:55.417+0000",
"user" : "user",
"ciUser" : "changes",
"timestampDate" : 1461142735417
}, {
"status" : "aat",
"repository" : "repo-aat",
"timestamp" : "2016-04-20T09:20:32.619+0000",
"user" : "user",
"ciUser" : "changes",
"timestampDate" : 1461144032619
}, {
"status" : "release",
"repository" : "repo-release",
"timestamp" : "2016-04-20T09:30:12.143+0000",
"user" : "user",
"ciUser" : "changes",
"timestampDate" : 1461144612143
}, {
"status" : "release",
"repository" : "repo-release",
"timestamp" : "2016-04-20T09:40:50.595+0000",
"user" : "admin",
"ciUser" : "changes",
"timestampDate" : 1461145250595
} ],
无论我们是否设置,此构建都是匹配的:
{"promotion.status": {"$nmatch":"aat"}}
至
{"promotion.status": {"$nmatch":"release"}}
{"promotion.status": {"$nmatch":"integration"}}
随着请求:
builds.find({
"$and" : [
{"name": {"$match": "test"}},
{"created": {"$lt": "2016-12-01"}},
{"promotion.status": {"$nmatch":"release"}}
]
}).include("promotion.status").limit(10)
我们得到这样的回应:
{
"results" : [ {
"build.created" : "2016-04-20T10:12:46.905Z",
"build.created_by" : "test",
"build.modified" : "2016-04-20T11:45:12.309Z",
"build.modified_by" : "admin",
"build.name" : "user",
"build.number" : "2551",
"build.promotions" : [ {
"build.promotion.status" : "aat"
}, {
"build.promotion.status" : "integration"
} ],
"build.url" : "URL"
} ],
"range" : {
"start_pos" : 0,
"end_pos" : 1,
"total" : 1,
"limit" : 10
}