agola-io/agola

notification service: save commit status and deliveries

Closed this issue · 0 comments

What would you like to be added:
Actually the notification service implement the update remote commit status when it handle a RunEvent.
We would like to separate the logic of creation of the commit status from the delivery, as done for run webhooks.

Why is this needed:
It could be useful for example for a future implementation of delivery retry logic.
We avoid duplicated commit status deliverys: we can save the commit status and delivery in the same db transaction, where it is saved the LastRunEventSequence(and RunWebhook, RunWebhookDelivery).
A dedicated handle will do the delivery, as done for RunWebhookDelivery.

It is needed to add 2 table:

CommitStatus
* ProjectID    string
* Status string
* CommitSHA    string
* RunCounter   uint64
* Description  string
* Context      string
CommitStatusDelivery
* Sequence uint64
* CommitStatusID string
* DeliveryStatus DeliveryStatus
* DeliveredAt *time.Time