Badge request: Copr Build System
The Copr build system: https://copr.fedorainfracloud.org/ provides badges showing the status of the build (fail, success,s or in progress).
An example of such badge is: https://copr.fedorainfracloud.org/coprs/g/copr/copr/package/copr-backend/status_image/last_build.png The documentation is here: https://docs.pagure.org/copr.copr/user_documentation.html#status-badges
The format is
- https://copr.fedorainfracloud.org/coprs/
/ /package/<package_name>/status_image/last_build.png for a user. If it is team (group) project, then: - https://copr.fedorainfracloud.org/coprs/g/<group_name>/
/package/<package_name>/status_image/last_build.png
Motivation: Better visibility that there is an option to add badges on your project page. E.g. like we have on https://pagure.io/copr/copr/
Love Shields? Please consider donating $10 to sustain our activities:
Done. Thank you for the service.
In order for Shields to be able to provide badges for a service, we need to be able to retrieve the raw data over HTTP, with a strong preference for REST APIs. In a handful of the somewhat more exceptional cases we are able to get the requisite data by scraping svg badges provided by the upstream provider, but we definitely cannot scrape someone else's pngs.
Do you have any information you could share about the API? I'm having trouble finding anything other than this short page that in turn just points the docs for a python client, which isn't a viable option for us.
You can retrieve the data in JSON from:
https://copr.fedorainfracloud.org/api_3/package?ownername=OWNER&projectname=PROJECT&packagename=PACKAGE&with_latest_build=True
e.g.: The last status of https://copr.fedorainfracloud.org/coprs/msuchy/nanoblogger/package/nanoblogger/ is:
https://copr.fedorainfracloud.org/api_3/package?ownername=msuchy&projectname=nanoblogger&packagename=nanoblogger&with_latest_build=True
when the OWNER is a group then it starts with @.
E.g.: the last status of https://copr.fedorainfracloud.org/coprs/g/mock/mock/package/mock-core-configs/ is
https://copr.fedorainfracloud.org/api_3/package?ownername=@mock&projectname=mock&packagename=mock-core-configs&with_latest_build=True
The result is JSON and you are interested in builds/latest/state which can be one of these (pasted from code with description):
"failed": "Build failed. See logs for more details.",
"succeeded": "Successfully built.",
"canceled": "The build has been cancelled manually.",
"running": "Build in progress.",
"pending": "Build is waiting in queue for a backend worker.",
"skipped": "This package has already been built previously.",
"starting": "Backend worker is trying to acquire a builder machine.",
"importing": "Package sources are being imported into Copr DistGit.",
"waiting": "Task is waiting for something else to finish.",
"imported": "Package was successfully imported into Copr DistGit.",
"forked": "Build has been forked from another build.",
Thanks that's helpful! Is the endpoint documented any where?
https://copr.fedoraproject.org/api/ says we need a token, but the example calls posted seem to allow anonymous access :thinking: It would be useful to know if any rate limits apply for anonymous access
The endpoints are not documented. :( I never realized that - as we use the python bindings. I will raise this and we will try do something about it. Though, it will likely take few weeks till it gets to the top of our TODO list. The token is needed only for actions that modify something. For queries, it is not needed. There are no rate limits at all.
The endpoints are not documented. :( I never realized that - as we use the python bindings. I will raise this and we will try do something about it.
No worries, and thanks for raising that! This doesn't need to block us, but if/when the docs become available it'd be great if someone could drop us a note to let us know. We just integrate with so many upstream tools/services, many of which we have 0 familiarity with, that every bit of documentation is extremely helpful.
Hi, has there been any progress on copr badges? This would be quite nice to have.
If anyone wants :)
https://img.shields.io/badge/dynamic/json?color=blue&label=copr&query=builds.latest.state&url=YOUR_URL_HERE
URL (replace OWNER, PROJECT and PACKAGE with copr ones)
https://copr.fedorainfracloud.org/api_3/package?ownername=OWNER&projectname=PROJECT&packagename=PACKAGE&with_latest_build=True
Then copy your edited URL and paste it instead of YOUR_URL_HERE
Works great :+1: Of course the copr url has to be URL-encoded.
To follow up request in comment 1 - we already have documentation to API https://copr.fedorainfracloud.org/api_3/docs
It seems like the requisite pieces are indeed in place to be able to move forward with adding this badge!
While we'd like to see it, I think it's highly unlikely that any maintainers will have bandwidth to add this badge ourselves. We've got a pretty thorough tutorial for adding new badges if anyone would like to work on it, and we're happy to answer any questions along the way.