Skip to content

Commit d71cddb

Browse files
authored
Update readme (#107)
1 parent 0f05e3a commit d71cddb

File tree

1 file changed

+152
-1
lines changed

1 file changed

+152
-1
lines changed

README.md

Lines changed: 152 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,152 @@
1-
# indy-promote-service
1+
# Indy Promote Service
2+
3+
A microservice for promoting artifacts between repositories with validation and tracking capabilities. Built with Quarkus and designed for the Commonjava/Indy ecosystem.
4+
5+
## Overview
6+
7+
The Indy Promote Service enables controlled promotion of artifacts from source repositories to target repositories with comprehensive validation rules, conflict detection, and audit tracking. It supports multiple package types including Maven, NPM, and Generic HTTP content.
8+
9+
## Key Features
10+
11+
- **Multi-package Support**: Maven, NPM, and Generic HTTP artifacts
12+
- **Validation Framework**: Groovy-based validation rules with rule sets
13+
- **Conflict Detection**: Prevents overwriting existing artifacts with different checksums
14+
- **All-or-Nothing Policy**: Automatic rollback on any failure
15+
- **Async/Sync Operations**: Support for both synchronous and asynchronous promotion
16+
- **Audit Tracking**: Cassandra-based tracking of all promotion activities
17+
- **RESTful API**: OpenAPI/Swagger documented endpoints
18+
19+
## Architecture
20+
21+
### Core Components
22+
23+
- **PromotionManager**: Orchestrates the promotion process
24+
- **PromotionValidator**: Executes validation rules against promotion requests
25+
- **ContentDigester**: Handles checksum calculation and verification
26+
- **PathConflictManager**: Manages path conflicts and rollback operations
27+
- **PromoteTrackingManager**: Tracks promotion history in Cassandra
28+
29+
### Package Types
30+
31+
- **Maven**: Java artifacts with POM validation
32+
- **NPM**: Node.js packages with package.json validation
33+
- **Generic**: HTTP-based content with basic validation
34+
35+
## API Endpoints
36+
37+
### Promotion Operations
38+
- `POST /api/promotion/paths/promote` - Promote artifacts between repositories
39+
- `GET /api/promotion/admin/validation/rules/all` - List all validation rules
40+
- `GET /api/promotion/admin/validation/rulesets` - List rule sets
41+
- `GET /api/promotion/admin/query/{packageType}/{type}/{name}/{path}` - Query promotion history
42+
43+
## Configuration
44+
45+
### Application Properties
46+
47+
```yaml
48+
promote:
49+
baseDir: "data" # Directory for rules and rule-sets
50+
callbackUri: "callbackUri" # Callback URL for async operations
51+
threadpools:
52+
promote-runner: 8 # Promotion execution threads
53+
promote-rules-runner: 16 # Validation rule execution threads
54+
promote-rules-batch-executor: 16 # Batch processing threads
55+
```
56+
57+
### Service Dependencies
58+
59+
- **Storage Service**: For artifact storage operations
60+
- **Content Service**: For content retrieval and metadata
61+
- **Repository Service**: For repository management
62+
- **Kafka**: For event publishing (optional)
63+
64+
## Validation Rules
65+
66+
Validation rules are written in Groovy and support:
67+
68+
- **Path Validation**: Check for pre-existing paths and conflicts
69+
- **Content Validation**: Verify POM/package.json structure
70+
- **Version Patterns**: Enforce version naming conventions
71+
- **Checksum Verification**: Ensure content integrity
72+
73+
### Example Rule Set
74+
75+
```json
76+
{
77+
"name": "maven-pnc-builds",
78+
"storeKeyPattern": "maven:[^:]+:pnc-builds",
79+
"ruleNames": [
80+
"parsable-pom.groovy",
81+
"no-pre-existing-paths.groovy",
82+
"project-version-pattern.groovy"
83+
],
84+
"validationParameters": {
85+
"availableInStores": "group:builds-untested",
86+
"versionPattern": "\\d+\\.\\d+\\.\\d+\\.(?:[\\w_-]+-)?redhat-\\d{5}"
87+
}
88+
}
89+
```
90+
91+
## Development
92+
93+
### Prerequisites
94+
95+
- Java 11+
96+
- Maven 3.6+
97+
- Cassandra (for tracking)
98+
- Docker (optional, for testing)
99+
100+
### Building
101+
102+
```bash
103+
mvn clean compile
104+
```
105+
106+
### Running Tests
107+
108+
```bash
109+
mvn test
110+
```
111+
112+
### Running Locally
113+
114+
```bash
115+
mvn quarkus:dev
116+
```
117+
118+
The service will start on `http://localhost:8080` with Swagger UI available at `http://localhost:8080/q/swagger-ui`.
119+
120+
### Docker
121+
122+
```bash
123+
docker-compose up
124+
```
125+
126+
## Error Handling
127+
128+
The service uses two main exception types for error handling:
129+
130+
### PromotionException
131+
The primary exception for promotion operation failures. Used when:
132+
- Promotion execution fails due to system errors
133+
- Network or storage service communication issues
134+
- General promotion process failures
135+
136+
### PromotionValidationException
137+
Used for validation-specific failures with detailed error messages and cause information. Extends `Exception` and includes:
138+
- Custom `toString()` method that incorporates cause messages
139+
- Support for rule-specific error context
140+
- Detailed validation failure information
141+
142+
All promotion operations follow an all-or-nothing policy with automatic rollback on any failure.
143+
144+
## Monitoring
145+
146+
- **Logging**: Structured logging with configurable levels
147+
- **Metrics**: OpenTelemetry integration for observability
148+
- **Health Checks**: Built-in health endpoints
149+
150+
## License
151+
152+
Licensed under the Apache License, Version 2.0. See the [LICENSE](LICENSE) file for details.

0 commit comments

Comments
 (0)