feat: expose branch clean configuration via environment variables - #338
Open
mefellows wants to merge 1 commit into
Open
feat: expose branch clean configuration via environment variables#338mefellows wants to merge 1 commit into
mefellows wants to merge 1 commit into
Conversation
Wires in three new environment variables for the stale branch cleanup feature introduced in pact-foundation/pact_broker#912 and #933: - PACT_BROKER_DATABASE_CLEAN_KEEP_BRANCH_SELECTORS - PACT_BROKER_DATABASE_CLEAN_BRANCH_DELETION_LIMIT Also documents both vars in README alongside the existing clean settings. Note: PACT_BROKER_DATABASE_CLEAN_BRANCH_DELETION_LIMIT requires pact-foundation/pact_broker#938 to be merged and released before it has any effect at runtime. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Open
2 tasks
tuan-pham
approved these changes
Jun 30, 2026
Member
Author
|
This is good to merge when the next Pact Broker release goes out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wires in environment variables for the stale branch cleanup feature introduced in pact-foundation/pact_broker#912 and pact-foundation/pact_broker#933, and documents them in the README.
New environment variables
PACT_BROKER_DATABASE_CLEAN_KEEP_BRANCH_SELECTORS— JSON array of selectors controlling which branches are kept. Each selector supportsmax_age(days) and/orbranch(name or array of names). The pacticipant'smain_branchis always kept regardless. Defaults to[{"max_age": 90}]. Set to[]to disable stale branch cleanup entirely.PACT_BROKER_DATABASE_CLEAN_BRANCH_DELETION_LIMIT— Maximum number of stale branches to delete per clean run. Defaults toPACT_BROKER_DATABASE_CLEAN_DELETION_LIMIT.Changes
pact_broker/Rakefile— reads both env vars and forwards them toCleanTaskREADME.md— documents both vars in the existing database clean sectionPACT_BROKER_DATABASE_CLEAN_BRANCH_DELETION_LIMITrequires pact-foundation/pact_broker#938 to be merged and released before it has any effect at runtime. That PR addsbranch_deletion_limittoCleanTaskand forwards it toCleanIncremental. The env var is safe to ship now — it will silently have no effect until the gem is updated.Test plan
docker compose -f docker-compose-clean.yml uplocally and confirm clean task runs without errorsPACT_BROKER_DATABASE_CLEAN_KEEP_BRANCH_SELECTORS='[{"max_age":30}]'and confirm it is applied🤖 Generated with Claude Code