Bug 1259251

Summary: [RFE] Provide a way how to obtain the *full* URLs of build results
Product: [Community] Copr Reporter: Radek Holy <rholy>
Component: frontendAssignee: Valentin Gologuzov <vgologuz>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: jberan, jzeleny
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-09-22 09:47:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Radek Holy 2015-09-02 09:44:27 UTC
(I miss a "Python API" component, the "frontend" component is described as "bugs related to web interface")

Currently, to get the URL of the build results, I need to do this:

    for build in result.builds_list:
        for chroot in build.handle.get_build_details().data['chroots']:
            print('{}/{}/{:08}-{}'.format(build.handle.get_build_details().results, chroot, build.build_id, project))

I believe it is unnecessarily complicated. Especially the part '{id:08}-{project}' feels bad.

Could you please provide an attribute/function that can return the full URLs for each chroot? Or a function that is able to reliably construct the URL?

Let me set a higher severity since I believe that this is a really important piece. Especially in our case: an automated continuous integration process.

BTW, I believe that this would be useful also in the REST API. Should I file a separate RFE?

Comment 1 Valentin Gologuzov 2015-09-03 12:15:55 UTC
Fixed in cadcedfae65d2692e84a9e9432dd82fb6eff2a3c
Now old API method /api/coprs/build/106882 contains field `results_by_chroot` with absolute url to the result dir.

Example with python-copr:
In [11]: from copr import CoprClient

In [12]: cc = CoprClient(copr_url="http://copr-fe-dev.cloud.fedoraproject.org")

In [13]: result = cc.get_build_details(25257)

In [14]: result.data["results_by_chroot"]
Out[14]: {u'epel-7-x86_64': u'http://copr-be-dev.cloud.fedoraproject.org/results/vgologuz/test-scl-nginx/epel-7-x86_64/nginx14-nginx-1.4.4-10.el7'}

In [15]: result2 = cc.get_build_details(106882)

In [16]: result2.data["results_by_chroot"]
Out[16]: 
{u'fedora-21-i386': u'http://copr-be-dev.cloud.fedoraproject.org/results/vgologuz/aeghqawgt/fedora-21-i386/00106882-python-marshmallow',
 u'fedora-22-i386': u'http://copr-be-dev.cloud.fedoraproject.org/results/vgologuz/aeghqawgt/fedora-22-i386/00106882-python-marshmallow',
 u'fedora-23-i386': u'http://copr-be-dev.cloud.fedoraproject.org/results/vgologuz/aeghqawgt/fedora-23-i386/00106882-python-marshmallow',
 u'fedora-rawhide-i386': u'http://copr-be-dev.cloud.fedoraproject.org/results/vgologuz/aeghqawgt/fedora-rawhide-i386/00106882-python-marshmallow',
 u'fedora-rawhide-x86_64': u'http://copr-be-dev.cloud.fedoraproject.org/results/vgologuz/aeghqawgt/fedora-rawhide-x86_64/00106882-python-marshmallow'}


API_2 would provide this url as part of BuildChroot resource

Comment 2 Valentin Gologuzov 2015-09-22 09:47:46 UTC
Deployed in production. 
copr-frontend 1.68 copr-backend 1.75

Comment 3 Radek Holy 2015-09-29 22:15:19 UTC
Works for me. Thank you.