id: woodpecker-ci-server-and-pipeline-sentinel
namespace: devops.cicd
labels:
env: production
system: woodpecker
category: cicd
inputs:
- id: woodpecker_url
type: STRING
displayName: Woodpecker CI Server URL
description: Base URL of the Woodpecker CI server instance.
defaults: http://localhost:8000
- id: woodpecker_token
type: STRING
displayName: Woodpecker API Token
description: Personal access token if the instance requires authentication for
API endpoints.
defaults: ""
- id: slack_webhook_url
type: STRING
displayName: Slack Webhook URL
description: Slack incoming webhook URL for incident alerting.
defaults: ""
- id: latency_threshold_ms
type: INT
displayName: Latency Threshold (ms)
description: Maximum acceptable response latency in milliseconds before marking
the service as degraded.
defaults: 2000
- id: alert_on_warning
type: BOOL
displayName: Alert on Degraded Warning
description: Whether to send Slack alerts when status is DEGRADED in addition to
CRITICAL.
defaults: true
triggers:
- id: periodic_sentinel_schedule
type: io.kestra.plugin.core.trigger.Schedule
cron: "*/15 * * * *"
tasks:
- id: probe_server_health
type: io.kestra.plugin.core.http.Request
description: Probe Woodpecker CI server native health check endpoint.
uri: "{{ inputs.woodpecker_url }}/healthz"
method: GET
timeout: PT10S
retry:
type: constant
interval: PT2S
maxAttempts: 2
options:
allowFailed: true
- id: probe_version_and_liveness
type: io.kestra.plugin.core.http.Request
description: Probe Woodpecker CI version and gateway responsiveness.
uri: "{{ inputs.woodpecker_url }}/version"
method: GET
timeout: PT10S
headers: "{{ inputs.woodpecker_token != '' ? {'Authorization': 'Bearer ' ~
inputs.woodpecker_token} : {} }}"
options:
allowFailed: true
- id: probe_server_info
type: io.kestra.plugin.core.http.Request
description: Probe Woodpecker CI server information and agent cluster state.
uri: "{{ inputs.woodpecker_url }}/api/info"
method: GET
timeout: PT10S
headers: "{{ inputs.woodpecker_token != '' ? {'Authorization': 'Bearer ' ~
inputs.woodpecker_token} : {} }}"
options:
allowFailed: true
- id: probe_repository_pipelines
type: io.kestra.plugin.core.http.Request
description: Probe Woodpecker CI repository catalog and pipeline engine accessibility.
uri: "{{ inputs.woodpecker_url }}/api/repos"
method: GET
timeout: PT10S
headers: "{{ inputs.woodpecker_token != '' ? {'Authorization': 'Bearer ' ~
inputs.woodpecker_token} : {} }}"
options:
allowFailed: true
- id: classify_sentinel_status
type: io.kestra.plugin.core.log.Log
description: Evaluate service response codes and classify cluster operational status.
message: |
Woodpecker CI Sentinel Probe Evaluation:
- Healthz Status Code: {{ outputs.probe_server_health.statusCode }}
- Version Status Code: {{ outputs.probe_version_and_liveness.statusCode }}
- Server Info Status Code: {{ outputs.probe_server_info.statusCode }}
- Repos Engine Status Code: {{ outputs.probe_repository_pipelines.statusCode }}
- id: route_operational_status
type: io.kestra.plugin.core.flow.Switch
description: Branch execution based on Woodpecker CI service health classification.
value: "{{ outputs.probe_server_health.statusCode == 200 and
outputs.probe_version_and_liveness.statusCode == 200 and
(outputs.probe_repository_pipelines.statusCode == 200 or
outputs.probe_repository_pipelines.statusCode == 401) ? 'OPERATIONAL' :
(outputs.probe_server_health.statusCode == 200 ? 'DEGRADED' : 'CRITICAL')
}}"
cases:
CRITICAL:
- id: log_critical_incident
type: io.kestra.plugin.core.log.Log
level: ERROR
message: "CRITICAL: Woodpecker CI server at {{ inputs.woodpecker_url }} is DOWN
or database unreachable! Status Code: {{
outputs.probe_server_health.statusCode }}."
- id: alert_slack_critical
type: io.kestra.plugin.slack.notifications.SlackIncomingWebhook
description: Dispatch high-priority alert to Slack when Woodpecker CI server is
failing.
url: "{{ inputs.slack_webhook_url != '' ? inputs.slack_webhook_url :
secret('SLACK_WEBHOOK_URL') }}"
runIf: "{{ (inputs.slack_webhook_url != '' or secret('SLACK_WEBHOOK_URL') !=
null) }}"
payload: |
{
"text": "CRITICAL INCIDENT: Woodpecker CI Server at {{ inputs.woodpecker_url }} is unreachable or failing health checks!",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "Woodpecker CI Sentinel Alert: Service CRITICAL",
"emoji": false
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Instance:* {{ inputs.woodpecker_url }}"
},
{
"type": "mrkdwn",
"text": "*Healthz Code:* {{ outputs.probe_server_health.statusCode }}"
},
{
"type": "mrkdwn",
"text": "*Version Code:* {{ outputs.probe_version_and_liveness.statusCode }}"
},
{
"type": "mrkdwn",
"text": "*Repos API Code:* {{ outputs.probe_repository_pipelines.statusCode }}"
}
]
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Execution ID: {{ execution.id }} | Namespace: {{ flow.namespace }}"
}
]
}
]
}
DEGRADED:
- id: log_degraded_warning
type: io.kestra.plugin.core.log.Log
level: WARN
message: "WARNING: Woodpecker CI server at {{ inputs.woodpecker_url }} is
DEGRADED. Pipeline catalog or API returned non-200 while healthz
passed."
- id: alert_slack_degraded
type: io.kestra.plugin.slack.notifications.SlackIncomingWebhook
description: Dispatch warning alert to Slack when Woodpecker CI sub-systems are
degraded.
url: "{{ inputs.slack_webhook_url != '' ? inputs.slack_webhook_url :
secret('SLACK_WEBHOOK_URL') }}"
runIf: "{{ inputs.alert_on_warning and (inputs.slack_webhook_url != '' or
secret('SLACK_WEBHOOK_URL') != null) }}"
payload: |
{
"text": "WARNING: Woodpecker CI Server at {{ inputs.woodpecker_url }} is reporting DEGRADED sub-services.",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "Woodpecker CI Sentinel Warning: Sub-system Degraded",
"emoji": false
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Instance:* {{ inputs.woodpecker_url }}"
},
{
"type": "mrkdwn",
"text": "*Pipeline API Status:* {{ outputs.probe_repository_pipelines.statusCode }}"
}
]
}
]
}
defaults:
- id: log_operational_confirmation
type: io.kestra.plugin.core.log.Log
message: "SUCCESS: Woodpecker CI server at {{ inputs.woodpecker_url }} is fully
OPERATIONAL. Health checks and pipeline catalog endpoints are
healthy."
- id: record_sentinel_audit_telemetry
type: io.kestra.plugin.core.output.OutputValues
description: Record structured sentinel health telemetry for audit history and
downstream dashboards.
values:
instance_url: "{{ inputs.woodpecker_url }}"
status: "{{ outputs.probe_server_health.statusCode == 200 and
outputs.probe_version_and_liveness.statusCode == 200 and
(outputs.probe_repository_pipelines.statusCode == 200 or
outputs.probe_repository_pipelines.statusCode == 401) ? 'OPERATIONAL' :
(outputs.probe_server_health.statusCode == 200 ? 'DEGRADED' :
'CRITICAL') }}"
healthz_status_code: "{{ outputs.probe_server_health.statusCode }}"
version_status_code: "{{ outputs.probe_version_and_liveness.statusCode }}"
server_info_status_code: "{{ outputs.probe_server_info.statusCode }}"
pipeline_api_status_code: "{{ outputs.probe_repository_pipelines.statusCode }}"
errors:
- id: handle_sentinel_failure
type: io.kestra.plugin.core.log.Log
level: ERROR
message: "SENTINEL UNEXPECTED FAILURE: Could not connect to Woodpecker CI at {{
inputs.woodpecker_url }}. Please verify network route and container
state."
- id: alert_sentinel_fatal_exception
type: io.kestra.plugin.slack.notifications.SlackIncomingWebhook
description: Dispatch notification when probe encounters fatal network error.
url: "{{ inputs.slack_webhook_url != '' ? inputs.slack_webhook_url :
secret('SLACK_WEBHOOK_URL') }}"
runIf: "{{ (inputs.slack_webhook_url != '' or secret('SLACK_WEBHOOK_URL') !=
null) }}"
payload: |
{
"text": "FATAL INCIDENT: Woodpecker CI sentinel flow execution {{ execution.id }} failed with network exception or unhandled error!"
}