Skip to content

Commit b376e2b

Browse files
committed
ci: use absolute cache paths in Buildkite
1 parent a145530 commit b376e2b

3 files changed

Lines changed: 20 additions & 20 deletions

File tree

.buildkite/cache-env.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
checkout_path="${BUILDKITE_BUILD_CHECKOUT_PATH:-$(pwd)}"
6+
cache_root="${checkout_path}/.buildkite/cache-volume"
7+
8+
mkdir -p \
9+
"${cache_root}/go/build" \
10+
"${cache_root}/go/pkg/mod" \
11+
"${cache_root}/golangci-lint"
12+
13+
export GOCACHE="${cache_root}/go/build"
14+
export GOMODCACHE="${cache_root}/go/pkg/mod"
15+
export GOLANGCI_LINT_CACHE="${cache_root}/golangci-lint"

.buildkite/pipeline.release.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
agents:
22
queue: hosted
33

4-
x-cache-env: &cache_env
5-
GOCACHE: .buildkite/cache-volume/go/build
6-
GOMODCACHE: .buildkite/cache-volume/go/pkg/mod
7-
84
x-mise-plugin: &mise_plugin
95
buildkite-plugins/mise#v1.1.1: ~
106

@@ -22,9 +18,8 @@ steps:
2218
- POSTHOG_API_KEY
2319
- OAUTH_CLIENT_ID
2420
env:
25-
<<: *cache_env
2621
GOOS: "{{matrix}}"
27-
command: ".buildkite/release.sh release --clean --split"
22+
command: '. .buildkite/cache-env.sh && .buildkite/release.sh release --clean --split'
2823
plugins:
2924
- *mise_plugin
3025

@@ -44,7 +39,6 @@ steps:
4439
artifact_paths:
4540
- dist/**/*
4641
env:
47-
<<: *cache_env
4842
AWS_REGION: us-east-1
4943
secrets:
5044
- POSTHOG_API_KEY
@@ -65,4 +59,4 @@ steps:
6559
download:
6660
- dist/**/*
6761
- *mise_plugin
68-
command: ".buildkite/release.sh continue --merge"
62+
command: '. .buildkite/cache-env.sh && .buildkite/release.sh continue --merge'

.buildkite/pipeline.yml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,22 @@
11
agents:
22
queue: hosted
33

4-
x-cache-env: &cache_env
5-
GOCACHE: .buildkite/cache-volume/go/build
6-
GOMODCACHE: .buildkite/cache-volume/go/pkg/mod
7-
GOLANGCI_LINT_CACHE: .buildkite/cache-volume/golangci-lint
8-
94
x-mise-plugin: &mise_plugin
105
buildkite-plugins/mise#v1.1.1: ~
116

127
cache: ".buildkite/cache-volume"
138

149
steps:
1510
- name: ":golangci-lint: lint"
16-
command: golangci-lint run --verbose --timeout 3m
17-
env:
18-
<<: *cache_env
11+
command: '. .buildkite/cache-env.sh && golangci-lint run --verbose --timeout 3m'
1912
plugins:
2013
- *mise_plugin
2114

2215
- name: ":go: test"
2316
artifact_paths:
2417
- cover-tree.svg
25-
env:
26-
<<: *cache_env
2718
commands:
19+
- . .buildkite/cache-env.sh
2820
- go test -coverprofile cover.out ./...
2921
- go run github.com/nikolaydubina/go-cover-treemap@v1.5.1 -coverprofile cover.out > cover-tree.svg
3022
- echo '<details><summary>Coverage tree map</summary><img src="artifact://cover-tree.svg" alt="Test coverage tree map" width="70%"></details>' | buildkite-agent annotate --style "info"
@@ -44,9 +36,8 @@ steps:
4436
- POSTHOG_API_KEY
4537
- OAUTH_CLIENT_ID
4638
env:
47-
<<: *cache_env
4839
GOOS: "{{matrix}}"
49-
command: ".buildkite/release.sh release --clean --snapshot --split"
40+
command: '. .buildkite/cache-env.sh && .buildkite/release.sh release --clean --snapshot --split'
5041
plugins:
5142
- *mise_plugin
5243

0 commit comments

Comments
 (0)