Skip to content

Document commit-trigger branch regexes and fork-safe Copr builds - #1182

Open
Nitjsefnie wants to merge 3 commits into
packit:mainfrom
Nitjsefnie-OSC:docs/664-branch-regex-fork-builds
Open

Nitjsefnie wants to merge 3 commits into
packit:mainfrom
Nitjsefnie-OSC:docs/664-branch-regex-fork-builds

Conversation

@Nitjsefnie

@Nitjsefnie Nitjsefnie commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Document that the branch option of a trigger: commit Packit job accepts a Python regular expression — matching uses re.match, anchored at the start of the branch name (^ unnecessary) and not required to consume the whole name, so branch: main also matches main-fix and main/probe — and add a worked example for getting Copr builds from a fork when the upstream config pins an explicit Copr owner/project: a second job without owner/project (Packit's default project naming works from a fork) with a distinct identifier, restricted to non-default branches via a branch regex. It also states that an unset branch on a commit job uses the default branch name as the same regex, and that the pull_request target branch is matched the same way.

Related Issues and Pull Requests

Fixes #664
Partially address #631

Changes

  • docs/configuration/upstream/copr_build.md: the branch bullet now documents regex support with the exact matching semantics (start-anchored re.match, partial match allowed), a plain-name example and its exact-name variant (main$), and a worked "every branch except the default" pattern ^(?!main$).*. It also says an unset branch falls back to the default branch name matched as the same regex (so an exact match needs an explicit branch: <name>$), and that with pull_request the option is matched the same way against the PR's target branch.
  • docs/configuration/examples.md: new "Running Copr builds from a fork without changing the upstream project" example — keep the upstream job with explicit owner/project, add a second job without them (default Copr naming), give both jobs distinct identifier values, and split them with complementary main$ / ^(?!main$).* branch filters; notes the regex-metacharacter escaping caveat for other default branch names and the remaining permission limitation for pushes to the fork's main.

Testing

Docs-only change; no runtime behavior changed. The example YAML parses (yaml.safe_load), and the documented matching semantics were verified against packit-service's matching source (packit_service/worker/helpers/build/build_helper.py uses re.match) and probed with Python. Fork CI green on the branch head 4ed8085: run 40682426904 on the fork, 1 job green, provenance echo naming that SHA.

Footer

Generated by GLM-5.3-Flash (brief, orchestration), Claude Opus 5.5 (orchestration), GPT-6.1 Sol (implementation), GPT-6.1 Terra (implementation), GPT-6 Astra (review)

@centosinfra-prod-github-app

Copy link
Copy Markdown
Contributor

@Nitjsefnie

Copy link
Copy Markdown
Contributor Author

Heads-up: this branch lives in an organization-owned fork, and GitHub doesn't let maintainers push to those. If anything needs changing, just say so here and I'll make the change on this branch right away.

@majamassarini

Copy link
Copy Markdown
Member

/fs-review

@fullsend-ai-review

fullsend-ai-review Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 10:57 AM UTC · Completed 11:10 AM UTC

Commit: a07a67f · View workflow run →

Runtime: claude · Model: opus → claude-opus-5-5 · Effort: high · Cost: $3.94

@fullsend-ai-review fullsend-ai-review Bot added the risk/low PR risk: low label Oct 28, 2026
@fullsend-ai-review

Copy link
Copy Markdown

<!-- fullsend:risk-assessment -->
Risk Assessment: low (1/5)

Details

Small docs-only change (2 files, 54 lines) by a returning contributor, with no protected, security-sensitive, CI or dependency files and no recent churn or fix history; old files and long-open linked issues raise some sub-scores but the composite (1.47) rounds to 1.

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

Low

  • [edge-case] docs/configuration/upstream/copr_build.md:44: The new text suggests that leaving branch unset gives an exact match on the default branch. packit-service actually uses job_config.branch or self.project.default_branch and passes it to re.match, so an unset branch also matches main-fix, main/probe, and so on.
    Remediation: State that the default behaves like branch: <default branch name> (same match-from-the-start behaviour) and that an exact match needs an explicit branch: <name>$.
  • [edge-case] docs/configuration/upstream/copr_build.md:50: Only the commit trigger now has the regex / re.match explanation. packit-service matches the PR target branch the same way (re.match(configured_branch, target_branch)), so trigger: pull_request with branch: main also matches PRs that target main-fix. Readers may assume PR matching is exact.
    Remediation: Say that with the pull_request trigger the value is also a Python regex, matched with re.match against the target branch with the same behaviour.
  • [incomplete-doc] docs/configuration/upstream/upstream_koji_build.md:40: The same branch option on the upstream Koji build page still has the old 'name of the branch' wording. The sibling job pages now describe one shared, job-level option differently. This file is not changed by this PR, and the gap existed before it.
    Remediation: Update the branch bullet (lines 40-42) to match the new copr_build.md text, or link to it.

Labels: Docs-only PR documenting Copr build branch-regex configuration and a fork Copr example.


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

@fullsend-ai-review fullsend-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the review comment for full details.

Comment thread docs/configuration/upstream/copr_build.md Outdated
Comment thread docs/configuration/upstream/copr_build.md Outdated
@fullsend-ai-review fullsend-ai-review Bot added kind/documentation Improvements to docs area/config Related to the configuration area/copr Related to the Copr integration labels Oct 28, 2026
Nitjsefnie and others added 2 commits October 28, 2026 12:24
@majamassarini
majamassarini force-pushed the docs/664-branch-regex-fork-builds branch from a07a67f to b010b13 Compare October 28, 2026 11:24
@centosinfra-prod-github-app

Copy link
Copy Markdown
Contributor

@Nitjsefnie
Nitjsefnie marked this pull request as draft October 28, 2026 11:43
Explain how default and pull request branches are matched.

Co-Authored-By: GPT-6.1 Terra <[email protected]>
Signed-off-by: Nitjsefnie <[email protected]>
@centosinfra-prod-github-app

Copy link
Copy Markdown
Contributor

@Nitjsefnie
Nitjsefnie marked this pull request as ready for review October 28, 2026 11:49
@Nitjsefnie

Copy link
Copy Markdown
Contributor Author

Pushed 4ed8085 on top of your rebase; it addresses both copr_build.md findings. The branch wording on the upstream Koji build page predates this PR (same regex question as #664); I'm happy to align that page on this branch too if you'd like.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Related to the configuration area/copr Related to the Copr integration kind/documentation Improvements to docs risk/low PR risk: low

Projects

Development

Successfully merging this pull request may close these issues.

A way to set specific branches triggered on push (commit).

2 participants