-
Notifications
You must be signed in to change notification settings - Fork 15
Adding a task for PollBot
Most of the issues here are adding new tasks to PollBot because once it is working then you just want to get more!!!
Here is a little documentation and check-boxes that you need to check to make sure your new task is ready to land:
- [ ] Update `API_CHANGELOG.rst`
- [ ] Update `CHANGELOG.rst`
- [ ] Update `pollbot/api.yaml`
- [ ] Create your task in `pollbot/tasks`
- [ ] Make sure a heartbeat exists for this service
- [ ] Create the view in `pollbot/views/release.py`
- [ ] Add the new endpoints in `pollbot/app.py`
- [ ] Fix tests, flake8 and coverage
Create a a new minor version if there were no API changes since the last release and update its number in pollbot/__init__.py
Explain that you are creating a new task and the related new endpoints.
Add the new endpoints and describe their response format.
- If it is a new service create a new file named as the service (i.e
buildhub.py
) - For a service that already has tasks, you can add it in the existing file
If it's a new service, figure out a heartbeat url to tell PollBot if the service is available. It should be a very simple endpoint because it will be called every 5 minutes.
For example:
# pollbot/tasks/buildhub.py
from pollbot.tasks import heartbeat_factory
heartbeat = heartbeat_factory('https://buildhub.stage.mozaws.net/v1/__heartbeat__')```
You will then need to register the heartbeat in the pollbot heartbeat view: pollbot/views/utilities.py
And to update the heartbeat tests.
You have helpers there that help you to:
- Convert the task into a standard view
- Give a title to the task
- Describe for which channel the task is supposed to be used
That's where we describe which route is routed to which view.
test_views.py
- Start by fixing the failing tests (heartbeat)
- Add a functional test
test_task.py
- Add tasks test for every status and every channel exceptions
- Test the error messages, the status and the urls
Make sure flake8 and the code coverage looks good.
You can look at few existing PR to work as examples:
- Balrog
- Buildhub
- [New product-details task](https://github.com/mozilla/PollBot/pull/80/files]