Bug 1216247 - Document how to create Hawk credentials locally

And also:
* Explain the process for request/approval on stage/prod
* Remove the unnecessary export_project_credentials step in the
"add a new repository" section, since Treeherder's ETL no longer uses
credentials.json.
This commit is contained in:
Ed Morley 2015-10-19 19:32:34 +01:00
Родитель 74c97147fa
Коммит 32863c77a4
1 изменённых файлов: 16 добавлений и 33 удалений

Просмотреть файл

@ -66,41 +66,30 @@ Or for more control, run each tool individually:
NB: isort must be run from inside the VM, since a populated (and up to date) virtualenv is required so that isort can correctly categorise the imports.
Look up credentials for a project
---------------------------------
Managing API credentials
------------------------
To submit data to an existing project, you need corresponding OAuth
credentials, even if you're submitting to your local server.
To submit data to Treeherder's API you need Hawk credentials,
even if you're submitting to your local server.
Prerequisite: you must have previously exported credentials for all data
source projects. This is part of the usual Treeherder setup process.
To generate credentials in the Vagrant instance run the following:
.. code-block:: bash
(venv)vagrant@local:~/treeherder$ ./manage.py export_project_credentials
(venv)vagrant@local:~/treeherder$ ./manage.py create_credentials my-client-id treeherder@mozilla.com "Description"
The above command writes all project credentials to
``treeherder/etl/data/credentials.json`` for use by the Treeherder service.
The generated Hawk ``secret`` will be output to the console, which should then
be passed along with the chosen ``client_id`` to the TreeherderClient constructor.
For more details see the :doc:`submitting_data` section.
If you are implementing :doc:`data submission <submitting_data>` with
``TreeherderClient`` and testing that locally, it is useful to work with your
own copy of ``credentials.json``. You can export the credentials wherever you
need with the ``--destination`` option:
Users can request credentials for the deployed Mozilla Treeherder instances
(and view/delete existing ones) using the forms here:
`stage <https://treeherder.allizom.org/credentials/>`_,
`production <https://treeherder.mozilla.org/credentials/>`_.
.. code-block:: bash
(venv)vagrant@local:~/treeherder$ ./manage.py export_project_credentials --destination /some/path
Within Treeherder, you can look up the credentials for a project like
``mozilla-central`` as follows:
.. code-block:: python
from treeherder.etl.oauth_utils import OAuthCredentials
credentials = OAuthCredentials.get_credentials('mozilla-central')
The call to ``get_credentials`` obtains data directly from the
previously-generated ``treeherder/etl/data/credentials.json``.
Once requested these require approval by a Treeherder administrator, here:
`stage <https://treeherder.allizom.org/admin/credentials/credentials/>`_,
`production <https://treeherder.mozilla.org/admin/credentials/credentials/>`_.
Add a new repository
@ -121,12 +110,6 @@ To add a new repository, the following steps are needed:
> python manage.py init_datasources
* Generate a new oauth credentials file:
.. code-block:: bash
> python manage.py export_project_credentials
* Restart all the services through supervisord:
.. code-block:: bash