github.com/argoproj/argo-events@v1.9.1/docs/eventsources/setup/bitbucketserver.md (about) 1 # Bitbucket Server 2 3 Bitbucket Server event-source programmatically configures webhooks for projects on Bitbucket Server 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 Server event payload", 21 "headers": "Headers from the Bitbucket Server event", 22 } 23 } 24 25 ## Specification 26 27 Bitbucket Server event-source specification is available [here](https://github.com/argoproj/argo-events/blob/master/api/event-source.md#bitbucketservereventsource). <br /> 28 Example event-source yaml file is [here](https://github.com/argoproj/argo-events/blob/master/examples/event-sources/bitbucketserver.yaml). 29 30 ## Setup 31 32 1. Create an API token if you don't have one. Follow [instructions](https://confluence.atlassian.com/bitbucketserver072/personal-access-tokens-1005335924.html) to create a new Bitbucket Server API Token. 33 Grant it the `Projects: Admin` permissions. 34 35 1. Base64 encode your API token key. 36 37 echo -n <api-token-key> | base64 38 39 1. Create a secret called `bitbucketserver-access` that contains your encoded Bitbucket Server API token. You can also include a secret key that is encoded with `base64` for your webhook if any. 40 41 apiVersion: v1 42 kind: Secret 43 metadata: 44 name: bitbucketserver-access 45 type: Opaque 46 data: 47 token: <base64-encoded-api-token-from-previous-step> 48 secret: <base64-encoded-webhook-secret-key> 49 50 1. Deploy the secret into K8s cluster. 51 52 kubectl -n argo-events apply -f bitbucketserver-access.yaml 53 54 1. The event-source for Bitbucket Server creates a pod and exposes it via service. 55 The name for the service is in `<event-source-name>-eventsource-svc` format. 56 You will need to create an Ingress or Openshift Route for the event-source service so that it can be reached from Bitbucket Server. 57 You can find more information on Ingress or Route online. 58 59 1. Create the event source by running the following command. You can use the example event-source yaml file from [here](https://github.com/argoproj/argo-events/blob/master/examples/event-sources/bitbucketserver.yaml) but make sure to replace the `url` field and to modify the `repositories` list with your own repos. 60 61 kubectl apply -n argo-events -f <event-source-file> 62 63 1. Go to `Webhooks` under your project settings on Bitbucket Server and verify the webhook is registered. You can also do the same by looking at the event-source pod logs. 64 65 1. Create the sensor by running the following command. 66 67 kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/sensors/bitbucketserver.yaml 68 69 1. Make a change to one of your project files and commit. It will trigger an argo workflow. 70 71 1. Run `argo list` to find the workflow. 72 73 ## Troubleshoot 74 75 Please read the [FAQ](https://argoproj.github.io/argo-events/FAQ/).