From 26aec4f1c63174465b37948a7d3097889d031243 Mon Sep 17 00:00:00 2001 From: Nitjsefnie Date: Thu, 22 Oct 2026 20:47:44 +0200 Subject: [PATCH 1/3] 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 0c7dbee24c..f0a38ceae4 100644 --- a/docs/configuration/examples.md +++ b/docs/configuration/examples.md @@ -221,6 +221,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 debeaafe2ad47b68d29df7896985edc35108c840 Mon Sep 17 00:00:00 2001 From: Nitjsefnie Date: Thu, 22 Oct 2026 20:54:56 +0200 Subject: [PATCH 2/3] 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 f0a38ceae4..6c106994b5 100644 --- a/docs/configuration/examples.md +++ b/docs/configuration/examples.md @@ -256,6 +256,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. From 5ea6b91aba997de8a0524d68b704c6046f6bf939 Mon Sep 17 00:00:00 2001 From: Nitjsefnie Date: Wed, 28 Oct 2026 12:25:50 +0100 Subject: [PATCH 3/3] docs(copr): clarify default and PR branch matching Explain how default and pull request branches are matched. Co-Authored-By: GPT-6.1 Terra Signed-off-by: Nitjsefnie --- docs/configuration/upstream/copr_build.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/configuration/upstream/copr_build.md b/docs/configuration/upstream/copr_build.md index a317696516..31761c10d3 100644 --- a/docs/configuration/upstream/copr_build.md +++ b/docs/configuration/upstream/copr_build.md @@ -41,13 +41,16 @@ With this configuration, you'll get builds in all stable fedora releases ## Optional parameters * **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 + (defaults to the repository's default branch name, used as a regular expression; + for an exact match, set `branch: $` with regex metacharacters in the name escaped). + 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 + With **pull_request** trigger, this option is matched the same way against + the PR's 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).