Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions docs/configuration/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,50 @@ Configuring building in Copr project `@oamg/convert2rhel`:
</details>


<details>
<summary>Running Copr builds from a fork without changing the upstream project</summary>

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.
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.
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.

</details>

<details>
<summary>Running more types of builds in Copr</summary>

Expand Down
10 changes: 8 additions & 2 deletions docs/configuration/upstream/copr_build.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
Loading