I’m going to change ick to manage actions in build graphs in way to make it sensible to add actions to do notifications later on. Here’s what I’m planning.

  • Each build will have a state: triggered, building, done, failed. Later on, I will add states notifying-ok, and notifying-fail, for doing notifications.

  • Each action in the build graph will have dependencies (which actions must succeed before the action can be done). Dependencie will refer to other actions via an build-local identifier, so that will be added as well. Actions will also have a state: blocked (not all dependencies are satisfied), ready (action can be executed), building (a worker is executing the action), done (action succeeded), failed (action failed).

  • When actions are created, the first action of the first pipeline will be in state ready, everything else will be blocked and depending on the previous action.

  • Currently builds have a current-action attribute. This will be removed. Instead, the controller will scan the build graph for available actions that it can assign to a worker (state is ready), when a worker needs something to do.

  • When an action fails, the controller marks it to have state failed, and also marks the build as state failed.

  • When an action succeeds, the controller marks it as done. It then scans all the actions, and marks any actions that are in state blocked as ready, if all the actions it depends on are now in state done. If all actions are now in state done, the controller marks the build as done.

Later on, I will change this so that when all actions are done, the build moves to state notifying-ok, and the controller adds notification actions. If an action fails, the build is marked as notifying-fail, and adds appropriate notification actions.

The build state diagram will be like this:

@startuml

[*] --> triggered : build is created
triggered --> building : build startsd
building --> notifying_ok : all actions ok
notifying_ok -right-> notifying_fail : notification failed
notifying_ok --> done : notifications done
building --> notifying_fail : action failed
notifying_fail --> failed : notifications done

@enduml

Actions state diagrams will be like this:

@startuml

[*] --> blocked : has deps
[*] --> ready : no deps
blocked --> ready : all deps done
ready --> building : assigned to worker
building --> done : action finished OK
building --> failed : action failed

@enduml