fleetremote AI, safely

triggers & ingest

Triggers & ingest

A task starts when a PM-tool webhook reaches the dispatcher. Senders POST to the admin panel's ingest endpoint, which records the event and forwards it verbatim to the Jenkins Generic Webhook Trigger — or you can point senders straight at Jenkins.

How a trigger flows

Jira / GitHub / Linear
        │  POST {panel}/api/ingest?source=<source>
        ▼
Admin panel   ── record webhook.received ──▶ run ledger / ingest log
        │  POST {FLEET_WEBHOOK_URL}?source=<source>&token=<token>
        ▼  headers: x-fleet-event, x-github-event, x-github-delivery
Jenkins Generic Webhook Trigger
        │
        ▼
fleetDispatcher → fleetctl normalize → resolve → run → publish

The ingest endpoint

POST /api/ingest has two roles, selected by whether a source is present. This is the newest logic: a webhook that carries a source is recorded and forwarded; everything else is a ledger sink.

RequestBehaviour
POST /api/ingest?source=<source>Inbound webhook. Records webhook.received (source, event, payload) and forwards the raw body to FLEET_WEBHOOK_URL. The source may also arrive as an x-fleet-source header.
POST /api/ingest (no source)Ledger sink. Records dispatcher lifecycle and debug events (run.started, run.finished, audit.event,webhook.received, normalize.result,resolve.result). Never forwarded.
POST /api/triggerLow-level: forward to the dispatcher without the ingest hop (same path the Trigger page and scripts use). Restricted to jira, linear,github; injects the webhookEvent field.
GET /api/metricsPrometheus text-format ledger metrics.

Event name

  • Set with ?event= or the x-fleet-event header.
  • For GitHub the dispatcher derives it from the passed-through X-GitHub-Event header.
  • The normalizer decides whether the event is actionable; unknown sources/events are rejected there.

Authentication

  • Authorization: Bearer <FLEET_INGEST_TOKEN> — used by the panel's own calls, the dispatcher, scripts, and PM tools that can set headers.
  • X-Hub-Signature-256 HMAC over the raw body — for GitHub, whose webhooks cannot set custom headers. Set the shared secret as FLEET_GITHUB_WEBHOOK_SECRET (the same value as the GitHub webhook's Secret).
  • Comparison is constant-time. When neither the token nor the secret is configured the API is open — dev only.
  • Invalid or missing credentials return 401; invalid payloads return 422.

Response

201 { "ok": true, "id": 42, "forward": { "status": 200 } }
201 { "ok": true, "id": 42, "forward": { "dry_run": true } }
201 { "ok": true, "id": 42, "forward": { "error": "webhook endpoint not configured" } }

Forwarding to Jenkins

The panel forwards the payload unchanged — no field injection — so the dispatcher sees exactly what the PM tool sent. The token is sent both as a query parameter and as a bearer header; retries are disabled.

POST {FLEET_WEBHOOK_URL}?source=<source>&token=<FLEET_WEBHOOK_TOKEN>
Authorization: Bearer <FLEET_WEBHOOK_TOKEN>
x-fleet-event: <event>
x-github-event: <passthrough, GitHub only>
x-github-delivery: <passthrough, GitHub only>
Content-Type: application/json

<raw webhook body, unchanged>

The forwarding target is trusted configuration (FLEET_WEBHOOK_URL / FLEET_WEBHOOK_TOKEN) and is never supplied by the caller. The public URL of the panel's own ingest endpoint is FLEET_INGEST_PUBLIC_URL (falls back to the panel's endpoint URL).

Configure a source

GitHub (recommended path)

GitHub authenticates with its webhook Secret; the panel records and forwards it.

Payload URL:  {FLEET_INGEST_PUBLIC_URL}?source=github
Content type: application/json
Secret:       <FLEET_GITHUB_WEBHOOK_SECRET>
Events:       issues, issue_comment, pull_request_review_comment

Jira

If your Jira installation can set an Authorization header on webhooks, point it at the panel. Otherwise, Jira Cloud cannot set custom headers — send Jira webhooks directly to Jenkins, whose Generic Webhook Trigger authenticates with the token in the query string.

POST {panel}/api/ingest?source=jira
Authorization: Bearer <FLEET_INGEST_TOKEN>

# or directly to Jenkins (no panel ingest-log entry):
POST {jenkins}/generic-webhook-trigger/invoke?token=<fleet-webhook-token>&source=jira

Linear

Same trade-off as Jira: use the panel with a bearer header when supported, or send Linear events straight to the Jenkins trigger URL with &source=linear.

POST {panel}/api/ingest?source=linear
Authorization: Bearer <FLEET_INGEST_TOKEN>
Events: Issue create / update

Jenkins Generic Webhook Trigger

The trigger is declared by the pipeline's properties(...) block, so it registers on the first build. It exposes the raw body as payload and the request/header values the dispatcher expects.

properties([
  disableConcurrentBuilds(),
  pipelineTriggers([[
    $class: 'GenericTrigger',
    genericVariables: [[key: 'payload', value: '$', expressionType: 'JSONPath']],
    genericRequestVariables: [[key: 'source', regexpFilter: '']],
    genericHeaderVariables: [
      [key: 'x-fleet-event', regexpFilter: ''],
      [key: 'x-github-event', regexpFilter: ''],
      [key: 'x-github-delivery', regexpFilter: '']
    ],
    tokenCredentialId: 'fleet-webhook-token',
    causeString: 'Fleet webhook ($source)'
  ]])
])

Create a Jenkins string credential named fleet-webhook-token; its value is the token in the invoke URL and in FLEET_WEBHOOK_TOKEN.

Panel trigger page & API

The /trigger page and POST /api/trigger let you fire a webhook-like event through the dispatcher without a real PM tool — useful for end-to-end tests. Use dry_run to preview the exact request without sending.

curl -X POST {panel}/api/trigger \
  -H "Authorization: Bearer $FLEET_INGEST_TOKEN" \
  -H 'content-type: application/json' \
  -d '{"source":"jira","event":"jira:issue_created","payload":{"issue":{"key":"ENG-1"}}}'

# preview the exact request without sending it
curl -X POST {panel}/api/trigger \
  -H "Authorization: Bearer $FLEET_INGEST_TOKEN" \
  -H 'content-type: application/json' \
  -d '{"source":"jira","event":"jira:issue_created","dry_run":true,"payload":{}}'

Local development

The bundled local Jenkins and panel wire this up end-to-end with placeholder tokens. See the security model before exposing them.

bash scripts/jenkins/setup.sh && bash scripts/jenkins/start.sh
bash scripts/jenkins/prepare-local.sh
bash admin/start.sh            # FLEET_WEBHOOK_URL defaults to the local Jenkins

Debugging

The /ingest page shows every incoming webhook, the normalization outcome (ok / filtered / error), and the routing decision — the fastest way to see why an event did not start a run.

# the panel's ingest log shows every webhook and its normalize/resolve outcome
open {panel}/ingest

# dispatcher reporting is enabled by --ingest on normalize/resolve
python3 -m fleetctl resolve --registry registry.yaml --issue-file issue.json --ingest

Next

Read the security model or the .fleet/ contract.