Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
🎉

Tim Lucas toolmantim

:shipit:
🎉
View GitHub Profile
View buildkite.yml
steps:
- command: "echo ${BUILDKITE_PULL_REQUEST_REPO:-$BUILDKITE_REPO}"
View github-graphql.js
fetch('https://api.github.com/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${process.env.GITHUB_API_TOKEN}`
},
body: JSON.stringify({ query: query() })
})
.then((res) => res.json())
.then((data) => {
View 0-Readme.md

Firstly, build the Docker image:

curl https://gist.githubusercontent.com/toolmantim/c731730b4b4b7989f8f045956346bcfe/raw/Dockerfile | docker build -t bk -

Then try to use it in a project that has a buildkite pipeline.yml file:

docker run -it --rm -v "$(PWD):/app" bk run local
@toolmantim
toolmantim / step.sh
Created Nov 5, 2018
An example of dynamically adding a trigger step during a running Buildkite build
View step.sh
#!/bin/bash
set -euo pipefail
cat << YML | buildkite-agent pipeline upload
steps:
- trigger: "other-pipeline"
async: true
build:
message: "${BUILDKITE_MESSAGE}"
@toolmantim
toolmantim / buildkite.yml.schema.json
Last active Oct 21, 2018
JSON Schema for Buildkite Pipeline files
View buildkite.yml.schema.json
{
"title": "JSON schema for Buildkite pipeline configuration files",
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"label": {
"type": "string",
"description": "The label that will be displayed in the pipeline visualisation in Buildkite. Supports emoji.",
"examples": [ ":docker: Build" ]
},
"branches": {
@toolmantim
toolmantim / pipeline-2.yml
Last active Jun 17, 2018
Checking a prometheus
View pipeline-2.yml
steps:
- label: "🔍"
command: 'docker run --rm --entrypoint sh -v "$PWD/prometheus.yml:/src/prometheus.yml" prom/prometheus promtool check config /src/prometheus.yml'
@toolmantim
toolmantim / buildkite-bootstrap-wrapper-build-log-output
Last active Jun 11, 2018
An example custom Buildkite Agent bootstrap wrapper that logs the output of all build jobs.
View buildkite-bootstrap-wrapper-build-log-output
#!/bin/bash
set -euo pipefail
# A custom bootstrap wrapper that logs the output of all build jobs.
#
# To use this file, either set the env variable before starting the agent:
# BUILDKITE_BOOTSTRAP_SCRIPT_PATH=/path-to-this-file
#
# or the agent configuration key:
View 0-readme.md

Usage example:

$ docker-compose build
$ docker run -it --rm -v /some-local-plugin-path:/plugin:ro buildkite/plugin-example-validator /plugin/schema.yml /plugin/readme.md
🙌 Readme examples validate against the schema
@toolmantim
toolmantim / pipeline.yml
Created Oct 24, 2017
An example of using Taurus with Buildkite
View pipeline.yml
steps:
- command: "taurus.sh some-config.yml"
label: "Taurus"
artifact_paths: "bzt-artifacts/*"