{"id":19541599,"url":"https://github.com/brigadecore/brigade-bitbucket-gateway","last_synced_at":"2025-04-26T17:30:51.546Z","repository":{"id":37787118,"uuid":"121992074","full_name":"brigadecore/brigade-bitbucket-gateway","owner":"brigadecore","description":"A Brigade 2 compatible gateway for events originating from Bitbucket repos","archived":false,"fork":false,"pushed_at":"2024-06-24T22:06:38.000Z","size":270,"stargazers_count":4,"open_issues_count":2,"forks_count":10,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T16:28:05.605Z","etag":null,"topics":["brigade","brigade-gateway"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brigadecore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null}},"created_at":"2018-02-18T21:24:37.000Z","updated_at":"2022-09-08T01:23:13.000Z","dependencies_parsed_at":"2022-06-23T21:46:47.296Z","dependency_job_id":null,"html_url":"https://github.com/brigadecore/brigade-bitbucket-gateway","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brigadecore%2Fbrigade-bitbucket-gateway","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brigadecore%2Fbrigade-bitbucket-gateway/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brigadecore%2Fbrigade-bitbucket-gateway/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brigadecore%2Fbrigade-bitbucket-gateway/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brigadecore","download_url":"https://codeload.github.com/brigadecore/brigade-bitbucket-gateway/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251025594,"owners_count":21524829,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["brigade","brigade-gateway"],"created_at":"2024-11-11T03:11:13.165Z","updated_at":"2025-04-26T17:30:51.263Z","avatar_url":"https://github.com/brigadecore.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Brigade Bitbucket Gateway\n\n![build](https://badgr.brigade2.io/v1/github/checks/brigadecore/brigade-bitbucket-gateway/badge.svg?branch=v2\u0026appID=99005)\n[![codecov](https://codecov.io/gh/brigadecore/brigade-bitbucket-gateway/branch/v2/graph/badge.svg?token=RJyZsepTmV)](https://codecov.io/gh/brigadecore/brigade-bitbucket-gateway)\n[![Go Report Card](https://goreportcard.com/badge/github.com/brigadecore/brigade-bitbucket-gateway)](https://goreportcard.com/report/github.com/brigadecore/brigade-bitbucket-gateway)\n[![slack](https://img.shields.io/badge/slack-brigade-brightgreen.svg?logo=slack)](https://kubernetes.slack.com/messages/C87MF1RFD)\n\n\u003cimg width=\"100\" align=\"left\" src=\"logo.png\"\u003e\n\nThe Brigade Bitbucket Gateway receives events \n([webhooks](https://confluence.atlassian.com/bitbucket/manage-webhooks-735643732.html))\nfrom Bitbucket, transforms them into Brigade\n[events](https://docs.brigade.sh/topics/project-developers/events/), and emits\nthem into Brigade's event bus.\n\n\u003cbr clear=\"left\"/\u003e\n\n\u003e ⚠️\u0026nbsp;\u0026nbsp;If you are familiar with the Brigade GitHub Gateway, be advised\n\u003e that this gateway is not as full-featured as that one. At this time, it merely\n\u003e offers parity with its predecessor -- the Brigade v1.x-compatible Bitbucket\n\u003e Gateway -- meaning it only handles simple webhooks and does not offer\n\u003e any integration with\n\u003e [Bitbucket Cloud Apps](https://support.atlassian.com/bitbucket-cloud/docs/bitbucket-cloud-apps-overview/).\n\u003e\n\u003e A more full-featured successor to this gateway is something the Brigade\n\u003e maintainers do wish to explore in collaboration with the Brigade community.\n\u003e Please reach out on the\n\u003e [Kubernetes/#brigade](https://kubernetes.slack.com/messages/C87MF1RFD) Slack\n\u003e channel if you are interested in working on that.\n\n## Creating Webhooks\n\nAfter [installation](docs/INSTALLATION.md), browse to any of your Bitbucket\nrepositories for which you'd like to send webhooks to this gateway. From the\nmenu on the left, select __Repository settings__ and then __Webhooks__. On this\npage, click __Add webhooks__.\n\n* In the __Title__ field, add a name for your webhook. It must be unique to this\nrepository.\n\n* In the __URL__ field, use a value of the form\n  `https://\u003cDNS hostname or publicIP\u003e/events`. Note that Bitbucket will not\n  permit URLs that it cannot reach.\n\n  \u003e ⚠️\u0026nbsp;\u0026nbsp;Instructions for finding the public IP are in the\n  \u003e [installation docs](docs/INSTALLATION.md).\n\n* Check the __Active__ checkbox.\n\n* If you're using a self-signed certificate (again, refer to the\n  [installation docs](docs/INSTALLATION.md)), check the __Skip certificate\n  verification__ checkbox.\n\n* Check any/all triggers for which you'd like a webhook sent to this gateway.\n\n* Click __Save__\n\n\u003e ⚠️\u0026nbsp;\u0026nbsp;Those who are also familiar with the Brigade GitHub Gateway\n\u003e might be perplexed at the lack of anything along the lines of a \"shared\n\u003e secret\" when configuring webhooks in Bitbucket. How then do webhook requests\n\u003e authenticate themselves to your gateway? In short, they do not. In practice,\n\u003e however, this does _not_ mean that just anyone can send webhooks (directly) to\n\u003e your gateway. \n\u003e\n\u003e This gateway is pre-configured (see Helm chart configuration options) with a\n\u003e list of allowed IPs / IP ranges for inbound requests. This list reflects the\n\u003e IPs utilized by Bitbucket for outbound requests. This effectively prevents\n\u003e anyone except Bitbucket from (successfully) sending webhooks to your gateway.\n\u003e\n\u003e This strategy does not, however, prevent any random Bitbucket user (who\n\u003e happens to know the address of your gateway) from configuring their own\n\u003e repositories to send webhooks your way. However, this matters very little,\n\u003e because Brigade 2 operates on a subscription model and if none of your own\n\u003e Brigade projects subscribe to events originating from the third-party\n\u003e repository in question, nothing happens.\n\n## Subscribing\n\nNow subscribe any number of Brigade\n[projects](https://docs.brigade.sh/topics/project-developers/projects/)\nto events emitted by this gateway -- all of which have a value of\n`brigade.sh/bitbucket` in their `source` field. You can subscribe to all event\ntypes emitted by the gateway, or just specific ones.\n\nIn the example project definition below, we subscribe to\n`issue:created` events, provided they've originated from the fictitious\n`example-org/example` repository (see the `repo` \n[qualifier](https://docs.brigade.sh/topics/project-developers/events/#qualifiers)).\nYou should adjust this value to match a repository for which you are sending\nwebhooks to your new gateway (see\n[installation instructions](docs/INSTALLATION.md)).\n\n```yaml\napiVersion: brigade.sh/v2\nkind: Project\nmetadata:\n  id: bitbucket-demo\ndescription: A project that demonstrates integration with Bitbucket\nspec:\n  eventSubscriptions:\n  - source: brigade.sh/bitbucket\n    types:\n    - repo:push\n    qualifiers:\n      repo: example-org/example\n  workerTemplate:\n    defaultConfigFiles:\n      brigade.js: |-\n        const { events } = require(\"@brigadecore/brigadier\");\n\n        events.on(\"brigade.sh/bitbucket\", \"repo:push\", () =\u003e {\n          console.log(\"Someone pushed a commit to the example-org/example repository!\");\n        });\n\n        events.process();\n```\n\nAssuming this file were named `project.yaml`, you can create the project like\nso:\n\n```shell\n$ brig project create --file project.yaml\n```\n\nCreating a new issue in the corresponding repo should now send a webhook from\nBitbucket to your gateway. The gateway, in turn, will emit an event into\nBrigade's event bus. Brigade should initialize a worker (containerized event\nhandler) for every project that has subscribed to the event, and the worker\nshould execute the `brigade.js` script that was embedded in the project\ndefinition.\n\nList the events for the `bitbucket-demo` project to confirm this:\n\n```shell\n$ brig event list --project bitbucket-demo\n```\n\nFull coverage of `brig` commands is beyond the scope of this documentation, but\nat this point,\n[additional `brig` commands](https://docs.brigade.sh/topics/project-developers/brig/)\ncan be applied to monitor the event's status and view logs produced in the\ncourse of handling the event.\n\n## Further Reading\n\n* [Installation](docs/INSTALLATION.md): Check this out if you're an operator who\n  wants to integrate Bitbucket with your Brigade installation.\n* [Event Reference](docs/EVENT_REFERENCE.md): Check this out if you're a script\n  author or contributor who requires detailed information about all the webhooks\n  handled by this gateway and the corresponding events the gateway emits into\n  Brigade.\n\n## Contributing\n\nThe Brigade project accepts contributions via GitHub pull requests. The\n[Contributing](CONTRIBUTING.md) document outlines the process to help get your\ncontribution accepted.\n\n## Support \u0026 Feedback\n\nWe have a slack channel!\n[Kubernetes/#brigade](https://kubernetes.slack.com/messages/C87MF1RFD) Feel free\nto join for any support questions or feedback, we are happy to help. To report\nan issue or to request a feature open an issue\n[here](https://github.com/brigadecore/brigade-bitbucket-gateway/issues)\n\n## Code of Conduct\n\nParticipation in the Brigade project is governed by the\n[CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrigadecore%2Fbrigade-bitbucket-gateway","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrigadecore%2Fbrigade-bitbucket-gateway","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrigadecore%2Fbrigade-bitbucket-gateway/lists"}