Cetmix Tower Git
Cetmix Tower Git manages Git Projects that produce specialized configuration files. These files can be used by various software tools to perform Git-related tasks.
Those tools are run with Commands and can be included in complex automation workflows using Flight Plans.
Currently the only supported format is the Git Aggregator, developed by ACSONE, which is a leading contributor to the OCA.
However this module can easily be extended to support other formats.
Installation
To use these functionalities, you must have the Cetmix Tower Git cetmix_tower_git
module installed. For further details, please refer to the Installing the Modules section of the documentation.
Access Rights
User must have at least Manager
access level to use Git Projects.
Git Project Configuration
Git Projects are located under the Cetmix Tower > Tools > Git Projects
menu.
Git Project consists of Git Sources, each of those can contain multiple Git Remotes.
Git Project Fields
Field | Description |
---|---|
Name | Project name |
Reference | Used for Odoo automation and YAML export/import. Leave blank to generate it automatically. |
Servers | List of Servers where the project is used. This field is readonly and is filled automatically. |
Sources | Project Git Sources. |
Files | Files that are linked to the Project. |
Info
Git Sources
Git Source represents a cumulative set of Git Remotes which are fetched into a single destination (eg a directory on a server).
Field | Description |
---|---|
Name | Source name |
Reference | Used for Odoo automation and YAML export/import. Leave blank to generate it automatically. |
Sequence | Sequence number for sorting. Lower number means higher position in the list. |
Enabled | Whether the source is used for the file generation. |
Remotes | List of Git Remotes which are fetched into a single directory. |
Info
The first one remote in the list will be used as a 'merge target'. You can re-arrange remotes by dragging them or changing their 'sequence' field value.
Git Remotes
Git Remote represents a specific branch, commit or Pull/Merge Request in a Git repository.
Field | Description |
---|---|
Sequence | Sequence number for sorting. Lower number means higher position in the list. |
Enabled | Whether the remote is used for the file generation. |
Is Private | If enabled this remote will be treated as a private repository when formatting linked files. |
URL Protocol | Protocol used to fetch the remote. Detected automatically based on the URL. |
Repository Provider | Repository provider. Detected automatically based on the URL, can be adjusted manually. |
URL | Repository URL. |
Head Type | Type of the head of the remote. Detected automatically based on the URL, can be adjusted manually. |
Head | Head of the remote. |
Note
Following providers are currently supported:
- GitHub
- GitLab
- Bitbucket
- Other
May not work for some on-premises installation URLs.
Note
Following head types are currently supported:
- Branch
- Pull/Merge Request
- Commit
Detection currently works for GitHub, GitLab and Bitbucket only.
Warning
As for January 2023 Bitbucket doesn't support fetchingPRs.
Linking Git Project to Files
Git Project can be connected with Files which content will be automatically generated based on the selected format. Linked files are updated automatically each time the Git Project is updated.
Field | Description |
---|---|
Git Aggregator Root Dir | Indicates the root directory for the files exported in the Git Aggregator format. |
Server | Server which hosts the linked file. |
File | File which is linked to the Git Project. |
Format | Format used to save data to the linked file. |
Warning
Same file can be linked to multiple Git Projects. However this is not recommended and may lead to unexpected results.
Info
Linked Git Projects are also available in the "Git Projects" tab of the Server form.
File Content
File content is generated based on the Format
value of the Project->File
link.
Below is an example of the file content in the Git Aggregator format which is generated from the project shown in the screenshots above.
# This file is generated with Cetmix Tower https://cetmix.com/tower
# It's designed to be used with git-aggregator tool developed by Acsone.
# Documentation for git-aggregator: https://github.com/acsone/git-aggregator
# You need to set the following variables in your environment:
# GITLAB_TOKEN_NAME, GITHUB_TOKEN, GITLAB_TOKEN
# and run git-aggregator with '--expand-env' parameter.
./cetmix_tower:
remotes:
remote_1: https://github.com/cetmix/cetmix-tower.git
remote_2: git@github.com:cetmix/cetmix-tower.git
merges:
- remote: remote_1
ref: 14.0-dev
- remote: remote_2
ref: refs/pull/176/head
target: remote_1
./oca_web:
remotes:
remote_1: git@github.com:OCA/web.git
merges:
- remote: remote_1
ref: '14.0'
target: remote_1
defaults:
depth: 1
./odoo_enterprise:
remotes:
remote_1: https://$GITHUB_TOKEN:x-oauth-basic@github.com/odoo/enterprise.git
merges:
- remote: remote_1
ref: '14.0'
target: remote_1
defaults:
depth: 1
./bitbucket_private:
remotes:
remote_1: git@bitbucket.org:cetmix/some-private-repo-sample.git
remote_2: git@bitbucket.org:cetmix/some-private-repo-sample.git
merges:
- remote: remote_1
ref: dev
- remote: remote_2
ref: '1234567890'
target: remote_1
./gitlab_private:
remotes:
remote_1: https://$GITLAB_TOKEN_NAME:$GITLAB_TOKEN@gitlab.com/cetmix/some-private-repo-sample.git
remote_2: https://gitlab.com/cetmix/some-private-repo-sample.git
remote_3: https://gitlab.com/cetmix/some-private-repo-sample.git
merges:
- remote: remote_1
ref: main
- remote: remote_2
ref: merge-requests/1234/head
- remote: remote_3
ref: '333222111'
target: remote_1
Note
- Remotes with
is_private
set toTrue
are formatted based on theRepository Provider
andURL Protocol
field values. Environment variables thar are used to fetch private repositories are listed in the comment at the top of the file. ref
field is formatted based on the Git RemoteHead Type
andRepository Provider
field values.target
is always the first remote in the list.- Sources with a single remote have the
defaults
section with thedepth
field set to1
. This is done to avoid fetching the entire repository history.