{"id":13621481,"url":"https://github.com/jenkins-x/lighthouse","last_synced_at":"2026-04-13T02:15:50.679Z","repository":{"id":37493463,"uuid":"193905822","full_name":"jenkins-x/lighthouse","owner":"jenkins-x","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-06T15:23:08.000Z","size":10232,"stargazers_count":185,"open_issues_count":75,"forks_count":117,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-01-06T17:31:23.396Z","etag":null,"topics":["hacktoberfest"],"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/jenkins-x.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-26T13:04:40.000Z","updated_at":"2025-01-06T15:23:12.000Z","dependencies_parsed_at":"2023-02-08T23:01:02.065Z","dependency_job_id":"ce47d174-7272-442c-9ae2-d2ba39f90d2f","html_url":"https://github.com/jenkins-x/lighthouse","commit_stats":{"total_commits":1952,"total_committers":56,"mean_commits":"34.857142857142854","dds":0.5829918032786885,"last_synced_commit":"3c5a4611380776e1d8473b7c594ea32256eed67a"},"previous_names":[],"tags_count":1191,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkins-x%2Flighthouse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkins-x%2Flighthouse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkins-x%2Flighthouse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkins-x%2Flighthouse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jenkins-x","download_url":"https://codeload.github.com/jenkins-x/lighthouse/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247249525,"owners_count":20908212,"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":["hacktoberfest"],"created_at":"2024-08-01T21:01:06.914Z","updated_at":"2026-04-13T02:15:50.639Z","avatar_url":"https://github.com/jenkins-x.png","language":"Go","funding_links":[],"categories":["CI/CD","Go"],"sub_categories":[],"readme":"# Lighthouse\n\nLighthouse is a lightweight ChatOps based webhook handler which can trigger Jenkins X Pipelines, Tekton Pipelines or Jenkins Jobs based on webhooks from multiple git providers such as GitHub, GitHub Enterprise, BitBucket Server and GitLab.\n\n\u003c!-- MarkdownTOC autolink=\"true\" indent=\"  \" --\u003e\n\n- [Installing](#installing)\n- [Background](#background)\n  - [Comparisons to Prow](#comparisons-to-prow)\n  - [Porting Prow commands](#porting-prow-commands)\n- [Development](#development)\n  - [Building](#building)\n  - [Environment variables](#environment-variables)\n  - [Testing](#testing)\n  - [Debugging Lighthouse](#debugging-lighthouse)\n  - [Using a local go-scm](#using-a-local-go-scm)\n\n\u003c!-- /MarkdownTOC --\u003e\n\n## Installing\n\nLighthouse is bundled and released as [Helm Chart](https://helm.sh/docs/topics/charts/).\nYou find the install instruction in the Chart's [README](./charts/lighthouse/README.md).\n\nDepending on the pipeline engine you want to use, you can find more detailed instructions in one of the following documents:\n\n- [Lighthouse + Tekton](./docs/install_lighthouse_with_tekton.md)\n- [Lighthouse + Jenkins](./docs/install_lighthouse_with_jenkins.md)\n\n## Background\n\nLighthouse derived originally from [Prow](https://github.com/kubernetes/test-infra/tree/master/prow) and started with a copy of its essential code.\n\nCurrently, Lighthouse supports the standard [Prow plugins](https://github.com/jenkins-x/lighthouse/tree/master/pkg/plugins) and handles push webhooks to branches to then trigger a pipeline execution on the agent of your choice.\n\nLighthouse uses the same `config.yaml` and `plugins.yaml` for configuration than Prow.\n\n### Comparisons to Prow\n\nLighthouse reuses the Prow plugin source code and a bunch of [plugins from Prow](https://github.com/jenkins-x/lighthouse/tree/master/pkg/plugins)\n\nIts got a few differences though:\n\n- rather than being GitHub specific Lighthouse uses [jenkins-x/go-scm](https://github.com/jenkins-x/go-scm) so it can support any Git provider\n- Lighthouse does not use a `ProwJob` CRD; instead, it has its own `LighthouseJob` CRD.\n\n### Porting Prow commands\n\nIf there are any prow commands you want which we've not yet ported over, it is relatively easy to port Prow plugins.\n\nWe've reused the prow plugin code and configuration code; so it is mostly a case of switching imports of `k8s.io/test-infra/prow` to `github.com/jenkins-x/lighthouse/pkg/prow`, then modifying the GitHub client structs from, say, `github.PullRequest` to `scm.PullRequest`.\n\nMost of the GitHub structs map 1-1 to the [jenkins-x/go-scm](https://github.com/jenkins-x/go-scm) equivalents (e.g. Issue, Commit, PullRequest).\nHowever, the go-scm API does tend to return slices to pointers to resources by default.\nThere are some naming differences in different parts of the API as well.\nFor example, compare the `githubClient` API for [Prow lgtm](https://github.com/kubernetes/test-infra/blob/344024d30165cda6f4691cc178f25b16f1a1f5af/prow/plugins/lgtm/lgtm.go#L134-L150) versus the [Lighthouse lgtm](https://github.com/jenkins-x/lighthouse/blob/master/pkg/plugins/lgtm/lgtm.go#L146-L163).\n\n## Development\n\n### Building\n\nTo build the code, [fork and clone](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo) this git repository, then type:\n\n```bash\nmake build\n```\n\n`make build` will build all relevant Lighthouse binaries natively for your OS which you then can run locally.\nFor example, to run the webhook controller, you would type:\n\n```bash\n./bin/webhooks\n```\n\nTo see which other Make rules are available, run:\n\n```bash\nmake help\n```\n\n### Environment variables\n\nWhile Prow only supports GitHub as SCM provider, Lighthouse supports several Git SCM providers.\nLighthouse achieves the abstraction over the SCM provider using the [go-scm](https://github.com/jenkins-x/go-scm) library.\nTo configure your SCM, go-scm uses the following environment variables :\n\n| Name  |  Description |\n| ------------- | ------------- |\n| `GIT_KIND` | the kind of git server: `github, gitlab, bitbucket, gitea, stash` |\n| `GIT_SERVER` | the URL of the server if not using the public hosted git providers: [https://github.com](https://github.com), [https://bitbucket.org](https://bitbucket.org) or [https://gitlab.com](https://gitlab.com) |\n| `GIT_USER` | the git user (bot name) to use on git operations |\n| `GIT_TOKEN` | the git token to perform operations on git (add comments, labels etc.) |\n| `HMAC_TOKEN` | the token sent from the git provider in webhooks |\n\n### Testing\n\nTo run the unit tests, type:\n\n```bash\nmake test\n```\n\nFor development purposes, it is also nice to start an instance of the binary you want to work.\nProvided you have a connection to a cluster with Lighthouse installed, the locally started controller will join the cluster, and you can test your development changes directly in-cluster.\n\nFor example to run the webhook controller locally:\n\n```bash\nmake build\nGIT_TOKEN=\u003cgit-token\u003e ./bin/webhooks -namespace \u003cnamespace\u003e -bot-name \u003cgit-bot-user\u003e\n```\n\nIn the case of the webhook controller, you can also test webhook deliveries locally using a [ngrok](https://ngrok.com/) tunnel.\nInstall [ngrok](https://ngrok.com/) and start a new tunnel:\n\n```bash\n$ ngrok http 8080\nngrok by @inconshreveable                                                                                                                                                                     (Ctrl+C to quit)\n\nSession Status                online\nAccount                       ***\nVersion                       2.3.35\nRegion                        United States (us)\nWeb Interface                 http://127.0.0.1:4040\nForwarding                    http://e289dd1e1245.ngrok.io -\u003e http://localhost:8080\nForwarding                    https://e289dd1e1245.ngrok.io -\u003e http://localhost:8080\n\nConnections                   ttl     opn     rt1     rt5     p50     p90\n                              0       0       0.00    0.00    0.00    0.00\n```\n  \nNow you can use your ngrok URL to register a webhook handler with your Git provider.\n\n**NOTE** Remember to append `/hook` to the generated ngrok URL.\n In the case of the above example ht\u003cspan\u003etp://e289dd1e1245.ngrok.io/hook\n\nAny events that happen on your Git provider are now sent to your local webhook instance.\n\n### Debugging Lighthouse\n\nYou can setup a remote debugger for Lighthouse using [delve](https://github.com/go-delve/delve/blob/master/Documentation/installation/README.md) via:\n\n```bash\ndlv --listen=:2345 --headless=true --api-version=2 exec ./bin/lighthouse -- $*  \n```\n\nYou can then debug from your Go-based IDE (e.g. GoLand / IDEA / VS Code).\n\n### Debugging webhooks\n\nIf you want to debug lighthouse locally from webhooks in your cluster there are a couple of tools that could help:\n\n#### Localizer\n\nIf you [install localizer](https://github.com/jaredallard/localizer#install-localizer) (see [the blog for more detail](https://blog.jaredallard.me/localizer-an-adventure-in-creating-a-reverse-tunnel-and-tunnel-manager-for-kubernetes/) you can easily debug webhooks on your cluster.\n\n* first run localizer:\n\n```bash \nsudo localizer\n```\n\nThen run/debug lighthouse locally. \n\ne.g. in your IDE run the [cmd/webhooks/main.go](https://github.com/jenkins-x/lighthouse/blob/master/cmd/webhooks/main.go) (passing `--namespace jx` as program arguments)\n\nThen to get the webhooks to trigger your local process:\n\n```bash \nlocalizer expose jx/hook --map 80:8080\n```\n\nwhen you have finished debugging, return things to normal via:\n\n```bash \nlocalizer expose jx/hook --stop\n```\n\n\n#### Telepresence \nYou can replace the running version in your cluster with the one running locally using [telepresence](https://www.telepresence.io/).  \nFirst install the [telepresence cli](https://www.telepresence.io/docs/latest/install/) on your device then [the traffic-manager](https://www.telepresence.io/docs/latest/install/helm/) into your cluster \nFor webhooks, just run:\n```bash\ntelepresence intercept hook --namespace=jx --port 80 --env-file=/tmp/webhooks-env\n```\nin another terminal:\n```bash\nexport $(cat /tmp/webhooks-env | xargs)\ndlv --listen=:2345 --headless=true --api-version=2 exec ./bin/webhooks -- --namespace=jx\n```\n\nYou can do the same for any other deployment (keeper, foghorn...), just make sur to check the command args used for it an set them instead of `--namespace=jx`.\n\nto stop intercepting:\n```bash\ntelepresence leave hook-jx # hook-jx is the name of the intercept\n```\n\n\n### Using a local go-scm\n\nIf you are hacking on support for a specific Git provider, you may find yourself working on the Lighthouse code and the [jenkins-x/go-scm](https://github.com/jenkins-x/go-scm) code together.\nGo modules lets you easily swap out the version of a dependency with a local copy of the code; so you can edit code in Lighthouse and [jenkins-x/go-scm](https://github.com/jenkins-x/go-scm) at the same time.\n\nJust add this line to the end of your [go.mod](https://github.com/jenkins-x/lighthouse/blob/master/go.mod) file:\n\n```bash\nreplace github.com/jenkins-x/go-scm =\u003e /workspace/go/src/github.com/jenkins-x/go-scm\n```  \n\nUsing the exact path to where you cloned [jenkins-x/go-scm](https://github.com/jenkins-x/go-scm)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenkins-x%2Flighthouse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjenkins-x%2Flighthouse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenkins-x%2Flighthouse/lists"}