From a440d5c8af3454f0e7b671241f16c8a6d266ae90 Mon Sep 17 00:00:00 2001 From: Nitjsefnie Date: Thu, 22 Oct 2026 20:47:44 +0200 Subject: [PATCH 1/2] docs: document commit branch regexes and fork Copr builds Co-Authored-By: GPT-6.1 Sol Signed-off-by: Nitjsefnie --- docs/configuration/examples.md | 43 +++++++++++++++++++++++ docs/configuration/upstream/copr_build.md | 10 ++++-- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/docs/configuration/examples.md b/docs/configuration/examples.md index 9fc50d84d3..aaa4f3eb2e 100644 --- a/docs/configuration/examples.md +++ b/docs/configuration/examples.md @@ -205,6 +205,49 @@ Configuring building in Copr project `@oamg/convert2rhel`: +
+ Running Copr builds from a fork without changing the upstream project + +An upstream repository can use explicit `owner` and `project` values to build in a +custom Copr project. If a fork is not allowed to use that project, the same job +fails with a permissions error when run from the fork. + +Add a second job without `owner` or `project` to use Packit's default Copr project +naming, which includes the fork's namespace. In this example, the default branch +is `main` and fork work happens on other branches: + +```yaml +jobs: +- job: copr_build + trigger: commit + branch: main$ + identifier: upstream + owner: "@oamg" + project: convert2rhel + targets: + - fedora-stable + +- job: copr_build + trigger: commit + branch: '^(?!main$).*' + identifier: fork + targets: + - fedora-stable +``` + +The distinct `identifier` values are needed for correct reporting with multiple +`copr_build` jobs. The second job uses Packit's default owner and project, so it +does not need permission to build in the upstream Copr project. It matches +branches other than `main`, including `main-fix` and `main/probe`. +Change `main` in both patterns if your default branch has a different name. + +These filters apply in both repositories: a push to upstream's `main` runs the +job with the custom project without a duplicate build in the default project. +A push to the fork's `main` still selects that job and can fail its permissions +check; use a non-default branch for fork builds. + +
+
Running more types of builds in Copr diff --git a/docs/configuration/upstream/copr_build.md b/docs/configuration/upstream/copr_build.md index d8f6042a86..a317696516 100644 --- a/docs/configuration/upstream/copr_build.md +++ b/docs/configuration/upstream/copr_build.md @@ -40,8 +40,14 @@ With this configuration, you'll get builds in all stable fedora releases ## Optional parameters -* **branch** - the name of the branch we want to build for when using **commit** trigger -(defaults to the repository's default branch) or target branch when using **pull_request** trigger +* **branch** - the branch name or Python regular expression to build for when using **commit** trigger + (defaults to the repository's default branch). Matching uses Python's + [`re.match`](https://docs.python.org/3/library/re.html#re.match): it starts at the + beginning of the branch name, so `^` is optional, and does not need to match the whole name. + For example, `branch: main` also matches `main-fix` and `main/probe`; + use `branch: main$` to match just `main`. + To build on every branch except `main`, use `branch: '^(?!main$).*'`. + With **pull_request** trigger, this option specifies the target branch (default behaviour is reacting to all pull requests in the repository). * **timeout** - (seconds) give up watching a build after timeout, defaults to 7200s, i.e. 2 hours. * **owner** - a namespace in Copr where the build should happen (defaults to packit). From a07a67f056750142f9d46f7dc3cec3c781d54a25 Mon Sep 17 00:00:00 2001 From: Nitjsefnie Date: Thu, 22 Oct 2026 20:54:56 +0200 Subject: [PATCH 2/2] docs: clarify escaping branch regex metacharacters Co-Authored-By: GPT-6.1 Sol Signed-off-by: Nitjsefnie --- docs/configuration/examples.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/configuration/examples.md b/docs/configuration/examples.md index aaa4f3eb2e..e843da703d 100644 --- a/docs/configuration/examples.md +++ b/docs/configuration/examples.md @@ -240,6 +240,7 @@ The distinct `identifier` values are needed for correct reporting with multiple does not need permission to build in the upstream Copr project. It matches branches other than `main`, including `main-fix` and `main/probe`. Change `main` in both patterns if your default branch has a different name. +Escape regex metacharacters in the name (e.g. `release\.1` for `release.1`). These filters apply in both repositories: a push to upstream's `main` runs the job with the custom project without a duplicate build in the default project.