From 95dc172a82934a4b79603bd3527fe71388f96eef Mon Sep 17 00:00:00 2001 From: Lachlan Donald Date: Sun, 19 Feb 2017 15:11:43 +1100 Subject: [PATCH] Add BUILDKITE_QUIET support to lambda --- README.md | 1 + lambda.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/README.md b/README.md index 630dc877..81036197 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,7 @@ It's entrypoint is `handler.handle`, it requires a `python2.7` environment and m - BUILDKITE_TOKEN - BUILDKITE_BACKEND - BUILDKITE_QUEUE + - BUILDKITE_QUIET Checkout https://github.com/buildkite/elastic-ci-stack-for-aws/blob/master/templates/metrics.yml for examples of usage. diff --git a/lambda.go b/lambda.go index e9dbd33b..86c0c4e0 100644 --- a/lambda.go +++ b/lambda.go @@ -2,6 +2,7 @@ package main import ( "encoding/json" + "io/ioutil" "log" "os" "strings" @@ -18,6 +19,11 @@ func handle(evt json.RawMessage, ctx *runtime.Context) (interface{}, error) { token := os.Getenv("BUILDKITE_TOKEN") backendOpt := os.Getenv("BUILDKITE_BACKEND") queue := os.Getenv("BUILDKITE_QUEUE") + quiet := os.Getenv("BUILDKITE_QUIET") + + if quiet == "1" || quiet == "false" { + log.SetOutput(ioutil.Discard) + } config, err := buildkite.NewTokenConfig(token, false) if err != nil {