github.com/argoproj/argo-events@v1.9.1/docs/eventsources/setup/bitbucket.md (about) 1 # Bitbucket (Cloud) 2 3 Bitbucket event-source programmatically configures webhooks for projects on Bitbucket and helps sensor trigger the workloads on events. 4 5 ## Event Structure 6 7 The structure of an event dispatched by the event-source over the eventbus looks like following, 8 9 { 10 "context": { 11 "type": "type_of_event_source", 12 "specversion": "cloud_events_version", 13 "source": "name_of_the_event_source", 14 "id": "unique_event_id", 15 "time": "event_time", 16 "datacontenttype": "type_of_data", 17 "subject": "name_of_the_configuration_within_event_source" 18 }, 19 "data": { 20 "body": "Body is the Bitbucket event payload", 21 "headers": "Headers from the Bitbucket event", 22 } 23 } 24 25 ## Specification 26 27 Bitbucket event-source specification is available [here](https://github.com/argoproj/argo-events/blob/master/api/event-source.md#bitbucketeventsource). <br /> 28 Example event-source yaml file is [here](https://github.com/argoproj/argo-events/blob/master/examples/event-sources/bitbucket.yaml). 29 30 ## Setup 31 32 > **_NOTE:_** In this setup, we will use the basic auth strategy together with [App password](https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/) (there is also support for [OAuth](https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/)). 33 34 1. Create an App password if you don't have one. Follow [instructions](https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/) to create a new Bitbucket App password. 35 Grant it the `Webhooks - Read and Write` permissions as well as any permissions that applies to the events that the webhook subscribes to (e.g. if you're using the [example event-source yaml file](https://github.com/argoproj/argo-events/blob/master/examples/event-sources/bitbucket.yaml) which subscribes to `repo:push` event then you would also need to grant the `Repositories - Read` permission). 36 37 1. Base64 encode your App password and your Bitbucket username. 38 39 echo -n <username> | base64 40 echo -n <password> | base64 41 42 1. Create a secret called `bitbucket-access` that contains your encoded Bitbucket credentials. 43 44 apiVersion: v1 45 kind: Secret 46 metadata: 47 name: bitbucket-access 48 type: Opaque 49 data: 50 username: <base64-encoded-username-from-previous-step> 51 password: <base64-encoded-password-from-previous-step> 52 53 1. Deploy the secret into K8s cluster. 54 55 kubectl -n argo-events apply -f bitbucket-access.yaml 56 57 1. The event-source for Bitbucket creates a pod and exposes it via service. 58 The name for the service is in `<event-source-name>-eventsource-svc` format. 59 You will need to create an Ingress or OpenShift Route for the event-source service so that it can be reached from Bitbucket. 60 You can find more information on Ingress or Route online. 61 62 1. Create the event source by running the following command. You can use the [example event-source yaml file](https://github.com/argoproj/argo-events/blob/master/examples/event-sources/bitbucket.yaml) but make sure to replace the `url` field and to modify `owner`, `repositorySlug` and `projectKey` fields with your own repo. 63 64 kubectl apply -n argo-events -f <event-source-file> 65 66 1. Go to `Webhooks` under your project settings on Bitbucket and verify the webhook is registered. You can also do the same by looking at the event-source pod logs. 67 68 1. Create the sensor by running the following command. 69 70 kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/sensors/bitbucket.yaml 71 72 1. Make a change to one of your project files and commit. It will trigger an argo workflow. 73 74 1. Run `argo list` to find the workflow. 75 76 ## Troubleshoot 77 78 Please read the [FAQ](https://argoproj.github.io/argo-events/FAQ/).