A GitHub Action that reports the health status of ArgoCD applications, providing detailed diagnostics for unhealthy resources including events, pod logs, and intelligent log parsing.
- π Health Status Monitoring: Check the health of ArgoCD applications and their resources
- π Resource Tree Analysis: Examine the complete resource tree for unhealthy components
- π Event Reporting: Display Kubernetes events for problematic resources
- π Pod Log Analysis: Retrieve and analyze container logs for debugging
- π€ Intelligent Log Parsing: Automatically parse JSON logs and create GitHub annotations
- π¨ GitHub Annotations: Convert errors and warnings into actionable GitHub workflow annotations
name: ArgoCD Health Check
on:
schedule:
- cron: '*/15 * * * *' # Check every 15 minutes
workflow_dispatch:
jobs:
health-check:
runs-on: ubuntu-latest
steps:
- name: Check ArgoCD Application Health
uses: cdqag/action-argocd-app-health@v2
with:
app-name: 'my-application'
server-url: 'https://argocd.example.com'
user-login: ${{ secrets.ARGOCD_USERNAME }}
user-password: ${{ secrets.ARGOCD_PASSWORD }}
fail-on-unhealthy: 'true'| Input | Description | Required |
|---|---|---|
app-name |
Name of the ArgoCD application to monitor | β |
server-url |
ArgoCD server URL (e.g., https://argocd.example.com) |
β |
user-login |
ArgoCD username for authentication | β |
user-password |
ArgoCD password for authentication | β |
fail-on-unhealthy |
If set to true, the action will fail if the application is unhealthy |
β (default: false) |
| Output | Description |
|---|---|
app-health |
Health status of the application |
- Authentication: Connects to ArgoCD using provided credentials
- Application Health Check: Retrieves the overall health status of the specified application
- Resource Analysis: If the application is unhealthy, analyzes the resource tree to identify problematic components
- Event Collection: Gathers Kubernetes events for unhealthy resources
- Log Retrieval: For unhealthy pods, retrieves container logs for analysis
- Intelligent Parsing: Automatically parses JSON logs and creates GitHub annotations for errors and warnings
π Application my-app is in Healthy state
π Application my-app is in Degraded state because: one or more objects failed
β Pod my-app-7d4b6c8f9-xyz is in Error state because: CrashLoopBackOff
βοΈ Pod my-app-7d4b6c8f9-xyz has the following events:
β BackOff (5): Back-off restarting failed container
β Failed (3): Error: failed to create containerd task: failed to create shim task
βοΈ Pod my-app-7d4b6c8f9-xyz has the following containers:
π¦ app-container (my-app:v1.2.3)
βοΈ Logs:
{"level":"ERROR","message":"Database connection failed","stack_trace":"..."}
The action uses emoji indicators to represent different health states:
- π Healthy: All resources are functioning correctly
- π Degraded: Some resources are experiencing issues
- β Error: Critical errors detected
- π΅ Progressing: Resources are being deployed or updated
- β Unknown: Health status cannot be determined
- π¨ Suspended: Application is intentionally suspended
- βͺ Missing: Expected resources are missing
The action includes intelligent log parsing capabilities:
- Automatically detects JSON-formatted log entries
- Extracts
level,message, andstack_tracefields - Creates GitHub annotations for:
- Errors: Shows error message and stack trace
- Warnings: Highlights warning messages
Currently supports parsing of structured JSON logs with fields like:
{
"level": "ERROR",
"message": "Database connection failed",
"stack_trace": "java.sql.SQLException: Connection refused..."
}The action requires the following ArgoCD permissions:
applications:get- To retrieve application detailsapplications:read- To access application resourceslogs:get- To retrieve pod logs (optional, will show warning if not available)
The action gracefully handles various error scenarios:
- Authentication failures: Clear error messages for login issues
- Permission errors: Warnings for insufficient permissions
- Network issues: Proper error reporting for connectivity problems
- Missing resources: Informative messages when resources are not found
- Node.js 20+
- npm or yarn
# Install dependencies
npm install
# Run tests
npm test
# Build the action
npm run build
# Lint code
npm run lintβββ src/
β βββ main.ts # Main entry point
β βββ utils.ts # Utility functions
β βββ print.ts # Output formatting
β βββ argocd/ # ArgoCD client and models
β β βββ client.ts # ArgoCD API client
β β βββ models/ # TypeScript models
β βββ interpreters/ # Log parsing interpreters
β βββ AbstractInterpreter.ts
β βββ JSONInterpreter.ts
β βββ __tests__/ # Unit tests
βββ action.yml # Action metadata
βββ package.json
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Run the test suite
- Submit a pull request
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
For issues and questions:
- Create an issue in the GitHub repository
- Check existing issues for similar problems
- Provide detailed information about your ArgoCD setup and application configuration