Skip to content

Instantly share code, notes, and snippets.

View lox's full-sized avatar

Lachlan Donald lox

View GitHub Profile
@lox
lox / pipeline.yml
Last active October 8, 2018 06:18
Example pipeline with concurrency of docker plugin
steps:
- command: echo hello world
parallelism: 4
plugins:
- docker#v1.4.0:
image: "alpine:latest"
@lox
lox / bash_parser.sh
Last active September 24, 2018 03:37
Quoted string parsing in bash
#!/bin/bash
set -euo pipefail
input="$(cat <&0)"
if [[ "${COMPARE_EVAL:-}" == "1" ]] ; then
printf 'parsing of args with native bash eval:\n\n'
eval "array=($input)"
for token in "${array[@]}"; do
printf '[%q]\n' "$token"
@lox
lox / pipeline.yml
Created August 28, 2018 04:10
Kitewrk example pipeline
steps:
- command: sleep 60
@lox
lox / README.md
Last active November 12, 2018 15:02
Troubleshooting Performance Issues with M5.large Instances

Overview

We have an autoscaling group of m5.large instances with 250GB EBS root volumes that we use for running our Buildkite test suites. This group scales up from 0 to 40 during the work day and then down again, so each day we see new instances.

We've been seeing every few days that a few of the instances run very, very slowly. Our test suite either takes 100x it's usual time or times out entirely. On the host machine, a basic command like aws s3api head-object --bucket blah --key blah will take 45 seconds.

All instances are m5.large in us-east-1 running the latest Amazon Linux 2 ami-06631de3819cb42f3

Tests

@lox
lox / Dockerfile
Last active August 6, 2018 02:23
Pipeline for testing passing an ssh-agent socket to docker-compose
FROM lgatica/openssh-client:latest
@lox
lox / pipeline.yml
Created June 25, 2018 14:13
Example of running docker-compose plugin
steps:
- command: test.sh
plugins:
docker-compose#v2.4.1:
run: app
@lox
lox / README.md
Created June 14, 2018 09:21
binproxy

Often inside a docker container one wants to run specific commands on the host. binproxy provides a way to allow specific command invocations inside a docker container that proxies to commands on the host:

commands:
  buildkite-agent:
    parameters:
      - regexp: '^meta-data (set|get)'
    env:
      - BUILDKITE_AGENT_ACCESS_TOKEN
@lox
lox / get-artifacts-from-triggered-build.sh
Last active May 22, 2018 02:50
Test passing artifacts between triggered builds
#!/bin/bash
buildkite-agent artifact download test.txt .
cat test.txt
@lox
lox / pipeline.yml
Last active May 3, 2018 05:28
Test local plugins
steps:
- label: "Test local plugin"
agents:
queue: "${BUILDKITE_AGENT_META_DATA_QUEUE:-default}"
plugins:
"/Users/lachlan/Projects/buildkite/docker-compose-buildkite-plugin": ~
@lox
lox / Dockerfile
Last active April 23, 2018 22:53
Test caching shared base image in docker-compose-buildkite-plugin
FROM alpine:3.3
RUN echo "CACHE MISS" && sleep 10
RUN apk update && \
apk add --no-cache openssl && \
rm -rf /var/cache/apk/*
RUN echo "CACHE MISS" && sleep 10
RUN openssl req -x509 -nodes -newkey rsa:4096 -keyout /key.pem -out /certificate.pem -days 720 -subj "/C=US/ST=State/L=City/O=Department/OU=Company/CN=localhost.localdomain"
RUN echo "CACHE MISS" && sleep 10