Skip to content

Add scripts/post-sync.sh hook support#1

Merged
dymurray merged 2 commits into
dymurray:masterfrom
fabianvf:post-sync-hook
Jun 12, 2026
Merged

Add scripts/post-sync.sh hook support#1
dymurray merged 2 commits into
dymurray:masterfrom
fabianvf:post-sync-hook

Conversation

@fabianvf

Copy link
Copy Markdown
Contributor

After a successful merge (or submodule update), each managed repo's scripts/post-sync.sh runs if present and executable. Use it to regenerate files derived from upstream content — e.g. hash-locked requirements.txt for Hermeto/Konflux builds, or other midstream-specific build artifacts. Tracked-file changes are committed as post-sync: regenerate generated files for <branch>; honors --no-commit. Non-zero exit fails the repo and skips the push.

Mirrored in sync-and-merge.sh and sync-and-rebase.sh.

Motivating use case

migtools/mta-kai needs its kai_mcp_solution_server/requirements.txt to be hash-locked for Hermeto's pip backend (KONFLUX-14150, openshift-eng/art-tools#3047). Upstream konveyor/kai keeps an unhashed uv pip freeze-style file. With this hook, mta-kai ships a .gitattributes merge=ours rule for requirements.txt plus a scripts/post-sync.sh that regenerates the hash-locked file from the newly-merged pyproject.toml — so dep bumps upstream propagate to the Hermeto-compatible file automatically rather than silently going stale.

Companion PR opening shortly on migtools/mta-kai.

@fabianvf

Copy link
Copy Markdown
Contributor Author

Companion PR opened on migtools/mta-kai consuming this hook: migtools/mta-kai#4

fabianvf added 2 commits June 12, 2026 12:01
After a successful merge (or submodule update), each managed repo's
scripts/post-sync.sh runs if present and executable. Use it to
regenerate files derived from upstream content (e.g. hash-locked
requirements.txt for Hermeto/Konflux builds). Tracked-file changes are
committed as "post-sync: regenerate generated files for <branch>";
honors --no-commit. Non-zero exit fails the repo and skips the push.

Signed-off-by: Fabian von Feilitzsch <fabian@fabianism.us>
Git ships the `ours` merge strategy (git merge -s ours) but not the
matching per-file driver, so `.gitattributes` lines like
`some-file merge=ours` silently fall back to the default 3-way merge
unless the clone has `git config merge.ours.driver true`. Set it up
during clone so overlays paired with post-sync.sh work out of the box.

Signed-off-by: Fabian von Feilitzsch <fabian@fabianism.us>
@dymurray dymurray merged commit cc658b4 into dymurray:master Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants