
Product
Introducing Webhook Events for Pull Request Scans
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
@brigadecore/brigadier
Advanced tools
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();
})
events.process();
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()
})
events.process()
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.
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.
FAQs
Brigade library for pipelines and events
The npm package @brigadecore/brigadier receives a total of 67 weekly downloads. As such, @brigadecore/brigadier popularity was classified as not popular.
We found that @brigadecore/brigadier demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
Research
The Socket Threat Research Team uncovered malicious NuGet packages typosquatting the popular Nethereum project to steal wallet keys.
Product
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.