CLI for automated gitflow-style branching
Project description
Git Tide: Automated gitflow merge cycles with semantic versioning
tide
simplifies gitflow processes with automatic tagging and hot-fixing and promotion.
Features
- Automatic cascading merging of hotfixes from stable branches into experimental ones, e.g. alpha, beta, rc (this is the "ebb tide")
-
- Automated "promotion" of experimental branches forward to their next branch. e.g. alpha to beta, beta to rc, and so on. (this is the "flood tide" or "flow")
- Uses
commitizen
to create semver tags - Avoids merge conflicts between branches by using tags to store and query the latest version
Example flow
Here is an overview of the rules that tide
applies during automation:
NOTE: this document and repository use develop, staging, and master for it's gitflow branches but this behavior is configurable in the pyproject.toml and .gitlab-ci.yml files.
- New features should start as merge requests made against the
develop
branch (this is the default branch) - Commits that are merged to
develop
auto-generate a tag with a beta suffix: e.g.1.0.0b1
- Commits that are merged to
staging
auto-generate a tag with a release candidate suffix: e.g.1.0.0rc1
- Hotfixes that are added to
master
automatically merge tostaging
- Hotfixes that are added to
staging
automatically merge todevelop
- Promoting the release candidate to a new official release can be done two ways:
- Every pipeline on the
staging
branch has apromotion
job that can be manually run - A scheduled pipeline can be setup to do the same
- Every pipeline on the
- Either way, when the
promotion
job runs it will do 3 things:- Move the
master
branch to the tip ofstaging
and create a new release, stripping off therc
suffix - Move the
staging
branch to the tip ofdevelop
and create a new release, convertingb
torc
- Restart
develop
, incrementing the minor version, e.g. from1.1.0b4
to1.2.0b0
.
- Move the
Sample development cycle
Below is the Git commit graph demonstrating a sample development cycle using this project's branching strategy, including tags and hotfix propagation.
* auto-hotfix into develop: staging: add hotfix 2 - (HEAD -> develop, tag: 1.2.0rc0, tag: 1.2.0b2, staging)
|\
| * staging: add hotfix 2 - (tag: 1.1.0rc2, tag: 1.1.0, master)
* | auto-hotfix into develop: master: add hotfix - (tag: 1.2.0b1)
|\|
| * auto-hotfix into staging: master: add hotfix - (tag: 1.1.0rc1)
| |\
| | * master: add hotfix - (tag: 1.0.1)
* | | develop: add beta feature 2 - (tag: 1.2.0b0)
|/ /
* / develop: add feature 1 - (tag: 1.1.0rc0, tag: 1.1.0b0)
|/
* master: initial state - (tag: 1.0.0)
chronological tag order:
1.2.0rc0 promoting develop to staging!
1.1.0 promoting staging to master!
1.2.0b2 auto-hotfix into develop: staging: add hotfix 2
1.1.0rc2 staging: add hotfix 2
1.2.0b1 auto-hotfix into develop: master: add hotfix
1.1.0rc1 auto-hotfix into staging: master: add hotfix
1.0.1 master: add hotfix
1.2.0b0 develop: add beta feature 2
1.1.0rc0 promoting develop to staging!
1.1.0b0 develop: add feature 1
1.0.0 master: initial state
Setting up a repo
In order for tide
to work its magic, the Gitlab repo needs to be properly configured:
- Add a
[tool].tide
section to yourpyproject.toml
file to define the gitflow branch names and prerelease version you wish to use.[tool.tide] branches.beta = "develop" branches.rc = "staging" branches.stable = "master"
- Create a Project Access Token with the appropriate scope for being able to push tags, changes and create cicd variables.
- Run
tide init --access-token='YOUR_ACCESS_TOKEN'
- Copy and modify the
.gitlab-ci.yml
file ensuring the branch variables match the ones in thepyproject.toml
(TODO: automated generation of.gitlab-ci.yml
intide init
)
Development
Setting up your local development environment
- clone the repository using either https or ssh depending on your preference and then run the following commands:
python -m venv venv
.\venv\Scripts\Activate
pip install -r requirements.txt
pre-commit install
Local development info, tips, and tricks
nox
is the primary interface for what we'll be doing day to day and under the hood.
Use nox --list
to see the tasks that are available.
Running the unit tests
nox -s unit_tests
The primary test tests/test_unit.py::test_dev_cycle
can be run in several modes:
- local: simulated using local repos
- remote: integration testing using real gitlab repos
- gitlab-ci-local: simulated using local repos, but using the
.gitlab-ci.yml
file for entry-point and env var control. Requires installation of https://github.com/firecow/gitlab-ci-local
Here's how you run it in remote mode:
EXEC_MODE="remote" ACCESS_TOKEN="your-access-token-here" nox -s unit_tests -- tests/test_unit.py::test_dev_cycle -vv -s
Here's how you run it using gitlab-ci-local
:
EXEC_MODE="gitlab-ci-local" nox -s unit_tests -- tests/test_unit.py::test_dev_cycle -vv -s
Serving Documentation on GitLab Pages
Our project leverages GitLab Pages to host and serve the documentation generated by MkDocs. This setup ensures that all team members and stakeholders have access to the most current documentation relevant to the entire project.
How It Works
-
Unified Documentation: We maintain a single, comprehensive documentation system that reflects the latest changes in our codebase.
-
Automated Builds: The documentation is automatically built and updated whenever changes are made. This ensures that our documentation is always up-to-date with the latest codebase.
Benefits
- Simplified Access: Provides a single, consistent source of documentation for all stakeholders, simplifying access and reducing potential confusion.
- Immediate Updates: Changes to the documentation are immediately reflected upon updates, ensuring that the documentation always matches the current state of the project.
This streamlined approach to documentation allows our team to efficiently maintain and update project details, ensuring consistent and accessible information for everyone involved.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file git_tide-0.1.2.tar.gz
.
File metadata
- Download URL: git_tide-0.1.2.tar.gz
- Upload date:
- Size: 18.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.5 Darwin/22.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6ebd0d30f2a141325bcda42edcd879c1f426906357537d5eebf2bf2cb09350f |
|
MD5 | 7c838c9b7ee4046290298aed9ba8fdcc |
|
BLAKE2b-256 | e66608de0537b5011e70da0f258245a9902b25d4e3dcaf2fc762f38632d87f6a |
File details
Details for the file git_tide-0.1.2-py2.py3-none-any.whl
.
File metadata
- Download URL: git_tide-0.1.2-py2.py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.5 Darwin/22.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 556396c5fda2fb3f31154dde221f11379f5b5fa59f375372a94146a1e27298a2 |
|
MD5 | da54065c5038ad75b6e07b897199df81 |
|
BLAKE2b-256 | c50966010af9592d20fd5be9c519408c22176ac700d452d843f53ac9ffa5794a |