Repository :
http://git.fedorahosted.org/cgit/copr.git
On branch : master
---------------------------------------------------------------
commit b670e8af2ac9819257a0bc459d81825c03cd11bc
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Mon Sep 7 15:25:47 2015 +0200
[frontend][API] covered Build Chroot; minor fixes
---------------------------------------------------------------
.../coprs/rest_api/resources/project_chroot.py | 3 -
frontend/docs/api_2/source/Resources/build.rst | 15 +-
.../docs/api_2/source/Resources/build_chroot.rst | 139 ++++++++++++++++++++
frontend/docs/api_2/source/Resources/project.rst | 9 +-
.../docs/api_2/source/Resources/project_chroot.rst | 6 +-
5 files changed, 154 insertions(+), 18 deletions(-)
diff --git a/frontend/coprs_frontend/coprs/rest_api/resources/project_chroot.py
b/frontend/coprs_frontend/coprs/rest_api/resources/project_chroot.py
index e22de4f..ff7a3b1 100644
--- a/frontend/coprs_frontend/coprs/rest_api/resources/project_chroot.py
+++ b/frontend/coprs_frontend/coprs/rest_api/resources/project_chroot.py
@@ -51,9 +51,6 @@ class ProjectChrootListR(Resource):
except (MalformedArgumentException, ObjectNotFoundError) as err:
raise MalformedRequest("Bad mock chroot name: {}. Error:
{}".format(name, err))
- if mock_chroot is None:
- raise MalformedRequest("Mock chroot `{}` doesn't exists"
- .format(name))
CoprChrootsLogic.create_chroot(flask.g.user, project, mock_chroot, **req)
try:
db.session.commit()
diff --git a/frontend/docs/api_2/source/Resources/build.rst
b/frontend/docs/api_2/source/Resources/build.rst
index 9da70a9..3769808 100644
--- a/frontend/docs/api_2/source/Resources/build.rst
+++ b/frontend/docs/api_2/source/Resources/build.rst
@@ -4,7 +4,7 @@ Build
Build resources allows to submit new builds and access current build progress.
Build in fact consists of the few tasks, one per chroot, and detail information
-is available through sub-resource BuildChroot_.
+is available through sub-resource :doc:`./build_chroot`.
@@ -47,7 +47,7 @@ Build fields
Field Type Description
================== ==================== ===============
id int unique build identifier
-state string current state of the build
+state string current state of the build, value is aggregated
from build chroots
submitted_on int(unixtime UTC) time of the build submission
started_on int(unixtime UTC) time when the first build chroot started,
otherwise ``null``
ended_on int(unixtime UTC) time when the last build chroot ended, otherwise
``null``
@@ -268,8 +268,8 @@ Get build details
Returns details about build
- :param int project_id: a unique identifier of the build
- :query bool show_chroots: embed BuildChroot_ sub-resources into the result, default
is False
+ :param int build_id: a unique identifier of the build
+ :query bool show_chroots: embed :doc:`./build_chroot` sub-resources into the result,
default is False
:statuscode 200: no error
:statuscode 404: build not found
@@ -278,7 +278,7 @@ Get build details
.. sourcecode:: http
- GET HTTP/1.1
+ GET /api_2/builds/106897 HTTP/1.1
Host:
copr.fedoraproject.org
**Response**
@@ -352,8 +352,7 @@ Build cancellation is done be setting build state to ``cancelled``.
**REQUIRE AUTH**
- :param int project_id: a unique identifier of the build
- :query bool show_chroots: embed BuildChroot_ sub-resources into the result, default
is False
+ :param int build_id: a unique identifier of the build
:statuscode 204: build was updated
:statuscode 400: malformed request, most probably build can't be canceled at the
moment
@@ -386,7 +385,7 @@ Delete build
Deletes build and schedules deletion of build result at Copr backend
- :param int project_id: a unique identifier of the build
+ :param int build_id: a unique identifier of the build
:statuscode 204: build was removed
:statuscode 400: could not delete build right now, most probably due to unfinished
build
diff --git a/frontend/docs/api_2/source/Resources/build_chroot.rst
b/frontend/docs/api_2/source/Resources/build_chroot.rst
index e69de29..f767fbe 100644
--- a/frontend/docs/api_2/source/Resources/build_chroot.rst
+++ b/frontend/docs/api_2/source/Resources/build_chroot.rst
@@ -0,0 +1,139 @@
+Build Chroot
+============
+
+Build chroot represents information about individual build tasks for each chroot.
+
+Structure of the build chroot entity
+------------------------------------
+
+.. code-block:: javascript
+
+ {
+ "name": "fedora-rawhide-x86_64",
+ "started_on": 1440753865,
+ "ended_on": 1440753919,
+ "state": "succeeded",
+ "result_dir_url":
"http://copr-be-dev.cloud.fedoraproject.org/results/vgologuz/aeghqawgt/fedora-rawhide-x86_64/00106882-python-marshmallow",
+ "git_hash": "d241064b14f9dcd5d9032d0aca3b4e78fbd1aafd"
+ }
+
+Build chroot fields
+~~~~~~~~~~~~~~~~~~~
+================== ==================== ===============
+Field Type Description
+================== ==================== ===============
+name str chroot name
+state str current build state
+started_on int(unixtime UTC) time when the build chroot started
+ended_on int(unixtime UTC) time when the build chroot ended
+git_hash str hash of the git commit in dist-git used for the
build
+result_dir_url str(URL) location of the build results
+================== ==================== ===============
+
+
+.. note::
+ Build Chroot doesn't currently support any modifications,
+ so all fields are read-only.
+
+List build chroots
+------------------
+
+.. http:get:: /api_2/builds/(int:build_id)/chroots
+
+ Returns list of build chroots contained in the one build
+
+ :param int build_id: a unique identifier of the build
+
+ :statuscode 200: no error
+ :statuscode 404: build not found
+
+ **Example request**
+
+ .. sourcecode:: http
+
+ GET /api_2/builds/106882/chroots HTTP/1.1
+ Host:
copr.fedoraproject.org
+
+ **Response**
+
+ .. sourcecode:: http
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "chroots": [
+ {
+ "chroot": {
+ "name": "fedora-rawhide-x86_64",
+ "started_on": 1440753865,
+ "state": "succeeded",
+ "ended_on": 1440753919,
+ "result_dir_url":
"http://copr-be-dev.cloud.fedoraproject.org/results/vgologuz/aeghqawgt/fedora-rawhide-x86_64/00106882-python-marshmallow",
+ "git_hash":
"d241064b14f9dcd5d9032d0aca3b4e78fbd1aafd"
+ },
+ "_links": {
+ "project": {
+ "href": "/api_2/projects/3985"
+ },
+ "self": {
+ "href":
"/api_2/builds/106882/chroots/fedora-rawhide-x86_64"
+ }
+ }
+ }
+ ],
+ "_links": {
+ "self": {
+ "href": "/api_2/builds/106882/chroots"
+ }
+ }
+ }
+
+
+
+Get build chroot details
+------------------------
+
+.. http:get:: /api_2/builds/(int:build_id)/chroots/(str:name)
+
+ Returns details about one build chroot
+
+ :param int build_id: a unique identifier of the build
+ :param str name: chroot name
+
+ :statuscode 200: no error
+ :statuscode 404: build or build chroot not found
+
+ **Example request**
+
+ .. sourcecode:: http
+
+ GET /api_2/builds/106882/chroots/fedora-rawhide-x86_64 HTTP/1.1
+ Host:
copr.fedoraproject.org
+
+ **Response**
+
+ .. sourcecode:: http
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+
+ {
+ "chroot": {
+ "name": "fedora-rawhide-x86_64",
+ "started_on": 1440753865,
+ "state": "succeeded",
+ "ended_on": 1440753919,
+ "result_dir_url":
"http://copr-be-dev.cloud.fedoraproject.org/results/vgologuz/aeghqawgt/fedora-rawhide-x86_64/00106882-python-marshmallow",
+ "git_hash": "d241064b14f9dcd5d9032d0aca3b4e78fbd1aafd"
+ },
+ "_links": {
+ "project": {
+ "href": "/api_2/projects/3985"
+ },
+ "self": {
+ "href":
"/api_2/builds/106882/chroots/fedora-rawhide-x86_64"
+ }
+ }
+ }
+
diff --git a/frontend/docs/api_2/source/Resources/project.rst
b/frontend/docs/api_2/source/Resources/project.rst
index c977f4d..aaad18f 100644
--- a/frontend/docs/api_2/source/Resources/project.rst
+++ b/frontend/docs/api_2/source/Resources/project.rst
@@ -41,6 +41,7 @@ homepage string(URL) yes project homepage
contact string(URL or email) yes contact with the project maintainer
disable_createrepo bool yes disables automatic repository metadata
generation
build_enable_net bool yes set default value for new builds
option `enable_net`
+repos list of string yes list of additional repositories to be
enabled during the build
================== ==================== ========= ===============
List projects
@@ -105,7 +106,7 @@ Create new project
Creates new Copr project.
Additionally to described before `Project fields`_ the user could specify field
`chroots` which contains list of chroots to be enabled.
- Available `chroot` names could be obtained from MockChrootResource_
+ Available `chroot` names could be obtained from :doc:`./mock_chroot`
:resheader Location: contains URL to the newly created project entity
@@ -150,8 +151,8 @@ Get project details
:param int project_id: a unique identifier of the Copr project.
- :query bool show_builds: embed Build_ entities owned by this project into the result,
default is False
- :query bool show_chroots: embed ProjectChroot_ sub-resources into the result, default
is False
+ :query bool show_builds: embed :doc:`./build` entities owned by this project into the
result, default is False
+ :query bool show_chroots: embed :doc:`./project_chroot` sub-resources into the
result, default is False
:statuscode 200: no error
:statuscode 404: project not found
@@ -266,7 +267,7 @@ Modify project
Updates Copr project.
- .. note:: You couldn't enabled or disable project chroots here, use
ProjectChroots_ resource.
+ .. note:: You couldn't enabled or disable project chroots here, use
:doc:`./project_chroot` resource.
:param project_id: a unique identifier of the Copr project.
diff --git a/frontend/docs/api_2/source/Resources/project_chroot.rst
b/frontend/docs/api_2/source/Resources/project_chroot.rst
index a865afd..a4d6829 100644
--- a/frontend/docs/api_2/source/Resources/project_chroot.rst
+++ b/frontend/docs/api_2/source/Resources/project_chroot.rst
@@ -1,7 +1,7 @@
Project Chroot
==============
-Projects Chroots allows to view and modify project settings dedicated for different
chroots.
+Projects Chroots allows to enable and disable target chroots and modify project settings
dedicated for specific chroots.
Structure of the project chroot entity
--------------------------------------
@@ -92,7 +92,7 @@ Enable chroot for project
**REQUIRE AUTH**
Enables chroot for the Copr project.
- Available `chroot` names could be obtained from MockChrootResource_
+ Available `chroot` names could be obtained from :doc:`./mock_chroot` resource.
:param int project_id: a unique identifier of the Copr project.
@@ -184,7 +184,7 @@ Disable chroot for project
:param int project_id: a unique identifier of the Copr project.
:param str chroot_name: name of the project chroot
- :statuscode 204: project was removed
+ :statuscode 204: chroot was disabled
:statuscode 403: authorization failed
:statuscode 404: project not found or chroot isn't enabled for the project