comin supports several remotes and each of these remotes can have a
main and testing branches. A new commit can be submitted in all of
these branches and comin need to decide which one to choose.
The comin goal is to
- refuse commits push-forced to
mainbranches - only allow
testingbranches on top ofmainbranches - prefer commits from
testingbranches
Here is the algorithm used to choose the next commit to deploy:
- Fetch a subset of remotes
- Ensure commits from updated
mainandtestingbranches are not behind the lastmaindeployed commit - Get the first commit from
mainbranches (remotes are ordered in the configuration) on top of the last deployedmaincommit. If no such commit exists, comin gets the first commit equal to the last deployedmaincommit. - Get the first
testingcommit on top of the previously chosenmaincommit. If no such commit exists, comin uses the previously chosenmaincommit.
The main comin components are
- the fetcher: fetch commits from remote and produce
RepositoryStatus. - the builder: from a
RepositoryStatus, it creates aGenerationwhich is then evaluated and built. - the deployer: from a
Generation, it creates aDeploymentwhich is used to decide how to run theswitch-to-configurationscript. - the manager: it is in charge of managing all this components.
- the store: hold
DeploymentsandGenerationsdata structures.
The builder actually evaluates and builds fetched commits. The builder only runs a single task. It first evaluates a commit and then can build it. If a new commit is submitted for evaluation, a current running evaluation or build is stopped.
The store is in charge of managing all Generations and Deployments
used by comin. This is a centralized store, which is used by all
others components (the builder, deployer, ...) to get and update
Generation and Deployment objects.
The store is also in charge of the persisence: it writes all these data to a file in order to preserve them across comin restarts.
Protobuf has been introduced to be able to stream events from the agent to the CLI client. This was pretty hard to achieve with the previous HTTP Rest API.