Blueprints

CI/CD to deploy Kestra flows using a GitHub webhook trigger

Source

yaml
id: ci-cd-for-kestra-flows
namespace: company.team
tasks:
  - id: deploy
    type: io.kestra.plugin.core.flow.WorkingDirectory
    tasks:
      - id: cloneRepository
        type: io.kestra.plugin.git.Clone
        url: https://github.com/anna-geller/kestra-ci-cd
        branch: main
      - id: validate_flows
        type: io.kestra.plugin.scripts.shell.Commands
        taskRunner:
          type: io.kestra.plugin.core.runner.Process
        commands:
          - /app/kestra flow validate flows/
      - id: deploy_flows
        type: io.kestra.plugin.scripts.shell.Commands
        taskRunner:
          type: io.kestra.plugin.core.runner.Process
        commands:
          - /app/kestra flow namespace update prod flows/prod/ --no-delete
          - /app/kestra flow namespace update prod.marketing
            flows/prod.marketing/ --no-delete
triggers:
  - id: github
    type: io.kestra.plugin.core.trigger.Webhook
    key: 1KERKzRQZSMtLdMdNI7Nkr

About this blueprint

Trigger DevOps Git Task Runner

This blueprint demonstrates how to use Kestra to build a CI/CD pipeline.

This flow:

  • deploys other flows effectively running a CI/CD pipeline for Kestra flows directly from Kestra itself
  • clones a GitHub repository, validates the flows, and then deploys them to a given Kestra namespace
  • uses a webhook trigger so that the flow can be triggered upon GitHub push event sent by a GitHub webhook.

To learn more about this CI/CD pattern, check the following documentation page and blog post.

Working Directory

Clone

Commands

Process

Commands

Process

Webhook

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra