Look up artifacts by metadata.type rather than name
So that we can have nice looking names like "Preview Site", find the artifact by looking up the 'type' field in metadata. Change-Id: Ia01e95c77f068bd8ab3a515aa023c1f79332fc67
This commit is contained in:
parent
faeda1ab85
commit
e0d10c611e
@ -122,6 +122,7 @@ int main(int, char**)
|
||||
// output for each.
|
||||
// Expected input:
|
||||
// https://zuul.opendev.org site.167715b656ee4504baa940c5bd9f3821.openstack.preview.opendev.org
|
||||
// https://zuul.opendev.org javascript_content.7cf36db4b8574ef6a5ba1a64cb827741.zuul.preview.opendev.org
|
||||
while (getline(cin, input)) {
|
||||
|
||||
// Split the input into api_url, hostname
|
||||
@ -166,7 +167,9 @@ int main(int, char**)
|
||||
|
||||
string artifact_url = "Artifact_not_found";
|
||||
for (uint i = 0; i < artifacts.size(); i++) {
|
||||
if (artifacts[i]["name"].as_string() == artifact) {
|
||||
if (artifacts[i].has_field("metadata") &&
|
||||
artifacts[i]["metadata"].has_field("type") &&
|
||||
artifacts[i]["metadata"]["type"].as_string() == artifact) {
|
||||
artifact_url = artifacts[i]["url"].as_string();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user