gitwebhooks 2.1.0__py3-none-any.whl
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/__init__.py +18 -0
- gitwebhooks/__main__.py +10 -0
- gitwebhooks/auth/__init__.py +20 -0
- gitwebhooks/auth/custom.py +40 -0
- gitwebhooks/auth/factory.py +73 -0
- gitwebhooks/auth/gitee.py +86 -0
- gitwebhooks/auth/github.py +52 -0
- gitwebhooks/auth/gitlab.py +29 -0
- gitwebhooks/auth/verifier.py +34 -0
- gitwebhooks/cli/__init__.py +107 -0
- gitwebhooks/cli/config.py +216 -0
- gitwebhooks/cli/init_wizard.py +701 -0
- gitwebhooks/cli/prompts.py +275 -0
- gitwebhooks/cli/service.py +374 -0
- gitwebhooks/config/__init__.py +17 -0
- gitwebhooks/config/loader.py +170 -0
- gitwebhooks/config/models.py +145 -0
- gitwebhooks/config/registry.py +104 -0
- gitwebhooks/config/server.py +85 -0
- gitwebhooks/handlers/__init__.py +22 -0
- gitwebhooks/handlers/base.py +107 -0
- gitwebhooks/handlers/custom.py +73 -0
- gitwebhooks/handlers/factory.py +83 -0
- gitwebhooks/handlers/gitee.py +113 -0
- gitwebhooks/handlers/github.py +43 -0
- gitwebhooks/handlers/gitlab.py +43 -0
- gitwebhooks/handlers/request.py +248 -0
- gitwebhooks/logging/__init__.py +10 -0
- gitwebhooks/logging/setup.py +57 -0
- gitwebhooks/main/__init__.py +117 -0
- gitwebhooks/main/__main__.py +12 -0
- gitwebhooks/models/__init__.py +14 -0
- gitwebhooks/models/provider.py +22 -0
- gitwebhooks/models/request.py +61 -0
- gitwebhooks/models/result.py +40 -0
- gitwebhooks/server.py +128 -0
- gitwebhooks/utils/__init__.py +14 -0
- gitwebhooks/utils/constants.py +55 -0
- gitwebhooks/utils/exceptions.py +34 -0
- gitwebhooks/utils/executor.py +34 -0
- gitwebhooks/utils/systemd.py +274 -0
- gitwebhooks-2.1.0.dist-info/METADATA +494 -0
- gitwebhooks-2.1.0.dist-info/RECORD +47 -0
- gitwebhooks-2.1.0.dist-info/WHEEL +5 -0
- gitwebhooks-2.1.0.dist-info/entry_points.txt +2 -0
- gitwebhooks-2.1.0.dist-info/licenses/LICENSE +21 -0
- gitwebhooks-2.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gitwebhooks
|
|
3
|
+
Version: 2.1.0
|
|
4
|
+
Summary: A lightweight Git webhook server for automated deployment supporting GitHub, Gitee, GitLab, and custom webhooks
|
|
5
|
+
Author-email: Troy Tse <troy@holyhi.net>
|
|
6
|
+
Maintainer-email: Troy Tse <troy@holyhi.net>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/troytse/git-webhooks-server
|
|
9
|
+
Project-URL: Documentation, https://github.com/troytse/git-webhooks-server#readme
|
|
10
|
+
Project-URL: Repository, https://github.com/troytse/git-webhooks-server.git
|
|
11
|
+
Project-URL: Issues, https://github.com/troytse/git-webhooks-server/issues
|
|
12
|
+
Keywords: webhook,git,github,gitee,gitlab,deployment,automation,server,devops
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Environment :: No Input/Output (Daemon)
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Intended Audience :: System Administrators
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
28
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
|
|
29
|
+
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
30
|
+
Classifier: Topic :: System :: Installation/Setup
|
|
31
|
+
Classifier: Topic :: System :: Systems Administration
|
|
32
|
+
Classifier: Typing :: Typed
|
|
33
|
+
Requires-Python: >=3.6
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
License-File: LICENSE
|
|
36
|
+
Provides-Extra: dev
|
|
37
|
+
Requires-Dist: pytest>=6.0; extra == "dev"
|
|
38
|
+
Requires-Dist: pytest-cov>=2.0; extra == "dev"
|
|
39
|
+
Dynamic: license-file
|
|
40
|
+
|
|
41
|
+
# Simple Git Webhooks Server
|
|
42
|
+
|
|
43
|
+
[README](README.md) | [中文说明](README.zh.md)
|
|
44
|
+
|
|
45
|
+
## Table of Contents
|
|
46
|
+
- [Introduction](#introduction)
|
|
47
|
+
- [Architecture](#architecture)
|
|
48
|
+
- [Installation](#installation)
|
|
49
|
+
- [Uninstallation](#uninstallation)
|
|
50
|
+
- [Usage](#usage)
|
|
51
|
+
- [Github](#github)
|
|
52
|
+
- [Gitee](#gitee)
|
|
53
|
+
- [Gitlab](#gitlab)
|
|
54
|
+
- [Custom](#custom)
|
|
55
|
+
- [Configuration](#configuration)
|
|
56
|
+
- [Project Structure](#project-structure)
|
|
57
|
+
|
|
58
|
+
## Introduction
|
|
59
|
+
|
|
60
|
+
A lightweight Git webhook server for automated deployment.
|
|
61
|
+
|
|
62
|
+
- Implemented with Python 3.6+ (standard library only)
|
|
63
|
+
- Supports Github, Gitee, Gitlab, and custom repositories
|
|
64
|
+
- Custom working directory and command for different repositories
|
|
65
|
+
- Installable as a Systemd service
|
|
66
|
+
- Modular architecture for easy extension and testing
|
|
67
|
+
|
|
68
|
+
## Architecture
|
|
69
|
+
|
|
70
|
+
**Version 2.0** features a modular package structure:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
gitwebhooks/
|
|
74
|
+
├── models/ # Data models (Provider, Request, Result)
|
|
75
|
+
├── config/ # Configuration management
|
|
76
|
+
├── auth/ # Signature verification
|
|
77
|
+
├── handlers/ # Webhook handlers
|
|
78
|
+
├── utils/ # Utilities
|
|
79
|
+
└── logging/ # Logging setup
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Key Features:**
|
|
83
|
+
- **Dependency Injection**: ConfigurationRegistry, VerifierFactory, HandlerFactory
|
|
84
|
+
- **Abstract Base Classes**: SignatureVerifier, WebhookHandler
|
|
85
|
+
- **No External Dependencies**: 100% Python standard library
|
|
86
|
+
- **In-Place Execution**: CLI runs from source directory
|
|
87
|
+
|
|
88
|
+
## Installation
|
|
89
|
+
|
|
90
|
+
### Prerequisites
|
|
91
|
+
|
|
92
|
+
- Python 3.6 or higher
|
|
93
|
+
- pip (Python package manager)
|
|
94
|
+
- sudo/root access (for systemd service installation)
|
|
95
|
+
|
|
96
|
+
### Recommended: pipx (System-wide installation)
|
|
97
|
+
|
|
98
|
+
pipx is the recommended way to install git-webhooks-server system-wide.
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# Install pipx (if not already installed)
|
|
102
|
+
sudo apt install pipx # Ubuntu/Debian
|
|
103
|
+
# or: python3 -m pip install --user pipx
|
|
104
|
+
|
|
105
|
+
# Install git-webhooks-server
|
|
106
|
+
pipx install git-webhooks-server
|
|
107
|
+
```
|
|
108
|
+
|
|
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).
|
|
166
|
+
|
|
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
|
|
195
|
+
|
|
196
|
+
### Manual Installation
|
|
197
|
+
|
|
198
|
+
To install manually without pip:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
# Make CLI executable
|
|
202
|
+
chmod +x gitwebhooks-cli
|
|
203
|
+
|
|
204
|
+
# Create hard link to system path
|
|
205
|
+
sudo ln "$(pwd)/gitwebhooks-cli" /usr/local/bin/gitwebhooks-cli
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Verify Installation
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
gitwebhooks-cli --help
|
|
212
|
+
```
|
|
213
|
+
|
|
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)
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
sudo systemctl stop git-webhooks-server
|
|
235
|
+
sudo systemctl disable git-webhooks-server
|
|
236
|
+
sudo gitwebhooks-cli service uninstall
|
|
237
|
+
```
|
|
238
|
+
|
|
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
|
+
```
|
|
291
|
+
|
|
292
|
+
## Usage
|
|
293
|
+
|
|
294
|
+
### 1. Configure Repository
|
|
295
|
+
|
|
296
|
+
Edit `~/.gitwebhook.ini`:
|
|
297
|
+
|
|
298
|
+
```ini
|
|
299
|
+
[your_name/repository]
|
|
300
|
+
cwd=/path/to/your/repository
|
|
301
|
+
cmd=git fetch --all && git reset --hard origin/master && git pull
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### 2. Restart Service
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
# If running as a service
|
|
308
|
+
systemctl restart git-webhooks-server
|
|
309
|
+
|
|
310
|
+
# Or run directly:
|
|
311
|
+
gitwebhooks-cli
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### 3. Add Webhook
|
|
315
|
+
|
|
316
|
+
#### Github
|
|
317
|
+
|
|
318
|
+

|
|
319
|
+

|
|
320
|
+
|
|
321
|
+
#### Gitee
|
|
322
|
+
|
|
323
|
+

|
|
324
|
+

|
|
325
|
+
|
|
326
|
+
#### Gitlab
|
|
327
|
+
|
|
328
|
+

|
|
329
|
+

|
|
330
|
+
|
|
331
|
+
#### Custom
|
|
332
|
+
|
|
333
|
+
For custom webhook sources, configure like this:
|
|
334
|
+
|
|
335
|
+
```ini
|
|
336
|
+
[custom]
|
|
337
|
+
# Header to identify the source
|
|
338
|
+
header_name=X-Custom-Header
|
|
339
|
+
header_value=Custom-Git-Hookshot
|
|
340
|
+
# Header for token verification
|
|
341
|
+
header_token=X-Custom-Token
|
|
342
|
+
# Path to repository name in JSON payload
|
|
343
|
+
identifier_path=project.path_with_namespace
|
|
344
|
+
verify=True
|
|
345
|
+
secret=123456
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
The handler accepts POST data with `application/json` or `application/x-www-form-urlencoded` content type. See [Github](https://developer.github.com/webhooks/event-payloads/#example-delivery) / [Gitee](https://gitee.com/help/articles/4186) / [Gitlab](https://gitlab.com/help/user/project/integrations/webhooks#push-events) for payload examples.
|
|
349
|
+
|
|
350
|
+
Example payload:
|
|
351
|
+
```json
|
|
352
|
+
{
|
|
353
|
+
"project": {
|
|
354
|
+
"path_with_namespace": "your_name/repository"
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+

|
|
360
|
+

|
|
361
|
+

|
|
362
|
+
|
|
363
|
+
## Configuration
|
|
364
|
+
|
|
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
|
+
```
|
|
397
|
+
|
|
398
|
+
### Server Configuration
|
|
399
|
+
|
|
400
|
+
```ini
|
|
401
|
+
[server]
|
|
402
|
+
address=0.0.0.0 # Listen address
|
|
403
|
+
port=6789 # Listen port
|
|
404
|
+
log_file=~/.gitwebhook.log # Log file (empty = stdout only)
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### SSL Configuration (Optional)
|
|
408
|
+
|
|
409
|
+
```ini
|
|
410
|
+
[ssl]
|
|
411
|
+
enable=False
|
|
412
|
+
key_file=/path/to/key.pem
|
|
413
|
+
cert_file=/path/to/cert.pem
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### Provider Configuration
|
|
417
|
+
|
|
418
|
+
```ini
|
|
419
|
+
[github]
|
|
420
|
+
verify=True # Enable signature verification
|
|
421
|
+
secret=your_webhook_secret
|
|
422
|
+
handle_events=push,pull_request # Events to handle (empty = all)
|
|
423
|
+
|
|
424
|
+
[gitee]
|
|
425
|
+
verify=True
|
|
426
|
+
secret=your_webhook_secret
|
|
427
|
+
|
|
428
|
+
[gitlab]
|
|
429
|
+
verify=True
|
|
430
|
+
secret=your_webhook_token
|
|
431
|
+
|
|
432
|
+
[custom]
|
|
433
|
+
header_name=X-Custom-Header
|
|
434
|
+
header_value=Your-Identifier
|
|
435
|
+
header_token=X-Custom-Token
|
|
436
|
+
identifier_path=project.path_with_namespace
|
|
437
|
+
verify=True
|
|
438
|
+
secret=your_secret
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
### Repository Configuration
|
|
442
|
+
|
|
443
|
+
```ini
|
|
444
|
+
[owner/repository]
|
|
445
|
+
cwd=/path/to/repo # Working directory
|
|
446
|
+
cmd=your_command # Command to execute
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
## Project Structure
|
|
450
|
+
|
|
451
|
+
```
|
|
452
|
+
git-webhooks-server/
|
|
453
|
+
├── gitwebhooks/ # Python package (modular v2.0)
|
|
454
|
+
│ ├── __init__.py
|
|
455
|
+
│ ├── __main__.py
|
|
456
|
+
│ ├── cli.py # CLI entry point
|
|
457
|
+
│ ├── server.py # HTTP server
|
|
458
|
+
│ ├── models/ # Data models
|
|
459
|
+
│ ├── config/ # Configuration management
|
|
460
|
+
│ ├── auth/ # Signature verification
|
|
461
|
+
│ ├── handlers/ # Webhook handlers
|
|
462
|
+
│ ├── utils/ # Utilities
|
|
463
|
+
│ └── logging/ # Logging setup
|
|
464
|
+
├── gitwebhooks-cli # CLI wrapper script
|
|
465
|
+
├── install.sh # Installation script
|
|
466
|
+
├── git-webhooks-server.ini.sample
|
|
467
|
+
└── tests/ # Test suite
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
## Development
|
|
471
|
+
|
|
472
|
+
### Running from Source
|
|
473
|
+
|
|
474
|
+
```bash
|
|
475
|
+
# Method 1: Use CLI tool (recommended)
|
|
476
|
+
./gitwebhooks-cli -c git-webhooks-server.ini.sample
|
|
477
|
+
|
|
478
|
+
# Method 2: Use module entry
|
|
479
|
+
python3 -m gitwebhooks.cli -c git-webhooks-server.ini.sample
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
### Running Tests
|
|
483
|
+
|
|
484
|
+
```bash
|
|
485
|
+
# Using pytest
|
|
486
|
+
python3 -m pytest tests/
|
|
487
|
+
|
|
488
|
+
# Or using unittest
|
|
489
|
+
python3 -m unittest discover tests/
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
## License
|
|
493
|
+
|
|
494
|
+
MIT License
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
gitwebhooks/__init__.py,sha256=lBuLRzIrUhawp8mQG3IB5HZiksNeUmuuDBRK5_hcZvw,422
|
|
2
|
+
gitwebhooks/__main__.py,sha256=DW1lmngPDSFHJKSyaG2Dd5k3UguGSuYPUM2xKR8DhTo,189
|
|
3
|
+
gitwebhooks/server.py,sha256=keQcfOysoitx7cINcTkaDvhe6nScIFL2K8dCCViFF-o,3986
|
|
4
|
+
gitwebhooks/auth/__init__.py,sha256=Hu88BS6aOickrWBBWM2ppTzy2xOJfWODYkp752bPTPM,532
|
|
5
|
+
gitwebhooks/auth/custom.py,sha256=zDJdQCOCCd1u1D10T7a6rE2KUggBXvgjtTkQPL3Thfc,1216
|
|
6
|
+
gitwebhooks/auth/factory.py,sha256=vvI1epyIGQ4MSgjRrW7Gya98Kc9k8WzjOru_PpMgOB8,2474
|
|
7
|
+
gitwebhooks/auth/gitee.py,sha256=8o_tKugZrW2or-uoRzjCo3h-WRlm3zbYmkTNbf5zL6s,3249
|
|
8
|
+
gitwebhooks/auth/github.py,sha256=sY3xPwfYvD3tID5b26qHhTI1E9EW2VNHaFEygmsZYCg,1619
|
|
9
|
+
gitwebhooks/auth/gitlab.py,sha256=Aoz77VbYRASxNXqOAnK5__9hkGgaf9kLMoCgOnvFMNE,862
|
|
10
|
+
gitwebhooks/auth/verifier.py,sha256=onIvbmFVWpk7vkdEiyF48S4KrtbP48NH3FLz0fE24XE,971
|
|
11
|
+
gitwebhooks/cli/__init__.py,sha256=o81CV1rggR_YqSW80JP_CSKMGBQkQYJqDjsiUtvvW-I,2891
|
|
12
|
+
gitwebhooks/cli/config.py,sha256=rVq7qh2KB9Z4Up2bc9zWDvGpf28iALdnu1pGIJ0p6-8,6373
|
|
13
|
+
gitwebhooks/cli/init_wizard.py,sha256=PfCZfYodoUtHCSX1aLdhXJtSg0YD4oCUcNJaL0tSQVs,21463
|
|
14
|
+
gitwebhooks/cli/prompts.py,sha256=slbAcjEUY83lanuXbfyt7BP4m1ZrgQEcgkjI96hsw60,7167
|
|
15
|
+
gitwebhooks/cli/service.py,sha256=GC3C2WPr4JzyYig3eh4WA4_NdWLfKuxgx7AJrkPJYE4,11057
|
|
16
|
+
gitwebhooks/config/__init__.py,sha256=CnU2ybNi8Yf5YqGWe7uls98ditREEuxuj5mW0t1ti0s,413
|
|
17
|
+
gitwebhooks/config/loader.py,sha256=rrMBunCE1swj-KMDvkTxy-mzG-Lalz-l0Hsw1Xw0rFc,5390
|
|
18
|
+
gitwebhooks/config/models.py,sha256=oZ0ISLxh0zq5U7fqpAk2as7qHsOcbwj257BZEaK1zO8,4758
|
|
19
|
+
gitwebhooks/config/registry.py,sha256=5_rsi9rKkgxiDSnnRmPYCy6AQCEBPxeKgmUC-_4u6h4,3165
|
|
20
|
+
gitwebhooks/config/server.py,sha256=ucFDoLF4QWPqn_-rBRe2uerpxMS6AgM2TLbC89o9zdQ,2739
|
|
21
|
+
gitwebhooks/handlers/__init__.py,sha256=nkGxNoHdrcNtQ2I5TlVNqJovUfmG7vDlagxGLsCKqsk,505
|
|
22
|
+
gitwebhooks/handlers/base.py,sha256=Hd_FScG3E5fe2ZCihFaAghWHGdQLliix1r_Mxeyp1S0,3416
|
|
23
|
+
gitwebhooks/handlers/custom.py,sha256=rGkIdOqrqdW64VTLwbcTS4zOAfcZAL1OdDq5UcsJsEI,2660
|
|
24
|
+
gitwebhooks/handlers/factory.py,sha256=wZHHSVXh_pJvdipkdmtMdzaTsTny7zEGxZqSVlAsr6Q,2570
|
|
25
|
+
gitwebhooks/handlers/gitee.py,sha256=_mXqVXYBRQB1JMWO-QbaBxTD3Efj_ZFYMWa3csfLjgQ,4149
|
|
26
|
+
gitwebhooks/handlers/github.py,sha256=gUMFn4Y47JM8m4ot55_zGaDFOzM03Gz8J9_Ov8aFBjo,1617
|
|
27
|
+
gitwebhooks/handlers/gitlab.py,sha256=UkK3R_KSKSt0s7XAtH1_G_uid85tqiL12qND8_PnosA,1610
|
|
28
|
+
gitwebhooks/handlers/request.py,sha256=uedC-zAehQZzG4YIUdq4TsQYPZ-PoVHkKDJb-FEC27s,8989
|
|
29
|
+
gitwebhooks/logging/__init__.py,sha256=CmL5WD2RgZ76uhrxzwnIfOEd_HgTZMTtTjjqYSY06GA,146
|
|
30
|
+
gitwebhooks/logging/setup.py,sha256=Y9h0WGDudCrdLZ8dm_Xp3zt_Xp7x7WdDio4MK9ZFBCg,1577
|
|
31
|
+
gitwebhooks/main/__init__.py,sha256=U8ls6BZYY-OheBOwMM3wVDQhIgmylcc3M7WRYZ_K4fs,3163
|
|
32
|
+
gitwebhooks/main/__main__.py,sha256=qE-72BSpj15NeV6-oWpMXR3ARmATeSGUO8VUB98sxF8,223
|
|
33
|
+
gitwebhooks/models/__init__.py,sha256=DmZBPoNeh7eB9Ntr6d4T9QY6-LckvrHNGg8FVcpuvP0,273
|
|
34
|
+
gitwebhooks/models/provider.py,sha256=lmjJvGjklD1VTKB6UF9V-gZCPwXhiip8DR8qXs_A-F8,451
|
|
35
|
+
gitwebhooks/models/request.py,sha256=UkdTiBpX4-XipeOnhE0SvAaR53bFFh8EKftSVFjNBLM,1838
|
|
36
|
+
gitwebhooks/models/result.py,sha256=0M3fjeUH3CM4Mjpc9e4ZxBdfPO9xlODRRdlshVomQYQ,1020
|
|
37
|
+
gitwebhooks/utils/__init__.py,sha256=qZcrINToHF8qAtIIDAjOlzfKcohCVyYe2ZaKYsWbOxY,219
|
|
38
|
+
gitwebhooks/utils/constants.py,sha256=V_SFYrHpkX-fKSfVwx8fXwBjZe2f4EjoVz925RZryrs,1729
|
|
39
|
+
gitwebhooks/utils/exceptions.py,sha256=Mfz-FOCiHZiYmpSQDw36S9HarLE2wPLfFbkeHfWJnkk,627
|
|
40
|
+
gitwebhooks/utils/executor.py,sha256=-zQUV5t-eq0JF6T4EvsUlvg4lnBtahRGrV8N3iVgx_c,923
|
|
41
|
+
gitwebhooks/utils/systemd.py,sha256=eseaVdsxBofZf7yQPCOP-CbmZapRJtrS0vnBGERdL0s,7925
|
|
42
|
+
gitwebhooks-2.1.0.dist-info/licenses/LICENSE,sha256=NV5F0xpN-DVJuhc0qzOsXtLjf3l8X18zehW_7F4qI50,1083
|
|
43
|
+
gitwebhooks-2.1.0.dist-info/METADATA,sha256=ZMiNBDT_VYs19b3sjbREyiiSTDw1fl5xuOy0yTlwCeI,12854
|
|
44
|
+
gitwebhooks-2.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
45
|
+
gitwebhooks-2.1.0.dist-info/entry_points.txt,sha256=AVgLU9oFCt0XW_GbziMiGoHREewpn6JJQ_FTYX7jsGc,57
|
|
46
|
+
gitwebhooks-2.1.0.dist-info/top_level.txt,sha256=9a6CxnHxBD53HL38GUeZETIvnUhUKcgDRIGJkCqwc3o,12
|
|
47
|
+
gitwebhooks-2.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Troy Tse <troy@holyhi.net>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
gitwebhooks
|