You are viewing info for Brigade v1. Click here for Brigade v2.

Event-driven scripting for Kubernetes.

Brigade is a tool for running scriptable, automated tasks in the cloud — as part of your Kubernetes cluster.

Get Started

Simple, powerful pipes

Each project gets a brigade.js config file, which is where you can write dynamic, interwoven pipelines and tasks for your Kubernetes cluster. Leave your YAML at home!

  • // Run unit tests for a Github push
    const { events, Job , Group} = require("brigadier");
    const dest = "$GOPATH/src/github.com/technosophos/ulid";
    
    events.on("push", (e, p) => {
      console.log(e.payload)
      var gh = JSON.parse(e.payload)
      var test = new Job("test", "golang:1.9")
      test.tasks = [
        "mkdir -p " + dest,
        "cp -a /src/* " + dest,
        "cd " + dest,
        "go get -u github.com/golang/dep/cmd/dep",
        "dep ensure",
        "make test"
      ];
      test.run()
    });
                  
  • // Updating a cosmosDB database
    const { events, Job } = require("brigadier")
    
    events.on("exec", (e, p) => {
      var mongo = new Job("update-db", "mongo:3.2")
      mongo.storage.enabled = false
      mongo.tasks = [
          dbCmd(p, `db.mydb.insert(${e.payload})`)
      ]
      mongo.run()
    })
    
    function dbCmd(p, script) {
      return `mongo ${p.secrets.cosmosName}.documents.azure.com:10255/test ` +
        `-u ${p.secrets.cosmosName} -p  ${p.secrets.cosmosKey} --ssl --sslAllowInvalidCertificates ` +
        `--eval '${script}'`
    }
                  
  • // Sending a Slack message
    const { events, Job } = require("brigadier")
    
    events.on("exec", (e, p) => {
      var slack = new Job("slack-notify", "technosophos/slack-notify:latest", ["/slack-notify"])
      slack.env = {
        SLACK_WEBHOOK: p.secrets.SLACK_WEBHOOK,
        SLACK_USERNAME: "Brigade",
        SLACK_TITLE: "Hello from Brigade",
        SLACK_MESSAGE: "This is a message from Brigade"
     }
      slack.run()
    }
                  
  • // Sending a Twitter DM
    const { events, Job } = require("brigadier")
    
    const sendTo = "technosophos"
    
    events.on("exec", (e, p) => {
      // Create a new job
      const twitter = new Job("tweet", "technosophos/twitter-t:latest")
      twitter.storage.enabled = false
    
      // Set up the environment variables, copying them from the project.
      twitter.env = {
        OWNER: p.secrets.OWNER,
        CONSUMER_KEY: p.secrets.CONSUMER_KEY,
        CONSUMER_SECRET: p.secrets.CONSUMER_SECRET,
        ACCESS_TOKEN: p.secrets.ACCESS_TOKEN,
        ACCESS_SECRET: p.secrets.ACCESS_SECRET
      }
    
      // Set up the env and send a DM
      twitter.tasks = [
        "env2creds",
        `t dm ${sendTo} "${p.name} got event ${e.type}"`
      ]
    
      twitter.run()
    })
                  

Runs inside your cluster

By running Brigade as a service inside your Kubernetes cluster, you can harness the power of millions of available Docker images.

Brigade can be used to chain containers together to build processing pipelines.

  • Watch for incoming requests from services like GitHub, Docker, and Trello
  • Run unit tests, process data, and store results
  • Send notifications through services like Slack and Twitter
Kashti Dashboard

Kashti Dashboard: a place for your pipelines

Output from Brigade can be sent to Kashti — a simple UI to display build results and logs.

We are a Cloud Native Computing Foundation sandbox project

We are a Cloud Native Computing Foundation sandbox project.