• Public
  • Public/Protected
  • All


Brigadier: The JS/TS library for Brigade

Brigadier is the library for writing Brigade scripts.

It provides core Brigade objects such as Events and Jobs that developers can use to construct expressive event-handling logic for their Brigade projects.

Brigadier supports writing scripts in either JavaScript or TypeScript.



Normally, the brigadier dependency is declared at the top of a Brigade script. The library itself is pre-loaded in the Brigade Worker:

const { events, Job } = require("@brigadecore/brigadier");

To facilitate script development, you may also install brigadier to your environment with Yarn, NPM, etc.:

$ yarn add @brigadecore/brigadier


The 0.x Brigadier npm releases are compatible with Brigade v1.x and under.

The 2.x brigadier npm releases are compatible with Brigade v2.x.


Note: the following examples are using brigadier 2.x, compatible with Brigade v2.

Here is an example brigade.js script which declares an event handler for GitHub push events, running tests for the project it is associated with:

const { events, Job } = require("@brigadecore/brigadier");

const localPath = "/workspaces/brigade";

events.on("brigade.sh/github", "push", async event => {
let test = new Job("test", "golang:1.17", event);
test.primaryContainer.sourceMountPath = localPath;
test.primaryContainer.workingDirectory = localPath;
test.primaryContainer.command = ["make"];
test.primaryContainer.arguments = ["test"];

await test.run();


Or, the same can be written in TypeScript (brigade.ts):

import { events, Event, Job } from "@brigadecore/brigadier"

const localPath = "/workspaces/brigade"

events.on("brigade.sh/github", "push", async event => {
let test = new Job("test", "golang:1.17", event)
test.primaryContainer.sourceMountPath = localPath
test.primaryContainer.workingDirectory = localPath
test.primaryContainer.command = ["make"]
test.primaryContainer.arguments = ["test"]

await test.run()


To learn more, visit the official scripting guide or explore the Brigade example projects.


The Brigade project accepts contributions via GitHub pull requests. The Contributing document outlines the process to help get your contribution accepted.

Support & Feedback

We have a slack channel! Kubernetes/#brigade Feel free to join for any support questions or feedback, we are happy to help. To report an issue or to request a feature, open an issue here.

Generated using TypeDoc