Skip to content

Commit c77a979

Browse files
authored
Merge pull request #928 from felixw7k/main
docs: Add example for opening a PR in Gitea with refspec
2 parents 124fd9f + fd132e2 commit c77a979

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

docs/spec/v1beta2/imageupdateautomations.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,13 @@ destination reference. An example of a valid refspec is
558558
If both `.push.refspec` and `.push.branch` are specified, then the reconciler
559559
will push to both the destinations. This is particularly useful for working with
560560
Gerrit servers. For more information about this, please refer to the
561-
[Gerrit](#gerrit) section.
561+
[Gerrit](#gerrit) section. This can also be used to automatically open
562+
Pull-Requests in Gitea or Forgejo. See the [Gitea](#gitea) section for
563+
an example.
564+
565+
If only `.push.refspec` is set, without explicitly defining a `.push.branch`, the
566+
controller falls back to pushing to the branch from `checkoutRef` and *also*
567+
pushes to `.push.refspec`.
562568

563569
**Note:** If both `.push.refspec` and `.push.branch` are essentially equal to
564570
each other (for e.g.: `.push.refspec: refs/heads/main:refs/heads/main` and
@@ -958,6 +964,42 @@ image tag to a different one, it leads to a distinct Change-Id for the commit.
958964
Consequently, this action will trigger the creation of an additional Change,
959965
even when an existing Change containing outdated modifications remains open.
960966

967+
#### Gitea
968+
969+
[Gitea](https://docs.gitea.com/usage/agit) and [Forgejo](https://forgejo.org/docs/latest/user/agit-support/) each implement the AGit-Workflow.
970+
This means, the image-automation-controller is able to open a pull-request by
971+
pushing to a `refspec` like `HEAD:refs/for/main` with the apropriate [push-options](#push-options).
972+
973+
The following example opens a PR on a Gitea or Forgejo-Server:
974+
975+
```yaml
976+
apiVersion: image.toolkit.fluxcd.io/v1beta2
977+
kind: ImageUpdateAutomation
978+
metadata:
979+
name: my-automation
980+
namespace: flux-system
981+
spec:
982+
git:
983+
checkout:
984+
ref:
985+
branch: main
986+
push:
987+
branch: flux-updates
988+
refspec: refs/heads/flux-updates:refs/for/main
989+
options:
990+
topic: flux-updates
991+
title: Flux Image Update
992+
description: |-
993+
This PR is automatically opened by the fluxcd *image-automation-controller*
994+
commit:
995+
author:
996+
997+
name: fluxcd
998+
messageTemplate: '{{range .Changed.Changes}}{{print .OldValue}} -> {{println
999+
.NewValue}}{{end}}'
1000+
```
1001+
1002+
9611003
## ImageUpdateAutomation Status
9621004

9631005
### Observed Policies

0 commit comments

Comments
 (0)