Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@brigadecore/brigadier

Package Overview
Dependencies
Maintainers
4
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@brigadecore/brigadier

Brigade library for pipelines and events

latest
Source
npmnpm
Version
2.6.0
Version published
Weekly downloads
55
-44.44%
Maintainers
4
Weekly downloads
 
Created
Source

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.

Installation

NPM

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

Versioning

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.

Usage

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.

Contributing

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.

Keywords

kubernetes

FAQs

Package last updated on 09 Jun 2022

Did you know?

Socket

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.

Install

Related posts