gitwebhooks 2.0.0__tar.gz → 2.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/CLAUDE.md +47 -7
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/PKG-INFO +207 -25
- gitwebhooks-2.1.0/README.md +454 -0
- gitwebhooks-2.1.0/README.zh.md +454 -0
- gitwebhooks-2.1.0/gitwebhooks/__main__.py +10 -0
- gitwebhooks-2.1.0/gitwebhooks/cli/__init__.py +107 -0
- gitwebhooks-2.1.0/gitwebhooks/cli/config.py +216 -0
- gitwebhooks-2.1.0/gitwebhooks/cli/init_wizard.py +701 -0
- gitwebhooks-2.1.0/gitwebhooks/cli/prompts.py +275 -0
- gitwebhooks-2.1.0/gitwebhooks/cli/service.py +374 -0
- gitwebhooks-2.1.0/gitwebhooks/main/__init__.py +117 -0
- gitwebhooks-2.1.0/gitwebhooks/main/__main__.py +12 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/utils/constants.py +13 -0
- gitwebhooks-2.1.0/gitwebhooks/utils/systemd.py +274 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks.egg-info/PKG-INFO +207 -25
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks.egg-info/SOURCES.txt +20 -3
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/pyproject.toml +1 -1
- gitwebhooks-2.1.0/tests/integration/test_config_view_integration.py +272 -0
- gitwebhooks-2.1.0/tests/unit/cli/__init__.py +1 -0
- gitwebhooks-2.1.0/tests/unit/cli/test_config_view.py +396 -0
- gitwebhooks-2.1.0/tests/unit/cli/test_init_wizard.py +314 -0
- gitwebhooks-2.0.0/README.md +0 -272
- gitwebhooks-2.0.0/README.zh.md +0 -272
- gitwebhooks-2.0.0/git-webhooks-server.service.sample +0 -14
- gitwebhooks-2.0.0/gitwebhooks/__main__.py +0 -10
- gitwebhooks-2.0.0/gitwebhooks/cli.py +0 -107
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/.editorconfig +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/LICENSE +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/MANIFEST.in +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/doc/custom-body.png +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/doc/custom-header.png +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/doc/custom-response.png +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/doc/gitee-success.png +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/doc/gitee.png +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/doc/github-success.png +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/doc/github.png +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/doc/gitlab-success.png +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/doc/gitlab.png +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/doc/install.png +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/doc/uninstall.png +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/git-webhooks-server.ini.sample +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/__init__.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/auth/__init__.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/auth/custom.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/auth/factory.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/auth/gitee.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/auth/github.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/auth/gitlab.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/auth/verifier.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/config/__init__.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/config/loader.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/config/models.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/config/registry.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/config/server.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/handlers/__init__.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/handlers/base.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/handlers/custom.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/handlers/factory.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/handlers/gitee.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/handlers/github.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/handlers/gitlab.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/handlers/request.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/logging/__init__.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/logging/setup.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/models/__init__.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/models/provider.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/models/request.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/models/result.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/server.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/utils/__init__.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/utils/exceptions.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks/utils/executor.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks.egg-info/dependency_links.txt +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks.egg-info/entry_points.txt +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks.egg-info/requires.txt +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/gitwebhooks.egg-info/top_level.txt +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/setup.cfg +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/__init__.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/__main__.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/conftest.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/fixtures/__init__.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/fixtures/custom_payloads.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/fixtures/gitee_payloads.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/fixtures/github_payloads.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/fixtures/gitlab_payloads.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/fixtures/signature_builder.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/integration/__init__.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/integration/test_command_execution.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/integration/test_custom_webhook.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/integration/test_edge_cases.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/integration/test_gitee_webhook.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/integration/test_github_webhook.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/integration/test_gitlab_webhook.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/test_auth/__init__.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/test_config/__init__.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/test_handlers/__init__.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/test_integration/__init__.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/unit/__init__.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/unit/test_config_loading.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/unit/test_data_parsing.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/unit/test_provider_detection.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/unit/test_request_handler.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/unit/test_signature_verification.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/utils/__init__.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/utils/certificate_generator.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/utils/coverage_runner.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/utils/http_client.py +0 -0
- {gitwebhooks-2.0.0 → gitwebhooks-2.1.0}/tests/utils/server_manager.py +0 -0
|
@@ -15,13 +15,26 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
|
|
15
15
|
|
|
16
16
|
## 常用命令
|
|
17
17
|
|
|
18
|
-
###
|
|
18
|
+
### 安装和配置
|
|
19
19
|
```bash
|
|
20
|
-
#
|
|
21
|
-
|
|
20
|
+
# 通过 pip 安装
|
|
21
|
+
pip install .
|
|
22
22
|
|
|
23
|
-
#
|
|
24
|
-
|
|
23
|
+
# 初始化配置文件(交互式)
|
|
24
|
+
gitwebhooks-cli config init
|
|
25
|
+
|
|
26
|
+
# 直接指定配置级别(system/local/user)
|
|
27
|
+
gitwebhooks-cli config init user
|
|
28
|
+
sudo gitwebhooks-cli config init system
|
|
29
|
+
|
|
30
|
+
# 查看配置文件内容
|
|
31
|
+
gitwebhooks-cli config view
|
|
32
|
+
|
|
33
|
+
# 安装为 systemd 服务
|
|
34
|
+
sudo gitwebhooks-cli service install
|
|
35
|
+
|
|
36
|
+
# 卸载 systemd 服务
|
|
37
|
+
sudo gitwebhooks-cli service uninstall
|
|
25
38
|
```
|
|
26
39
|
|
|
27
40
|
### 运行服务
|
|
@@ -29,7 +42,10 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
|
|
29
42
|
# 方式1: 使用模块入口
|
|
30
43
|
python3 -m gitwebhooks.cli -c /path/to/config.ini
|
|
31
44
|
|
|
32
|
-
# 方式2: 使用 CLI
|
|
45
|
+
# 方式2: 使用 CLI 工具(使用默认配置)
|
|
46
|
+
gitwebhooks-cli
|
|
47
|
+
|
|
48
|
+
# 方式3: 指定配置文件
|
|
33
49
|
gitwebhooks-cli -c /path/to/config.ini
|
|
34
50
|
|
|
35
51
|
# systemd 服务管理
|
|
@@ -66,12 +82,25 @@ python3 -m pytest tests/
|
|
|
66
82
|
- `config/`: 配置加载和注册(ConfigLoader、ConfigurationRegistry)
|
|
67
83
|
- `auth/`: 签名验证模块(各平台的验证器工厂)
|
|
68
84
|
- `handlers/`: Webhook 处理器(按平台分离的处理器)
|
|
69
|
-
- `utils/`:
|
|
85
|
+
- `utils/`: 工具类(常量、异常、命令执行器、systemd 工具)
|
|
86
|
+
- `cli/`: CLI 子命令(service、config、init_wizard)
|
|
87
|
+
- `service.py`: systemd 服务管理
|
|
88
|
+
- `config.py`: 配置查看和管理
|
|
89
|
+
- `init_wizard.py`: 交互式配置初始化向导
|
|
70
90
|
- `logging/`: 日志配置
|
|
71
91
|
|
|
72
92
|
**CLI 工具** (`gitwebhooks-cli`)
|
|
73
93
|
- Bash 包装脚本,自动检测并加载 `gitwebhooks` 包
|
|
74
94
|
- 支持从源码目录运行或已安装的包运行
|
|
95
|
+
- 支持子命令:
|
|
96
|
+
- `gitwebhooks-cli service install/uninstall`: systemd 服务管理
|
|
97
|
+
- `gitwebhooks-cli config init [level]`: 交互式配置初始化向导
|
|
98
|
+
- 支持配置级别:`system`(系统级,需 root)、`local`(本地级,需 root)、`user`(用户级)
|
|
99
|
+
- 交互式收集服务器配置、平台配置(github/gitee/gitlab/custom)、仓库配置
|
|
100
|
+
- 自动生成 INI 配置文件,设置安全权限(0600)
|
|
101
|
+
- 支持配置文件覆盖和备份
|
|
102
|
+
- `gitwebhooks-cli config view`: 查看配置文件内容
|
|
103
|
+
- `gitwebhooks-cli -c <config>`: 运行服务器(兼容原有方式)
|
|
75
104
|
|
|
76
105
|
**Provider 枚举** (`gitwebhooks/models/provider.py`)
|
|
77
106
|
- 定义支持的 Git 平台:Github、Gitee、Gitlab、Custom
|
|
@@ -253,6 +282,17 @@ git-webhooks-server/
|
|
|
253
282
|
- ssl (HTTPS 支持)
|
|
254
283
|
- pytest (测试框架)
|
|
255
284
|
- Bash 4.0+ (安装脚本)
|
|
285
|
+
- Python 3.6+ (与项目一致) + Python 标准库(argparse 用于子命令,tempfile 用于文件操作,pathlib 用于路径处理) (001-cli-service-install)
|
|
286
|
+
- INI 配置文件(`~/.gitwebhook.ini`),systemd 服务文件(`/etc/systemd/system/`) (001-cli-service-install)
|
|
287
|
+
- Python 3.7+ (与项目保持一致) + Python 标准库(configparser、pathlib、os、sys) (001-config-view)
|
|
288
|
+
- INI 配置文件(只读) (001-config-view)
|
|
289
|
+
- Python 3.7+ + Python 标准库(dataclasses、configparser、os、re、sys) + 交互式 input() (001-config-init-wizard)
|
|
290
|
+
- INI 配置文件生成(读写) (001-config-init-wizard)
|
|
291
|
+
- Python 3.7+ + Python 标准库(sys, shutil, os, pathlib, argparse) (001-install-method-guidance)
|
|
292
|
+
- INI 配置文件,systemd 服务单元文件 (001-install-method-guidance)
|
|
256
293
|
|
|
257
294
|
## Recent Changes
|
|
295
|
+
- 001-config-init-wizard: 添加 `config init` 交互式向导,支持配置级别选择、平台配置和仓库配置
|
|
296
|
+
- 001-config-view: 添加 `config view` 子命令,支持查看配置文件内容和敏感字段高亮
|
|
297
|
+
- 001-cli-service-install: 添加 systemd 服务管理子命令(install/uninstall)
|
|
258
298
|
- 001-refactor-codebase: 重构为模块化包结构,保持向后兼容
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitwebhooks
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: A lightweight Git webhook server for automated deployment supporting GitHub, Gitee, GitLab, and custom webhooks
|
|
5
5
|
Author-email: Troy Tse <troy@holyhi.net>
|
|
6
6
|
Maintainer-email: Troy Tse <troy@holyhi.net>
|
|
@@ -90,29 +90,112 @@ gitwebhooks/
|
|
|
90
90
|
### Prerequisites
|
|
91
91
|
|
|
92
92
|
- Python 3.6 or higher
|
|
93
|
-
-
|
|
93
|
+
- pip (Python package manager)
|
|
94
|
+
- sudo/root access (for systemd service installation)
|
|
94
95
|
|
|
95
|
-
###
|
|
96
|
+
### Recommended: pipx (System-wide installation)
|
|
97
|
+
|
|
98
|
+
pipx is the recommended way to install git-webhooks-server system-wide.
|
|
96
99
|
|
|
97
100
|
```bash
|
|
98
|
-
#
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
# Install pipx (if not already installed)
|
|
102
|
+
sudo apt install pipx # Ubuntu/Debian
|
|
103
|
+
# or: python3 -m pip install --user pipx
|
|
101
104
|
|
|
102
|
-
#
|
|
103
|
-
|
|
105
|
+
# Install git-webhooks-server
|
|
106
|
+
pipx install git-webhooks-server
|
|
104
107
|
```
|
|
105
108
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
**Why pipx?**
|
|
110
|
+
- Isolated from system Python packages
|
|
111
|
+
- No dependency conflicts
|
|
112
|
+
- Easy to upgrade and uninstall
|
|
113
|
+
- Automatic service file configuration
|
|
114
|
+
|
|
115
|
+
### Alternative: venv (Virtual environment)
|
|
116
|
+
|
|
117
|
+
If you prefer using Python's built-in venv module:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Create virtual environment
|
|
121
|
+
python3 -m venv ~/venv/gitwebhooks
|
|
122
|
+
|
|
123
|
+
# Activate and install
|
|
124
|
+
source ~/venv/gitwebhooks/bin/activate
|
|
125
|
+
pip install git-webhooks-server
|
|
126
|
+
|
|
127
|
+
# Add to PATH (optional)
|
|
128
|
+
echo 'export PATH="$HOME/venv/gitwebhooks/bin:$PATH"' >> ~/.bashrc
|
|
129
|
+
source ~/.bashrc
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### ⚠️ NOT Recommended: System pip
|
|
133
|
+
|
|
134
|
+
**Warning**: Installing directly with `sudo pip install` is NOT recommended:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# DO NOT DO THIS
|
|
138
|
+
sudo pip install git-webhooks-server
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**Risks**:
|
|
142
|
+
- Can conflict with system Python packages
|
|
143
|
+
- May break system tools that depend on Python
|
|
144
|
+
- Difficult to uninstall cleanly
|
|
145
|
+
|
|
146
|
+
### Initialize Configuration
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Interactive configuration setup (prompts for configuration level)
|
|
150
|
+
gitwebhooks-cli config init
|
|
151
|
+
|
|
152
|
+
# Or specify configuration level directly
|
|
153
|
+
gitwebhooks-cli config init user # User level (~/.gitwebhooks.ini)
|
|
154
|
+
gitwebhooks-cli config init local # Local level (/usr/local/etc/gitwebhooks.ini)
|
|
155
|
+
sudo gitwebhooks-cli config init system # System level (/etc/gitwebhooks.ini, requires root)
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
The wizard will prompt for:
|
|
159
|
+
1. Configuration level (system/local/user)
|
|
160
|
+
2. Server configuration (address, port, log file)
|
|
161
|
+
3. Git platform (github/gitee/gitlab/custom)
|
|
162
|
+
4. Platform-specific settings (webhook events, verification, secret)
|
|
163
|
+
5. Repository configuration (name, working directory, deploy command)
|
|
164
|
+
|
|
165
|
+
This will create a configuration file with secure permissions (0600).
|
|
110
166
|
|
|
111
|
-
|
|
167
|
+
### Install as systemd Service
|
|
168
|
+
|
|
169
|
+
The service installation command automatically detects your installation type (pipx, venv, or system) and generates the appropriate service file.
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# Install and start as a systemd service
|
|
173
|
+
sudo gitwebhooks-cli service install
|
|
174
|
+
|
|
175
|
+
# Preview service file without installing (dry-run mode)
|
|
176
|
+
sudo gitwebhooks-cli service install --dry-run
|
|
177
|
+
|
|
178
|
+
# Install with verbose output
|
|
179
|
+
sudo gitwebhooks-cli service install --verbose
|
|
180
|
+
sudo gitwebhooks-cli service install -v # Basic verbosity
|
|
181
|
+
sudo gitwebhooks-cli service install -vv # Extra verbosity
|
|
182
|
+
|
|
183
|
+
# Force overwrite existing service
|
|
184
|
+
sudo gitwebhooks-cli service install --force
|
|
185
|
+
|
|
186
|
+
# Uninstall the service
|
|
187
|
+
sudo gitwebhooks-cli service uninstall
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Service file auto-detection**:
|
|
191
|
+
- **pipx installation**: Uses `gitwebhooks-cli` command directly
|
|
192
|
+
- **venv/virtualenv**: Uses `python -m gitwebhooks.cli` with environment's Python
|
|
193
|
+
- **System pip**: Uses system Python with `python -m gitwebhooks.cli`
|
|
194
|
+
- **conda**: Not supported - installation will be refused with clear error message
|
|
112
195
|
|
|
113
196
|
### Manual Installation
|
|
114
197
|
|
|
115
|
-
To install manually without
|
|
198
|
+
To install manually without pip:
|
|
116
199
|
|
|
117
200
|
```bash
|
|
118
201
|
# Make CLI executable
|
|
@@ -120,9 +203,6 @@ chmod +x gitwebhooks-cli
|
|
|
120
203
|
|
|
121
204
|
# Create hard link to system path
|
|
122
205
|
sudo ln "$(pwd)/gitwebhooks-cli" /usr/local/bin/gitwebhooks-cli
|
|
123
|
-
|
|
124
|
-
# Copy configuration
|
|
125
|
-
sudo cp git-webhooks-server.ini.sample /usr/local/etc/git-webhooks-server.ini
|
|
126
206
|
```
|
|
127
207
|
|
|
128
208
|
### Verify Installation
|
|
@@ -131,20 +211,89 @@ sudo cp git-webhooks-server.ini.sample /usr/local/etc/git-webhooks-server.ini
|
|
|
131
211
|
gitwebhooks-cli --help
|
|
132
212
|
```
|
|
133
213
|
|
|
134
|
-
##
|
|
214
|
+
## Migrating from System pip Installation
|
|
215
|
+
|
|
216
|
+
If you previously installed git-webhooks-server using `sudo pip install`,
|
|
217
|
+
follow these steps to migrate to a recommended installation method.
|
|
218
|
+
|
|
219
|
+
### Step 1: Uninstall the old installation
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
sudo pip uninstall git-webhooks-server
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Step 2: Backup your configuration (if exists)
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
cp ~/.gitwebhook.ini ~/.gitwebhook.ini.backup
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Step 3: Stop and uninstall the service (if installed)
|
|
135
232
|
|
|
136
233
|
```bash
|
|
137
|
-
|
|
138
|
-
|
|
234
|
+
sudo systemctl stop git-webhooks-server
|
|
235
|
+
sudo systemctl disable git-webhooks-server
|
|
236
|
+
sudo gitwebhooks-cli service uninstall
|
|
139
237
|
```
|
|
140
238
|
|
|
141
|
-
|
|
239
|
+
### Step 4: Install using the recommended method
|
|
240
|
+
|
|
241
|
+
Choose **pipx** (recommended):
|
|
242
|
+
```bash
|
|
243
|
+
# Install pipx if needed
|
|
244
|
+
sudo apt install pipx # Ubuntu/Debian
|
|
245
|
+
# or: python3 -m pip install --user pipx
|
|
246
|
+
|
|
247
|
+
# Install git-webhooks-server
|
|
248
|
+
pipx install git-webhooks-server
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Or **venv**:
|
|
252
|
+
```bash
|
|
253
|
+
# Create virtual environment
|
|
254
|
+
python3 -m venv ~/venv/gitwebhooks
|
|
255
|
+
source ~/venv/gitwebhooks/bin/activate
|
|
256
|
+
|
|
257
|
+
# Install git-webhooks-server
|
|
258
|
+
pip install git-webhooks-server
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Step 5: Restore configuration (if backed up)
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
# If you backed up your configuration
|
|
265
|
+
cp ~/.gitwebhook.ini.backup ~/.gitwebhook.ini
|
|
266
|
+
# Or create a new one
|
|
267
|
+
gitwebhooks-cli config init
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Step 6: Reinstall the service
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
sudo gitwebhooks-cli service install
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### Step 7: Verify
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
sudo systemctl status git-webhooks-server
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
## Uninstallation
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
# Uninstall systemd service (if installed)
|
|
286
|
+
sudo gitwebhooks-cli service uninstall --purge
|
|
287
|
+
|
|
288
|
+
# Remove the package
|
|
289
|
+
pip uninstall gitwebhooks
|
|
290
|
+
```
|
|
142
291
|
|
|
143
292
|
## Usage
|
|
144
293
|
|
|
145
294
|
### 1. Configure Repository
|
|
146
295
|
|
|
147
|
-
Edit
|
|
296
|
+
Edit `~/.gitwebhook.ini`:
|
|
148
297
|
|
|
149
298
|
```ini
|
|
150
299
|
[your_name/repository]
|
|
@@ -155,9 +304,11 @@ cmd=git fetch --all && git reset --hard origin/master && git pull
|
|
|
155
304
|
### 2. Restart Service
|
|
156
305
|
|
|
157
306
|
```bash
|
|
307
|
+
# If running as a service
|
|
158
308
|
systemctl restart git-webhooks-server
|
|
309
|
+
|
|
159
310
|
# Or run directly:
|
|
160
|
-
gitwebhooks-cli
|
|
311
|
+
gitwebhooks-cli
|
|
161
312
|
```
|
|
162
313
|
|
|
163
314
|
### 3. Add Webhook
|
|
@@ -211,7 +362,38 @@ Example payload:
|
|
|
211
362
|
|
|
212
363
|
## Configuration
|
|
213
364
|
|
|
214
|
-
Default configuration file:
|
|
365
|
+
Default configuration file: `~/.gitwebhook.ini`
|
|
366
|
+
|
|
367
|
+
### Initialize Configuration
|
|
368
|
+
|
|
369
|
+
```bash
|
|
370
|
+
# Interactive configuration setup
|
|
371
|
+
gitwebhooks-cli config init
|
|
372
|
+
|
|
373
|
+
# Or specify configuration level directly
|
|
374
|
+
gitwebhooks-cli config init user
|
|
375
|
+
sudo gitwebhooks-cli config init system
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### View Configuration
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
# View current configuration file (auto-detects location)
|
|
382
|
+
gitwebhooks-cli config view
|
|
383
|
+
|
|
384
|
+
# View specific configuration file
|
|
385
|
+
gitwebhooks-cli config view -c /path/to/config.ini
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
The `config view` command displays:
|
|
389
|
+
- Configuration file path and source (user-specified or auto-detected)
|
|
390
|
+
- Configuration content organized by sections
|
|
391
|
+
- Sensitive fields (containing: secret, password, token, key, passphrase) highlighted in yellow
|
|
392
|
+
|
|
393
|
+
To disable color highlighting:
|
|
394
|
+
```bash
|
|
395
|
+
NO_COLOR=1 gitwebhooks-cli config view
|
|
396
|
+
```
|
|
215
397
|
|
|
216
398
|
### Server Configuration
|
|
217
399
|
|
|
@@ -219,7 +401,7 @@ Default configuration file: `/usr/local/etc/git-webhooks-server.ini`
|
|
|
219
401
|
[server]
|
|
220
402
|
address=0.0.0.0 # Listen address
|
|
221
403
|
port=6789 # Listen port
|
|
222
|
-
log_file
|
|
404
|
+
log_file=~/.gitwebhook.log # Log file (empty = stdout only)
|
|
223
405
|
```
|
|
224
406
|
|
|
225
407
|
### SSL Configuration (Optional)
|