infctl-cli/README.md

82 lines
2.6 KiB
Markdown
Raw Permalink Normal View History

2025-07-09 12:08:08 +01:00
# infctl-cli
2025-07-09 12:08:08 +01:00
`infctl-cli` is a Go command-line tool for orchestrating deployment pipelines using shell scripts and Kubernetes manifests. The tool is configured via JSON files and executes tasks as defined in a pipeline configuration.
2025-07-09 12:08:08 +01:00
## Project Structure
2025-07-09 12:08:08 +01:00
```
infctl-cli/
├── main.go # Application entry point
├── go.mod # Go module definition
├── app/ # Core application logic
│ ├── app.go # Pipeline orchestration and state management
│ └── k8s.go # Kubernetes operations
├── config/ # Configuration management
│ ├── base.go # Base configuration handling
│ └── project.go # Project configuration handling
├── docs/ # Documentation
│ ├── API_REFERENCE.md # API reference
│ └── CONFIG_SCHEMA.md # Config schema
├── scripts/ # Shell scripts executed by the CLI
├── k8s-manifests/ # Kubernetes manifests
├── templates/ # Template files
└── files/ # Static configuration files
```
## Configuration Files
Three JSON files are used:
- `base.json`: Base configuration (e.g., `projects_directory`, images, environment file path)
- `config.json`: Project-specific configuration (e.g., project name, directory, URLs, port)
- `pipeline.json`: Defines the sequence of scripts and manifests to execute
Example configuration files are provided as `.example` files in the repository.
## Usage
Build the CLI:
2025-07-09 12:08:08 +01:00
```bash
go mod download
go build -o infctl-cli .
```
Run the CLI with a pipeline file:
2025-07-09 12:08:08 +01:00
```bash
./infctl-cli --deployment-file pipeline.json
# or
./infctl-cli -f pipeline.json
2025-07-09 12:08:08 +01:00
```
The CLI will:
1. Load base and project configuration
2. Initialize SQLite database for state management
3. Execute the pipeline defined in the JSON file
4. Run scripts from the `scripts/` directory
5. Apply Kubernetes manifests from the `k8s-manifests/` directory
2025-07-09 12:08:08 +01:00
## Scripts
2025-07-09 12:08:08 +01:00
Shell scripts in `scripts/` are executed as defined in the pipeline configuration. Scripts are responsible for infrastructure setup, secret creation, configmap generation, and other deployment tasks. The pipeline JSON determines the order and parameters for each script.
2025-07-09 12:08:08 +01:00
## Kubernetes Manifests
Manifests in `k8s-manifests/` are applied using kubectl and kustomize. The pipeline configuration specifies which manifests to apply and in what order.
2025-07-09 12:08:08 +01:00
## Testing
2025-07-09 12:08:08 +01:00
Run tests with:
2025-07-09 12:08:08 +01:00
```bash
go test ./... -v
2025-07-09 12:08:08 +01:00
```
## License
This project is licensed under the GNU General Public License v3.0. See `LICENSE` for details.