Skip to content

Commit 8ecd246

Browse files
committed
ci: document test env cleanup in hook
1 parent f71da3a commit 8ecd246

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

.buildkite/hooks/pre-command

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,11 @@ mkdir -p \
1212
export GOCACHE="${cache_root}/go/build"
1313
export GOMODCACHE="${cache_root}/go/pkg/mod"
1414
export GOLANGCI_LINT_CACHE="${cache_root}/golangci-lint"
15+
16+
if [[ "${BUILDKITE_STEP_KEY:-}" == "test" ]]; then
17+
# Hosted agents inject the pipeline org and API token into the step
18+
# environment. A subset of CLI tests exercise config precedence and must not
19+
# inherit those ambient overrides, or they resolve the live Buildkite org
20+
# instead of the fixture-backed test config.
21+
unset BUILDKITE_API_TOKEN BUILDKITE_ORGANIZATION_SLUG
22+
fi

.buildkite/pipeline.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ steps:
1313
- *mise_plugin
1414

1515
- name: ":go: test"
16+
key: test
1617
artifact_paths:
1718
- cover-tree.svg
18-
env:
19-
BUILDKITE_API_TOKEN: ""
20-
BUILDKITE_ORGANIZATION_SLUG: ""
2119
commands:
2220
- go test -coverprofile cover.out ./...
2321
- go run github.com/nikolaydubina/go-cover-treemap@v1.5.1 -coverprofile cover.out > cover-tree.svg

0 commit comments

Comments
 (0)