- Python 78.5%
- Shell 21.5%
| scripts | ||
| src/pricer | ||
| tests | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| CHANGELOG.md | ||
| GitLab_CI_CD_Жизненный_цикл_Workflow_marp.md | ||
| GitLab_CI_CD_Жизненный_цикл_Workflow_marp.pdf | ||
| pyproject.toml | ||
| pytest.ini | ||
| README.md | ||
| Заметки_докладчика_Жизненный_цикл_Workflow.md | ||
Pricer
Tiny cart-pricing demo used to showcase trunk-based development (TBD).
What this repository demonstrates
- A single long-lived branch:
main(the trunk). - Small, frequent, atomic commits pushed straight to trunk.
- Short-lived branches (minutes-to-hours) that are squash-merged and deleted.
- Incomplete work shipped behind a feature flag (
DISCOUNT_ENGINE). - Releases are lightweight tags on trunk (
v1.0.0,v1.0.1,v1.1.0). - CI runs on every push (
.gitlab-ci.yml).
Layout
src/pricer/ package source
tests/ pytest test suite
Usage
pip install -e .
pricer --items '[{"price": 100, "qty": 1}]' --discount 10
Feature flags
DISCOUNT_ENGINE— enables the discount engine (default: on since v1.1.0).
export DISCOUNT_ENGINE=1
Releases
Releases are lightweight tags on the trunk. To cut a release, use the short-lived release branch (created at release time, not beforehand):
scripts/release.sh 1.2.0
This cuts release/1.2.0, bumps the version, and leaves the final
merge/tag steps for you — the branch should live only a few minutes.
Protected trunk
The trunk (main) is protected in GitLab: no direct pushes, changes land
through merge requests with CI passing. Configure it via the API:
curl --request POST \
--header "PRIVATE-TOKEN: <your-token>" \
"https://gitlab.example.com/api/v4/projects/<project-id>/protected_branches?name=main&push_access_level=40&merge_access_level=30&allow_force_push=false"
push_access_level=40 (Maintainers only) · merge_access_level=30 (Developers+).
Auto-tags
The release job in .gitlab-ci.yml reads project.version from
pyproject.toml and pushes a vX.Y.Z tag on every trunk build, unless the
tag already exists. It needs a masked project access token GL_TAG_TOKEN
with write_repository scope.