{"id":15055437,"url":"https://github.com/tomseanmy/tushansusu","last_synced_at":"2026-01-31T05:31:07.635Z","repository":{"id":246847349,"uuid":"823572101","full_name":"tomseanmy/tushansusu","owner":"tomseanmy","description":"gitlab webhooks to 企业微信","archived":false,"fork":false,"pushed_at":"2024-07-05T09:13:59.000Z","size":86,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-10T18:19:43.385Z","etag":null,"topics":["gitlab","java","spring","wechat","wxwork"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomseanmy.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":"2024-07-03T09:34:09.000Z","updated_at":"2024-07-05T09:14:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"679b2793-989b-4edc-9352-f24b37b3cf25","html_url":"https://github.com/tomseanmy/tushansusu","commit_stats":null,"previous_names":["tomseanmy/tushansusu"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/tomseanmy/tushansusu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomseanmy%2Ftushansusu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomseanmy%2Ftushansusu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomseanmy%2Ftushansusu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomseanmy%2Ftushansusu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomseanmy","download_url":"https://codeload.github.com/tomseanmy/tushansusu/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomseanmy%2Ftushansusu/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28930361,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T04:05:25.756Z","status":"ssl_error","status_checked_at":"2026-01-31T04:02:35.005Z","response_time":128,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["gitlab","java","spring","wechat","wxwork"],"created_at":"2024-09-24T21:42:08.748Z","updated_at":"2026-01-31T05:31:07.620Z","avatar_url":"https://github.com/tomseanmy.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ch1\u003etushansusu\u003c/h1\u003e\n\u003c/p\u003e\n\n\n![ci](https://github.com/tomseanmy/tushansusu/actions/workflows/maven.yml/badge.svg)\n![license](https://img.shields.io/github/license/tomseanmy/tushansusu)\n![release](https://img.shields.io/github/v/release/tomseanmy/tushansusu)\n![image-version](https://ghcr-badge.egpl.dev/tomseanmy/tushansusu/tags?ignore=sha256*)\n![image-size](https://ghcr-badge.egpl.dev/tomseanmy/tushansusu/size)\n\n\n## 一、项目背景\n1. 为什么创建这个项目\n\n   在团队协作中使用企业微信和GitLab CE（以下简称GitLab）时，想在GitLabPull Request或CI后向企业微信相关项目的工作组推送通知。但遗憾的是，GitLab集成中并未提供企业微信的相关能力。（即使极狐文档中有企业微信集成的开关，但这个设置对我来说并未产生任何效果）\n\n2. 为什么叫这个名字\n\n   GitLab的LOGO是狐狸，当时我脑子里第一个出现的狐狸名字就是tushansusu（涂山苏苏）。\n\n## 二、项目功能\n1. 详细介绍程序的主要功能\n\n   接收 GitLab Webhooks 消息并处理为企业微信Bot的数据格式，并通过HTTP的方式发送给企业微信Bot，实现将GitLab中发生的事件推送到企业微信。\n\n2. 功能亮点和特色\n\n   | GitLab Webhooks     | 支持 | 说明          |\n   | ------------------- | ---- | ------------- |\n   | Push Event          | ✅    | Release 0.0.3 |\n   | Merge Request Event | ✅    | Release 0.0.3 |\n   | Pipeline Event      | ✅    | Release 0.0.3 |\n   | Release Event       | ✅    | Release 0.0.3 |\n\n   \u003e 其他未写入列表的事件均表示还未接入。\n\n## 三、使用方法\n1. 开发环境要求\n\n   | 环境    | 版本             | 说明 |\n   | ------- |----------------| ---- |\n   | OpenJDK | temurin-17.0.9 | -    |\n   | Maven   | 3.9.6          | -    |\n   | IDEA    | 2024.1         | -    |\n\n   您并不需要与我的环境保持完全一致（如果一切顺利），我只是列出我的环境供您参考。\n\n   如果您没有这么着急要修改项目并使用，您可以试着提一些Feature在Issue里，也许某一天这个功能就出现在了Releases列表了🫠。\n\n3. 启动配置\n   - 完整配置\n\n     ```yaml\n      server:\n        port: 7001\n      notice:\n        wxwork:\n          project-code: wxwork-bot-key\n      logging:\n        file:\n          name: tushansusu.log\n        level:\n          com.github.tomseanmy.tushansusu: info\n    \n      spring:\n        main:\n          banner-mode: off\n\t  ```\n\n   - server.port 启动端口\n\n   - notice.wxwork 设置企业微信 Bot 相关参数，用项目code : 企业微信Botkey作为配置方式\n\n     ```yaml\n     #假设项目code为cms\n     #企业微信bot连接为：https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=123456\n     #配置应为\n     notice:\n       wxwork:\n         cms: 123456\n     ```\n\n     也支持配置多个\n\n     ```yaml\n     notice:\n       wxwork:\n         cms: 123456\n         oa: 123456\n         mall: 123456\n     ```\n\n      - 在[GitLab Webhooks](https://docs.gitlab.com/ee/user/project/integrations/webhooks.html)中配置该程序的接口地址\n\n        __路径：项目 \u003e 设置 \u003e Webhooks__\n\n        \u003e 格式：{host}:{port}/webhooks/项目code，项目code与notice.wxwork里面的项目code对应\n\n        ![gitlab-setting](./assets/gitlab-setting.png)\n\n4. 运行程序\n   - 使用Java方式\n     ```shell\n      $ nohup java -Xms100m -Xmx100m -jar tushansusu.jar \u003e tushansusu.log 2\u003e\u00261  \u0026\n     ```\n\n   - 使用Docker方式\n\n     ```shell\n     $ docker run -d -p 7001:7001 -v /data/application.yml:/data/application.yml --name tushansusu --restart=unless-stopped ghcr.io/tomseanmy/tushansusu\n     ```\n\n   - 使用Docker-Compose方式\n\n     ```yaml\n     version: \"3\"\n      \n     services:\n       tushansusu:\n         image: ghcr.io/tomseanmy/tushansusu:latest\n         volumes:\n           - /data/application.yml:/data/application.yml\n         ports:\n           - \"7001:7001\"\n     ```\n\n## 四、开发环境细节\n- 主要的包和模块结构\n\n  ```text\n  - controller #接收来自外部的请求，比如GitLab的Webhooks回调\n  - handle     #处理Webhooks消息\n  - property   #参数配置\n  - util       #工具\n  - wxwork     #企业微信相关\n  ```\n\n- 关键代码文件的说明\n\n  您如果看过源码应该已经发现了，接收来自GitLab Webhooks的入参并非封装的数据Schema，而是直接使用JSONObject的形式，这是因为在这个项目之前，我尝试了其他开源项目，发现了一个叫[gitlab4j-api](https://github.com/gitlab4j/gitlab4j-api)的项目，他封装了GitLab的相关操作，于是我将他用在了此项目中。但在实际与GitLab通信的过程中，我发现[GitLab Webhooks](https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html)上的数据与这个项目的数据Schema并不一致，特别是pipeline事件中的jobs属性在最新的GitLab(16.10.8 CE)中已经变成了builds，我的需求仅仅需要支持解析GitLab Webhooks的数据并转化为企业微信的消息，不需要向GitLab发起任何API请求，又考虑到或许以后的某一天GitLab又换了新的数据结构我的项目将不再支持又需要大费周章的建立Schema并发布，所以选择了JSONObject。当然这并不是一个很好的方案，但对我目前的需求来说足够了。\n\n## 七、未来规划\n未来的版本会逐渐补齐GitLab Webhooks的各种事件（也可能不会）\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomseanmy%2Ftushansusu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomseanmy%2Ftushansusu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomseanmy%2Ftushansusu/lists"}