Repository
Summary
Infrahub supports two different types of connections to external Git repositories
- Repository fully integrates with Git version control, including branch tracking and two-way branch synchronization.
- Read-only Repository links a particular branch in Infrahub to a particular ref in the Git repository. It will only read from the Git repository. It will never make any changes to the external repository.
See the guide for instructions on creating repositories in Infrahub.
.infrahub.yml
file
The .infrahub.yml
configuration file specifies exactly what should be imported into Infrahub from the external repository, it could be transformations, GraphQL query, artifact definitions, generators ...
See this topic for a full explanation of everything that can be defined in the .infrahub.yml
file.
Architecture
The Infrahub web server will never connect directly with external Git repositories. All interactions between Infrahub and remote Git repositories are handled by the Task worker. The Task worker(s) can work with any remote Git server that using either git
or http
protocols. The Infrahub web server can send commands to the Task worker via our message broker and the Task worker can send data back to the Infrahub web server via GraphQL mutations.
Infrahub stores all of the data that it needs for every remote repository in a directory defined by the git.repositories_directory
setting in infrahub.toml
. When the Task worker receives an instruction to update a remote repository, it pulls data from the remote repositories and saves it to the filesystem in the git.repositories_directory
directory. The Task worker then parses the new data and sends the necessary GraphQL mutations to the Infrahub web server. Infrahub attempts to update Repository
with any changes in the remote repository several times per minute. Read-only repositories are only updated when specifically requested.
Please note that each Task worker must have access to the same directory on the file system so that they can share work among each other.
Read-only Repository vs. Repository
Feature | Repository | Read-only Repository |
---|---|---|
Branches | Tracks all remote branches | Data from one remote commit imported to one Infrahub branch |
Updates from remote | Automatic via background task | Manually, by updating ref |
Updates to remote | When merging Proposed Change | No |
Read-only Repository
Read-only Repositories will only pull data from an external repository into Infrahub and will never push any data to the external repository. A Read-only Repository will pull changes from a single ref
(branch, tag, or commit) into the Infrahub branch(es) on which it exists. Read-only repositories are not automatically updated. To update a Read-only Repository, you must manually update the ref
property to a new value, then the Task worker will pull the appropriate commit and create the appropriate objects in Infrahub.
See the guide for instructions on pulling changes from read-only repositories in Infrahub.
Repository
When you create a Repository
, Infrahub will try to pull every branch defined in the external repository and create an associated Infrahub branch with the same name and matching data according to what is defined in the .infrahub.yml
configuration file on the particular remote branch. Infrahub will attempt to sync updates from the external repository several times per minute in a background task that runs on the Task worker(s).
Editing a given GraphQL Query, Transform, Artifact Definition, or Schema within Infrahub will not result in those changes being pushed to the external repository and could potentially be overwritten when Infrahub pulls new commits from the external repository. Infrahub will only push changes to an external repository when a Proposed Change is merged for which the source and destination branch are both linked to branches on the same external repository. In this case, Infrahub will attempt to create a merge commit and push that commit to the destination branch on the external repository.
Repository statuses
Repository object has three status fields, all tracking various metrics.
See this guide for instructions on troubleshooting repositories.
Admin status
Admin status keeps track of Infrahub usage of a repository.
- Active
- Inactive
- Staging
Infrahub is actively using this repository.
Infrahub isn't using this repository.
Infrahub is waiting the next proposed change to bring this repository up.
Operational status
Operational status keeps track of the connectivity between Infrahub and the Repository.
- Unknown
- Error cred
- Error connection
- Error
- Online
Can't compute the operational status.
Infrahub can't authenticate to the repository.
Infrahub can't reach the repository.
Issue happened when adding the repository.
Repository is up and running.
Sync status
Sync status keeps track of the synchronisation operation's output.
- Unknown
- In sync
- Error import
- Syncing
Can't compute the sync status.
All assets stored on the repository are synced in Infrahub.
Something wrong happened while importing repository to Infrahub.
Sync operation is ongoing.
Repository actions
From the repository detailed view you can open a "More" menu containing advanced actions to interact with the repository.
- Check connectivity
- Reimport last commit
Infrahub will try to reach the repository and authenticate.
Infrahub will fetch files on the remote repository with the existing commit identifier. This action won't change the reference on Infrahub side (for example pull the latest commit). This might be useful to force an import after having fixed data on Infrahub side.