Cetmix Tower Git
Cetmix Tower Git manages Git Projects. Link a project to a Jet and write it to the host with the Upload Git Project command. The generated file can be used by tools such as Git Aggregator.
Those tools are run with Commands and can be included in 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.
Video Tutorial
Following video provides a brief overview of the Git Projects functionality.
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 Rules
Jet Git Projects (a project linked to at least one Jet) are guarded only by Jet access:
| Group | Action | Condition |
|---|---|---|
| User | R | The user can read any Jet that uses the project |
| Manager | R | The user can read any Jet that uses the project |
| Manager | CRUD | The user can write all Jets that use the project |
| Root | CRUD | Any record |
Legacy projects (no Jets) keep the server-based rules:
| Group | Action | Condition |
|---|---|---|
| User | - | No access |
| Manager | R | User is added in "Users" or "Managers" |
| Manager | CRU | User is added in "Managers" |
| Manager | CRUD | User is added in "Managers" and record is created by the user |
| Root | CRUD | Any record |
Info
CRUD stands for Create, Read, Update, Delete.
Git Projects in Jets
A Jet has one Git Project. Several Jets may share a project. Set it when the Jet is launched or cloned, or on the Jet Git Project tab.
The tab shows the project and a flat list of remotes (one repository per line): Repository, Protocol, Head Type, Head, Enabled, and a read-only Source. Reordering the list is the source of truth for remote and source order.
Grouping rules:
| # | Rule |
|---|---|
| G1 | Adding a line for repository R uses an existing source that already contains R, or creates a new source named owner/repo. |
| G2 | If several sources contain R, the first source in source order (sequence, then name) is used. |
| G3 | Changing a line's repository moves the same remote to the source chosen with G1/G2. A source left without remotes is deleted. |
| G4 | Deleting a line deletes the remote. A source left without remotes is deleted. |
| G5 | A new remote is appended after the existing remotes of its source. The first remote of a source is the git-aggregator merge target. |
After a reorder, remote order within a source follows that source's lines in the list, and source order follows the first line of each source.
Write the project to the host with the Upload Git Project command. Default Path is the directory; File Name is the file name.
Access: a Jet project is readable through any Jet the user can read, and writable only when the user can write every Jet that uses it. Server-based rules do not grant or restrict access to Jet projects. When a Jet is deleted, its project is deleted if no other Jet, server file link, or flight plan line uses it.
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. Legacy: used for servers that do not use Jets. New setups should link the Git Project to the Jet and write it with Upload Git Project. |
| Jets | Jets that use this project. Readonly. |
| Root Directory | Root directory used when generating git-aggregator files. Leave blank to use .. |
| 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.
Secret
Repository and Repository Owner have a Secret field. It stores a repository-specific or owner-specific secret and is not currently used. Private HTTPS URLs use environment placeholders ($GITHUB_TOKEN, $GITLAB_TOKEN_NAME:$GITLAB_TOKEN, $BITBUCKET_TOKEN).
Linking Git Project to Files
Legacy
Server ↔ project ↔ file links are legacy, kept only for servers that do not use Jets. New setups should link the Git Project to the Jet (Jet Git Project tab or the launch/clone wizards) and write it to the host with the Upload Git Project command.
Git Project can be connected with Files whose content is generated automatically. Linked files are updated each time the Git Project is updated.
| Field | Description |
|---|---|
| Server | Server which hosts the linked file. |
| File | File which is linked to the Git Project. |
| Auto Sync | The linked file's Auto Sync setting. |
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. That tab is legacy — see Git Projects in Jets for new setups.
File Content
File content is generated from the project in git-aggregator format.
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: https://$BITBUCKET_USER:$BITBUCKET_APP_PASSWORD@bitbucket.org/my_workspace/my_private_repo.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_privateset toTrueare formatted based on theRepository ProviderandURL Protocolfield values. Environment variables thar are used to fetch private repositories are listed in the comment at the top of the file. reffield is formatted based on the Git RemoteHead TypeandRepository Providerfield values.targetis always the first remote in the list.- Sources with a single remote have the
defaultssection with thedepthfield set to1. This is done to avoid fetching the entire repository history.
YAML Format Specification
Git Project
cetmix_tower_model: git_project
reference: demo_git_project
name: Demo Git Project
note: This is a demo git project. # Text. Optional comments or user notes.
source_ids: # List of Git Source references or Git Source objects.
- cetmix_tower_git_source # Git Source reference or a Git Source object.
- oca_web # Git Source reference or a Git Source object.
- odoo_enterprise # Git Source reference or a Git Source object.
- bitbucket_private # Git Source reference or a Git Source object.
- gitlab_private # Git Source reference or a Git Source object.
git_aggregator_root_dir: /tmp/git_aggregator # String. Root directory for the files exported in the [Git Aggregator](https://github.com/acsone/git-aggregator) format.
Git Source
reference: cetmix_tower_git_source
name: Cetmix Tower
enabled: true
sequence: 10 # Integer. Sequence number for sorting. Lower number means higher position in the list.
remote_ids: # List of Git Remote references or Git Remote objects.
- cetmix_tower_git_remote_1 # Git Remote reference or a Git Remote object.
- cetmix_tower_git_remote_1_2 # Git Remote reference or a Git Remote object.
Git Remote
reference: oca_web_git_remote_1
name: remote_1
enabled: true # Boolean. Whether the remote is used for the [file](../files/file.md) generation.
sequence: 10 # Integer. Sequence number for sorting. Lower number means higher position in the list.
is_private: false # Boolean. If enabled this remote will be treated as a private repository when formatting linked files.
url: git@github.com:OCA/web.git # String. Repository URL.
repo_provider: github # String. Repository provider.
head: '14.0' # String. Head of the remote.
head_type: branch # String. Head type of the remote. Possible values: branch, pr, commit.
Please refer to the General YAML Format Specification for more details.





