Add batch secret retrieval functionality #3446
Draft
+377
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a new
buildkite-agent secret batch-getcommand that allows users to fetch multiple secrets in a single API call, addressing performance concerns for large organizations like Reddit who have many secrets and experience 30-45 second delays when fetching secrets individually.The solution provides a backward-compatible addition that doesn't change existing functionality while offering significant performance improvements for batch operations.
Context
Linear Issue: PS-1064 - Reddit request for batch secret retrieval functionality to reduce build setup times from 30-45 seconds.
Changes
API Layer:
GetSecretsRequeststruct for batch requests withKeys []stringandJobID stringGetSecretsResponsestruct withSecrets []SecretfieldGetSecretsmethod to API client usingkey[]=val1&key[]=val2query formatGetSecretmethodCLI Layer:
buildkite-agent secret batch-getsubcommandbatch-get key1 key2 key3--keys-from-file secrets.txt--format env(default) or--format json--skip-redaction)Testing:
GetSecretsAPI methodCommand Examples:
Testing
go test ./...). Buildkite employees may check this if the pipeline has run automatically.go fmt ./...)Note: Local testing was limited due to Go version constraints in development environment. Comprehensive tests included and CI will validate functionality.
Disclosures / Credits
This implementation was created using Claude Code (First Draft agent) to address the Reddit customer request. The solution includes:
🤖 Generated with Claude Code