Add tests to Job::Test.cancelable?
Fix Build#cancelable?

Build should be cancelable if at least one of the job is cancelable. In
such case cancelling a build will cancel all the jobs it can and set the
build to cancelled state.
Improve cancel events on job and build

* Cancel event on job should cancel the job and set the build into
  canceled state if the matrix is finished.
* Cancel event on build should cancel all the cancelable jobs and set
  build into canceled state
* canceled_at should be set when cancelling a build or a job
Add specs for cancel_job service
Fix setting state when build should be canceled

If any of the builds is canceled, the state should be canceled, before
this commit it could be errored, because errored check was before
canceled check.

The fix is sponsored by @joshk's super code reviews :heart:
Add specs for cancel_build
Add cancelable to build and job payloads

In order to not move too much business logic, I added cancelabke?
attribute to all build's and job's payloads. This will increase the
amount of data we send, but on the other hand it will greatly reduce a
cost of changing cancel logic (which I'm sure will be changed soon, as
it handles only the simplest scenario at the moment)
Revert "Add cancelable to build and job payloads"

This reverts commit 03ddc1ee0bfc37d7a900376ae7c48eeb97dbbaef.

The idea of encapsulating logic in the API is nice, but after all our
live updates model is not ideal for such task. The problem is that we
won't send updates to build if cancelable changes, because it may happen
without changing state of the build.

For example: a build has 2 jobs. One job is in created state and the
other is in passed. Currently, a build is cancelable when any of its
jobs is cancelable, so in such situation the build is cancelable. When
state of the created job changes to queued, its no longer cancelable and
thus build should also be not cancelable, but because there was no
change of the build's state, pusher update won't be sent.

Ideally, in the future, we should make pusher updates smarter, but for
now it will be hard to pursue having only one place for such logic.
Send cancel event to the worker when canceling job
Send cancel even to the worker if it sends events for canceled job

When we cancel a job, we send info to a worker, but the worker may
not get the message, for example it may be booting. If the worker for some
reason sends a message about started or finished build, we should ignore
the message and send another message to the worker to cancel the job.
Allow to cancel jobs after they're started
Don't send cancel event to the worker if a job hasn't started yet
Send pusher events on canceled state
Add info about passed options in error message on API serialization
Create proper payload for job/canceled and build/canceled events
Always publish cancel event to the worker
Debug
Set 'finished_at' property on build and job when canceling
Properly update repository after build finishes, with canceled job
Merge branch 'ps-cancel'