cki_tools.testing_farm_dashboard
Web dashboard for viewing and filtering Testing Farm API requests
	
	Overview
The Testing Farm Dashboard is a Flask-based web application that provides a user-friendly interface for viewing and filtering Testing Farm API requests. It allows users to browse test results, apply filters, and export data in various formats.
Features
- Web Interface: Clean, responsive dashboard with Bootstrap UI
 - Advanced Filtering: Filter by TMT context (arch, distro, compose), creation date, and more
 - Multiple Context Filters: Support for AND logic across multiple key-value pairs
 - Plan Information: Display test plan names and URLs from FMF metadata
 - Data Export: Export filtered results to JSON or CSV formats
 - Production Ready: Built-in Gunicorn support for production deployment
 - CKI Integration: Automatic credential management when deployed in CKI environments
 
CLI Usage
$ cki_dashboard --help
usage: cli.py [-h] [--version] {serve,show,export} ...
Testing Farm Dashboard CLI
positional arguments:
  {serve,show,export}  Available commands
    serve              Start the dashboard server
    show               Show current Testing Farm data
    export             Export Testing Farm data
options:
  -h, --help           show this help message and exit
  --version            show program's version number and exit
Serve Command (Web Dashboard)
$ cki_dashboard serve --help
usage: cli.py serve [-h] [--host HOST] [--port PORT] [--debug] [--production]
                    [--workers WORKERS] [--open-browser]
options:
  -h, --help         show this help message and exit
  --host HOST        Host to bind to
  --port PORT        Port to bind to
  --debug            Enable debug mode
  --production       Run with Gunicorn production server
  --workers WORKERS  Number of Gunicorn workers (production mode only)
  --open-browser     Open browser automatically
Show Command (CLI Data View)
$ cki_dashboard show --help
usage: cli.py show [-h] [--token-id TOKEN_ID] [--created-after CREATED_AFTER]
                   [--limit LIMIT] [--format {json,table}] [--cki-defaults]
options:
  -h, --help            show this help message and exit
  --token-id TOKEN_ID   Testing Farm token ID
  --created-after CREATED_AFTER
                        Filter by creation date (YYYY-MM-DD)
  --limit LIMIT         Limit number of results
  --format {json,table} Output format
  --cki-defaults        Apply CKI default filters
Export Command (Data Export)
$ cki_dashboard export --help
usage: cli.py export [-h] [--output OUTPUT] [--token-id TOKEN_ID]
                     [--created-after CREATED_AFTER] [--limit LIMIT]
                     [--format {json,csv}] [--cki-defaults]
options:
  -h, --help            show this help message and exit
  --output OUTPUT, -o OUTPUT
                        Output file path
  --token-id TOKEN_ID   Testing Farm token ID
  --created-after CREATED_AFTER
                        Filter by creation date (YYYY-MM-DD)
  --limit LIMIT         Limit number of results
  --format {json,csv}   Export format
  --cki-defaults        Apply CKI default filters
Deployment Options
Development Server
# Start development server
cki_dashboard serve --host 127.0.0.1 --port 8000 --debug
# Alternative CLI entry point
cki_dashboard_server --host 127.0.0.1 --port 8000 --debug
Production Server
# Start production server with Gunicorn
cki_dashboard serve --production --host 0.0.0.0 --port 8000 --workers 4
# Alternative CLI entry point
cki_dashboard_server --production --host 0.0.0.0 --port 8000 --workers 4
Container Deployment
# Build container image
podman build -t testing-farm-dashboard .
# Run container
podman run -d \
  --name testing-farm-dashboard \
  -p 8000:8000 \
  -e TESTING_FARM_TOKEN_ID=your-token-id \
  testing-farm-dashboard \
  cki_dashboard_server --production --host 0.0.0.0 --port 8000
Systemd Service
[Unit]
Description=Testing Farm Dashboard
After=network.target
[Service]
Type=exec
User=dashboard
Environment=TESTING_FARM_TOKEN_ID=your-token-id
Environment=PORT=8000
ExecStart=/usr/local/bin/cki_dashboard_server --production --host 0.0.0.0 \
  --port 8000 --workers 2
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
Configuration via environment variables
| Name | Secret | Required | Description | 
|---|---|---|---|
TESTING_FARM_TOKEN_ID | 
no | no | Testing Farm API token ID (uses default if not set) | 
PORT | 
no | no | Server port. Default: 8000 | 
FLASK_HOST | 
no | no | Server host binding. Default: 127.0.0.1 | 
FLASK_DEBUG | 
no | no | Enable Flask debug mode. Default: False | 
SECRET_KEY | 
yes | no | Flask secret key (required for production) | 
WORKERS | 
no | no | Number of Gunicorn workers. Default: 2 | 
LOG_LEVEL | 
no | no | Logging level. Default: info | 
CKI Integration
When deployed in CKI environments, the dashboard automatically:
- Retrieves credentials from the CKI credential management system
 - Uses CKI Testing Farm tokens without manual configuration
 - Integrates with monitoring and logging infrastructure
 
The dashboard checks for CKI credential availability and falls back to environment variables if not available.
Web Interface Features
Dashboard View
- Request Summary: Total counts and status overview
 - Interactive Table: Sortable columns with request details
 - Real-time Filtering: Dynamic filtering without page reload
 - Plan Information: Test plan names and repository URLs
 - Status Indicators: Color-coded status and result indicators
 
Filtering Options
- TMT Context Filters: Architecture, distribution, compose, and custom key-value pairs
 - Date Range: Filter by request creation date
 - Multiple Filters: Combine multiple context filters with AND logic
 - Toggle Filters: Click badges to toggle filter values
 
Data Export
- JSON Export: Complete request data with metadata
 - CSV Export: Tabular format for spreadsheet analysis
 - Filtered Export: Export only currently filtered results
 
API Integration
The dashboard integrates with the Testing Farm API at https://api.testing-farm.io/v0.1/requests:
- Automatic pagination handling
 - Error handling with user-friendly messages
 - Request timeout protection (30 seconds)
 - Response validation and data normalization
 
Health Monitoring
The dashboard provides a health endpoint at /health for:
- Load balancer health checks
 - Container orchestration readiness probes
 - Monitoring systems uptime verification
 
Security Considerations
- Input validation on all user inputs
 - CSRF protection via Flask-WTF (when forms are used)
 - XSS prevention through proper template escaping
 - Rate limiting via reverse proxy (recommended)
 - Secret management via environment variables or CKI credentials
 
Dependencies
The dashboard requires the following Python packages:
Flask>= 2.0.0 - Web frameworkrequests>= 2.25.0 - HTTP client for API callsgunicorn>= 20.0.0 - WSGI server for production
Install with the testing_farm_dashboard extra:
pip install cki-tools[testing_farm_dashboard]
Development
Running Tests
# Run all dashboard tests
python -m pytest tests/testing_farm_dashboard/ -v
# Run with coverage
python -m pytest tests/testing_farm_dashboard/ --cov=cki_tools.testing_farm_dashboard
Code Quality
# Check code style
python -m ruff check cki_tools/testing_farm_dashboard/ tests/testing_farm_dashboard/
# Auto-fix issues
python -m ruff check --fix cki_tools/testing_farm_dashboard/ tests/testing_farm_dashboard/
Local Development
# Start development server with auto-reload
cki_dashboard serve --debug --open-browser
# View logs in development
export FLASK_DEBUG=true
cki_dashboard serve --debug