Pipelines

Triggers and webhooks

A pipeline run can start in four ways besides a click on Run Now: on a schedule, when another pipeline finishes, when an external system calls its webhook, or from a stream of events. This page covers each one.

Schedules

A schedule is a cron expression on the pipeline. Schedules are evaluated in UTC, and a schedule only runs while the pipeline's status is active, so set both:

yaml
name: GitHub Ingest
schedule: '0 */6 * * *'   # every 6 hours, on the hour (UTC)
status: active

solidafy pipelines push applies both fields on every push, including the first one that creates the pipeline.

The usual five-field cron syntax works, as do the shortcuts @hourly, @daily (midnight UTC), @weekly (Sunday midnight UTC) and @monthly. Some common schedules:

ScheduleCron
Every 15 minutes*/15 * * * *
Every hour0 * * * *
Every 6 hours0 */6 * * *
Daily at midnight UTC0 0 * * *
Weekly, Monday at midnight UTC0 0 * * 1
Monthly, on the 1st0 0 1 * *

To remove a schedule, set schedule: null and push. Leaving the field out of the file keeps whatever schedule the pipeline already has.

A schedule is at most 100 characters. solidafy validate reports a schedule that isn't a valid cron expression as an error, and the push is rejected, so a typo can't leave a pipeline that never runs.

Status

A pipeline has a status: draft, active, paused or error. Scheduled runs only happen while it is active.

status in the fileWhat a push does
activeThe schedule runs.
pausedThe schedule is kept but doesn't run until you set active again.
draftThe pipeline is a draft and the schedule doesn't run.
left outA new pipeline starts as draft; an existing one keeps its current status.

solidafy validate warns when a file has a schedule but no status: active or status: paused, because that schedule would never run. A file you pulled earlier may say status: draft; pushing it sets the pipeline back to draft, so update the field before you push.

In the portal, picking a schedule in the pipeline builder sets the pipeline to active, and removing it sets an active pipeline back to draft. solidafy pipelines pull writes the current schedule and status into the file, so the file and the portal stay in step.

When you change a schedule, the next run is recalculated from the new cron straight away.

Pick a schedule with room for a run to finish. A scheduled run starts at its time even if the previous run is still going.

Pipeline-to-pipeline triggers

A trigger starts one pipeline (the target) when another (the source) finishes. Use it to chain stages that live in separate pipelines, for example an ingest pipeline followed by the pipeline that builds dashboard tables from it.

bash
solidafy triggers create "GitHub Ingest" "Engineering Dashboard"
solidafy triggers list
solidafy triggers toggle <trigger-id>    # enable or disable
solidafy triggers delete <trigger-id>

create takes pipeline names or ids. How triggers behave:

  • The target starts when a run of the source ends as completed or partial. A failed or cancelled source run starts nothing.
  • A target can have several sources. It only starts once every one of them has a completed run in the last 24 hours, with no newer unsuccessful run after it. So with triggers from both "GitHub Ingest" and "Jira Ingest" to "Engineering Dashboard", the dashboard pipeline runs after whichever ingest finishes second.
  • If the target already has a run queued or running, the trigger does nothing.
  • Creating a trigger that would close a loop is refused, and a chain of triggers stops after 10 levels.
  • The target doesn't need a schedule of its own. A pipeline that is only ever started by a trigger still runs on time as long as something upstream in the chain is scheduled.

Each run records what started it: a triggered run carries the id of the run that triggered it.

Webhooks

A webhook lets an external system start a run with an HTTP request, and hands the request body to the pipeline as data.

Enable it

bash
solidafy webhook enable environments/sandbox/pipelines/deploy-events.yaml

This prints the webhook secret. Enabling again issues a new secret, which invalidates the old one. solidafy webhook status <file> shows the current secret, and solidafy webhook disable <file> turns the webhook off and revokes the secret. You need admin access to the pipeline to enable or disable its webhook.

Call it

bash
curl -X POST "https://api.solidafy.com/api/v1/webhooks/$PIPELINE_ID?secret=$WEBHOOK_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"service": "checkout", "version": "1.42.0", "environment": "production"}'

The secret in the query string is the only authentication, so treat the full URL like a password. A successful call returns 202:

json
{ "run_id": "...", "pipeline_id": "...", "status": "queued" }

Other responses:

StatusWhen
400Webhooks are not enabled for the pipeline, the secret is wrong, the body isn't a JSON object, or the pipeline has no saved configuration yet.
404No such pipeline.
409A run of this pipeline is already queued or running. The call is not queued for later, so retry it.

solidafy webhook test <file> sends a small test payload so you can check the setup end to end.

Read the payload in the pipeline

Each webhook run starts with an extra step that writes the request body to a table as one row, with a _received_at column holding the time it arrived. The table is <pipeline>.webhook_events, where <pipeline> is the pipeline's name in lower case with every character other than letters, digits and underscores replaced by _. For a pipeline named "Deploy Events", that is deploy_events.webhook_events. The table is appended to on every call and partitioned by the hour the event arrived.

That write runs at the same time as your steps that have no depends_on, and your steps can't depend on it. So a step in the same run isn't guaranteed to see the event that started the run. Write steps that process whatever has arrived over a time window rather than "the current event":

yaml
steps:
  - name: deploys_last_day
    type: materialize
    dsl: |
      source("deploy_events.webhook_events")
        .since(_received_at, "24h")
        .group_by([service])
        .agg([count() as deploys, max(_received_at) as last_deploy])
        .output("deploys.last_24h", mode: replace)

Slack slash commands

The webhook also accepts form-encoded bodies, which is what Slack slash commands send. Point a slash command at the webhook URL; each field of the form becomes a column, plus a source column set to slack. When the request carries a Slack response_url, the webhook replies with a short "Running..." message visible only to the person who typed the command.

Streams

A webhook starts one run per call, and refuses calls while a run is active. If events arrive faster than a run takes, use a stream instead. A stream accepts events at any rate, buffers them, and starts a run with the whole batch when either the oldest buffered event reaches a maximum age or the buffer reaches a maximum size.

Streams are managed through the API. A pipeline can have a webhook or a stream, not both; disable one before enabling the other.

bash
curl -X POST https://api.solidafy.com/api/v1/visual-pipelines/$PIPELINE_ID/stream/enable \
  -H "Authorization: Bearer $SOLIDAFY_PAT" \
  -H "Content-Type: application/json" \
  -d '{"flush_max_age_sec": 300, "flush_max_batch": 10000}'
OptionDefaultAllowed
flush_max_age_sec30010 to 3600
flush_max_batch100001 to 100000

The response includes a stream_secret. Send events to the stream with it:

bash
curl -X POST "https://api.solidafy.com/api/v1/streams/$PIPELINE_ID?secret=$STREAM_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"events": [{"user": "a", "action": "login"}, {"user": "b", "action": "logout"}]}'

The body can be {"events": [...]} for a batch, {"event": {...}} for one event, or any other JSON object, which is taken as one event. A successful call returns 202 with the number of events accepted:

json
{ "pipeline_id": "...", "accepted": 2 }

Other responses:

StatusWhen
400Streaming is not enabled for the pipeline, the secret is wrong, the body isn't a JSON object, or the body holds no events (for example an empty events list).
404No such pipeline.

Only a 202 means the events were buffered. Treat any other response as "not accepted" and send the events again (after fixing the request, for a 400 or 404).

When the batch runs, every event becomes one row of <pipeline>.webhook_events, with _received_at set, the same table a webhook writes to.

GET /api/v1/visual-pipelines/{id}/stream shows the current settings, and POST /api/v1/visual-pipelines/{id}/stream/disable turns the stream off and drops any events still buffered.