Webhook icon
WorkingDirectory icon
Clone icon
Commands icon
Docker icon
Script icon
Switch icon
Log icon
SlackIncomingWebhook icon
Fail icon

Validate Vector configs and run VRL unit tests before deployment

Validate Vector configs and run VRL transform unit tests in Docker, then fail the run and alert Slack when validation or tests fail or no tests exist.

Categories
Infrastructure

Pre-deployment gate for Vector observability pipelines. The flow checks out your repository, runs vector validate on the configuration and vector test on its VRL unit tests inside the official Vector container, and rejects the change when the configuration is invalid, a test fails, or no tests exist at all.

A gate that only counts failures passes an empty test suite, so a repository with no unit tests is rejected rather than approved. The flow tests whatever repository you point it at and does not ship any sample configuration or tests of its own.

How it works

  1. webhook_ci receives a GitHub push webhook. clone_repo (io.kestra.plugin.git.Clone) checks out repository.clone_url at the pushed ref. For manual runs it uses the git_repository_url and git_branch inputs. The payload is used only as the clone URL and branch, never inside a shell command.
  2. test_and_validate_vector (io.kestra.plugin.scripts.shell.Commands, container timberio/vector:0.43.0-alpine) runs vector validate --no-environment on config_path, which loads the config, checks component wiring and compiles the VRL. If validation passes it runs vector test with the files in tests_dir, or with the config alone when there are none. Paths reach the shell through environment variables. Reports and exit codes are saved as output files.
  3. parse_test_metrics (io.kestra.plugin.scripts.python.Script) counts the test <name> ... passed and ... failed lines and sets the status: VALIDATION_FAILED, TESTS_FAILED, NO_TESTS_FOUND or PASSED.
  4. evaluate_gate (io.kestra.plugin.core.flow.Switch) logs a pass. For every other status it posts to Slack through io.kestra.plugin.slack.notifications.SlackIncomingWebhook and then fails the execution with io.kestra.plugin.core.execution.Fail.

What you get

  • A merge gate that stops broken VRL, invalid wiring and untested transforms from reaching collectors.
  • Failure details in the Slack message and the execution logs, with the full reports saved as output files.
  • Slack messages that stay valid JSON even when Vector's output contains quotes or newlines.

Who it's for

  • Observability Engineers and SREs who maintain Vector configurations.
  • Platform Teams that manage telemetry routing through GitOps.
  • SecOps and Compliance Teams that verify PII redaction rules before logs are forwarded.

Why orchestrate this with Kestra

A broken VRL transform can silently drop or corrupt logs across a whole fleet. In Kestra the check runs in the same container image everywhere, keeps the reports as execution outputs, and turns every bad outcome into a failed execution with a Slack alert.

Prerequisites

  • A Docker daemon that the Kestra worker can use, to run timberio/vector:0.43.0-alpine and python:3.12-slim.
  • A Git repository with a Vector configuration and unit tests, readable without credentials (see How to extend for private repositories).
  • A Slack Incoming Webhook URL.

Secrets

  • SLACK_WEBHOOK_URL: Slack incoming webhook URL for gate alerts (required).
  • VECTOR_GATE_WEBHOOK_KEY: key that protects the webhook_ci endpoint (required).

Quick start

  1. Add SLACK_WEBHOOK_URL and VECTOR_GATE_WEBHOOK_KEY to your Kestra namespace secrets.
  2. Import this blueprint into your Kestra instance.
  3. Run it manually with git_repository_url set to a repository that has a vector.yaml and unit tests, adjusting config_path and tests_dir if needed.
  4. Add a GitHub push webhook that points at the webhook_ci URL to run the gate on every push.

How to extend

  • Private repositories: Add username and password (a token from secret()) to the Clone task.
  • Deploy on success: Add a Helm or Ansible task after the PASSED branch.
  • Pull request events: Map pull_request.head.repo.clone_url and pull_request.head.ref to the clone URL and branch to gate pull requests instead of pushes.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.