I am trying to query which build number(s) produced artifacts from build foo
with artifact property vcs.Revision=aabbccddee123456
.
In Artifactory 5.1.3.
I was trying like this so far:
curl -u user:apikey -i -X POST https://artifactory.foobar.com/artifactory/api/search/aql -H "content-type:text/plain" -T query.json
query.json:
builds.find(
{
"module.artifact.item.repo":"snapshot-local",
"name":"foo",
"module.artifact.item.@vcs.Revision":"aabbccddee123456"
}
)
However, none of these 3 lines seem individually correct:
builds.find({"module.artifact.item.repo":"snapshot-local"})
returns nothing,builds.find({"name":"foo"})
returns the same empty response,builds.find({"module.artifact.item.@vcs.Revision":"aabbccddee123456"})
also returns this:
{
"results" : [ ],
"range" : {
"start_pos" : 0,
"end_pos" : 0,
"total" : 0
}
}
What am I doing wrong here? I do see in the webapp the builds I published with this name, and with the correct artifact properties.
Certain AQL queries requires a user with admin permissions. To ensure that non-privileged users do not gain access to information without the right permissions, users without admin privileges have the following restrictions:
In your case, you are using the build domain in the query which requires admin permissions
Here's a working solution that will give build numbers (since giving admin rights to query builds is not a solution for us):
query.json
:This returns a list of all the artifacts that were built with the relevant properties, with the build number attached, e.g:
I can then parse this to extract
build.number
.