You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `githubdispatch` webhook triggers a GitHub webhook event called [`repository_dispatch`](https://docs.github.com/en/rest/reference/repos#create-a-repository-dispatch-event) for the selected repository. The `repository_dispatch` event can be used to trigger a GitHub Actions workflow with tests for the deployed service.
737
+
The `githubdispatch` provider generates GitHub events of type [`repository_dispatch`](https://docs.github.com/en/rest/reference/repos#create-a-repository-dispatch-event) for the selected repository. The `repository_dispatch` events can be used to trigger GitHub Actions workflow.
738
738
739
739
The request includes the `event_type` and `client_payload` fields:
740
740
741
-
* The `event_type` is generated by GitHub Dispatch provider by combining the Kind, Name and Namespace of the involved object in the format `{Kind}/{Name}.{Namespace}`. For example, the `event_type` for Flux configuration named `podinfo` in the `flux-system` namespace looks like this: `Kustomization/podinfo.flux-system`
741
+
* The `event_type` is generated by GitHub Dispatch provider by combining the Kind, Name and Namespace of the involved object in the format `{Kind}/{Name}.{Namespace}`. For example, the `event_type` for a Flux Kustomization named `podinfo` in the `flux-system` namespace looks like this: `Kustomization/podinfo.flux-system`.
742
742
743
-
* The `client_payload` contains the event data from the notification controller and looks like this:
743
+
* The `client_payload` contains the Kubernetes event issued by Flux, e.g.:
744
744
745
745
```yaml
746
746
{
@@ -765,9 +765,42 @@ The request includes the `event_type` and `client_payload` fields:
The `address` is the address of your repository where you want to send webhooks to trigger GitHub workflows.
784
+
785
+
GitHub uses personal access tokens for authentication with its API:
786
+
787
+
* [GitHub personal access token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token)
788
+
789
+
The provider requires a secret in the same format, with the personal access token as the value for the token key:
790
+
791
+
```yaml
792
+
apiVersion: v1
793
+
kind: Secret
794
+
metadata:
795
+
name: api-token
796
+
namespace: default
797
+
data:
798
+
token: <personal-access-tokens>
799
+
```
800
+
768
801
#### Setting up a GitHub workflow
769
802
770
-
You need to add `repository_dispatch` trigger to trigger your GitHub workflow using the Flux notification with the relevant event type:
803
+
To trigger a GitHub Actions workflow when a Flux Kustomization finishes reconciling, you need to set the event type for the repository_dispatch trigger to match the Flux object ID:
771
804
772
805
```yaml
773
806
name: test-github-dispatch-provider
@@ -822,7 +855,7 @@ spec:
822
855
name: 'podinfo'
823
856
```
824
857
825
-
Now you can the trigger tests in the GitHub workflow for app1 in a staging cluster when the app1 resources defined in `./app1/staging/` are configured by Flux:
858
+
Now you can the trigger tests in the GitHub workflow for app1 in a staging cluster when the app1 resources defined in `./app1/staging/` are reconciled by Flux:
0 commit comments