Skip to content

Commit

Permalink
Pipeline cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
DrJosh9000 committed Nov 28, 2024
1 parent 8bc3c99 commit 65d1f57
Show file tree
Hide file tree
Showing 10 changed files with 98 additions and 62 deletions.
5 changes: 0 additions & 5 deletions .buildkite/Dockerfile

This file was deleted.

3 changes: 3 additions & 0 deletions .buildkite/Dockerfile.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM public.ecr.aws/docker/library/golang:1.23.3-alpine@sha256:c694a4d291a13a9f9d94933395673494fc2cc9d4777b85df3a7e70b3492d3574

RUN apk add --no-cache aws-cli bash curl github-cli zip
1 change: 1 addition & 0 deletions .buildkite/Dockerfile.test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM public.ecr.aws/docker/library/golang:1.23.3@sha256:73f06be4578c9987ce560087e2e2ea6485fb605e3910542cadd8fa09fc5f3e31 AS builder
19 changes: 0 additions & 19 deletions .buildkite/docker-compose.yaml

This file was deleted.

48 changes: 48 additions & 0 deletions .buildkite/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
services:
build:
build:
context: .
dockerfile: Dockerfile.build
volumes:
- ../:/work:cached
- ~/gocache:/gocache
- ~/gomodcache:/gomodcache
working_dir: /work
environment:
- BUILDKITE_AGENT_ACCESS_TOKEN
- BUILDKITE_AGENT_TAGS=queue=default
- BUILDKITE_BRANCH
- BUILDKITE_BUILD_ID
- BUILDKITE_BUILD_NUMBER
- BUILDKITE_BUILD_PATH=/buildkite
- BUILDKITE_JOB_ID
- BUILDKITE_TAG
- GITHUB_RELEASE_ACCESS_TOKEN
- GOCACHE=/gocache
- GOMODCACHE=/gomodcache
- RELEASE_DRY_RUN

test:
build:
context: .
dockerfile: Dockerfile.test
volumes:
- ../:/work:cached
- ~/gocache:/gocache
- ~/gomodcache:/gomodcache
working_dir: /work
environment:
- BUILDKITE_AGENT_TAGS=queue=default
- BUILDKITE_BRANCH
- BUILDKITE_BUILD_ID
- BUILDKITE_BUILD_NUMBER
- BUILDKITE_BUILD_PATH=/buildkite
- BUILDKITE_JOB_ID
- BUILDKITE_TAG
- GOCACHE=/gocache
- GOMODCACHE=/gomodcache

release:
build:
context: .
dockerfile: Dockerfile.release
8 changes: 5 additions & 3 deletions .buildkite/pipeline.release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ steps:
agents:
queue: "elastic-runners"
concurrency: 1
concurrency_group: 'release_buildkite_metrics_github'
concurrency_group: "release_buildkite_metrics_github"
plugins:
- aws-assume-role-with-web-identity:
role-arn: arn:aws:iam::032379705303:role/pipeline-buildkite-buildkite-agent-metrics
Expand All @@ -26,6 +26,8 @@ steps:
- aws-ssm#v1.0.0:
parameters:
GITHUB_RELEASE_ACCESS_TOKEN: /pipelines/buildkite/buildkite-agent-metrics/GITHUB_RELEASE_ACCESS_TOKEN
- docker-compose#v4.14.0:
- docker-compose#v5.5.0:
config: .buildkite/docker-compose.yaml
run: agent
run: build
cli-version: 2
mount-buildkite-agent: true
52 changes: 32 additions & 20 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,47 @@ steps:
key: test
command: go test -v -race ./...
plugins:
- docker#v5.9.0:
image: golang:1.21
- docker-compose#v5.5.0:
config: .buildkite/docker-compose.yml
cli-version: 2
run: test

- group: ":hammer_and_wrench: Binary builds"
steps:
- name: ":{{matrix.os}}: Build {{matrix.os}} {{matrix.arch}} binary"
command: .buildkite/steps/build-binary.sh {{matrix.os}} {{matrix.arch}}
key: build-binary
depends_on:
- test
plugins:
- docker#v5.9.0:
image: golang:1.21
mount-buildkite-agent: true
matrix:
setup:
os:
- darwin
- linux
- windows
arch:
- amd64
- arm64
- name: ":{{matrix.os}}: Build {{matrix.os}} {{matrix.arch}} binary"
command: .buildkite/steps/build-binary.sh {{matrix.os}} {{matrix.arch}}
key: build-binary
depends_on:
- test
plugins:
- docker-compose#v5.5.0:
config: .buildkite/docker-compose.yml
cli-version: 2
run: build
matrix:
setup:
os:
- darwin
- linux
- windows
arch:
- amd64
- arm64
artifact_paths:
- ./dist/*

- name: ":lambda: Build Lambda"
key: build-lambda
depends_on:
- test
command: .buildkite/steps/build-lambda.sh
plugins:
- docker-compose#v5.5.0:
config: .buildkite/docker-compose.yml
cli-version: 2
run: build
artifact_paths:
- ./dist/*

- name: ":s3: Upload to S3"
key: upload-to-s3
Expand Down
4 changes: 2 additions & 2 deletions .buildkite/steps/build-binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ export GOOS
export GOARCH
export CGO_ENABLED=0

go build -o "buildkite-agent-metrics-${GOOS}-${GOARCH}" .
buildkite-agent artifact upload "buildkite-agent-metrics-${GOOS}-${GOARCH}"
mkdir -p dist
go build -o "dist/buildkite-agent-metrics-${GOOS}-${GOARCH}" .
14 changes: 3 additions & 11 deletions .buildkite/steps/build-lambda.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
#!/usr/bin/env sh

set -eu

docker run --rm --volume "$PWD:/code" \
--workdir /code \
--rm \
--env CGO_ENABLED=0 \
golang:1.21 \
go build -tags lambda.norpc -o lambda/bootstrap ./lambda
CGO_ENABLED=0 go build -tags lambda.norpc -o lambda/bootstrap ./lambda

chmod +x lambda/bootstrap

mkdir -p dist/
zip -j handler.zip lambda/bootstrap

buildkite-agent artifact upload handler.zip
mkdir -p dist
zip -j dist/handler.zip lambda/bootstrap
6 changes: 4 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ updates:
reviewers:
- "buildkite/pipelines-dispatch"
- package-ecosystem: "docker"
directory: "/"
directories:
- "/"
- ".buildkite"
schedule:
interval: "weekly"
open-pull-requests-limit: 2
reviewers:
- "buildkite/pipelines-dispatch"
- "buildkite/pipelines-dispatch"

0 comments on commit 65d1f57

Please sign in to comment.