Closed minuscorp closed 6 years ago
I'll try to elaborate a little bit further what I'm trying to tackle in this idea. ATM, we have a single class GitRepo
which is responsible of doing everything related to Git operations, concretely with Github for now. Also we've got GithubService
that, through a set of credentials make possible to operate or obtain information given a repo name.
The main goal of the PR from this issue is to achieve the following:
Every User
has a number of ProviderCredentials
of a certain type
, as mean to communicate with the APIs of different code hosting services (Github, Bitbucket, Gitlab, etc).
For a given User
and a given ProviderCredential
a XXXCodeHostingService
must exist, normally under demand. None of this CodeHostingServices
are meant to be persisted in any way.
A CodeHostingService
provides a unified interface, independently of the ProviderCredential
type.
Its responsibilities are:
ProviderCredential
.Project
(the reachability of the Project
's repo will depend of the ProviderCredential
which created the CodeHostingService
.Project
's repo is done dependant of the JobTrigger
's branch attached to the Project
.Fastfile
s before the project being created (given the full repo name) or with the created Project
, in order to retrieve information to change its settings (branch, lane, etc.).Project
's repo with a certain branch every time a Build
is being triggered.A memoized CIConfigurationService
, which responsibilities are:
ci-config
repo up-to-date. Commit local changes, pushing them to remote, pulling possible remote changes, handle conflicts.DataSource
s may not be responsible of notifying changes to the CIConfigurationService
, through Watchmen
, the service should be automatically notified of any change made in the directory and consequently make the needed operations for keep a nice and clean historical record of all operations made to the ci-config
repo.I cc @KrauseFx and @taquitos to make a discussion on this architecture and if its the way to proceed. I'm totally able to tackle this task when approved for development.
We're going to handle these on the case-by-case bases, in smaller/separate issues/PRs 🍕
For now, we use a unified interface to operate over any repo using
GitRepo
. Which is not the best way to proceed, because we have two separate kind of scopes concerning repo operations, theci-config
and everyproject's repo
. i.e.,ci-config
repo should handle conflicts and synchronization in the best manner possible, butproject's repo
does we should make shallow clones, for certain branches, never ever commit changes into it, etc. So I think we should have extendedProjectService
to operate with project's repos and aci-config
repo service which handles their own operations separately.