Batch get secrets#3483
Merged
Merged
Conversation
This command concurrently requests a list of secrets from the agent API, redacts them, then prints them to the terminal in a configurable format. This should significantly speed up operations where lots of secrets are being fetched.
DrJosh9000
reviewed
Sep 17, 2025
DrJosh9000
reviewed
Sep 17, 2025
DrJosh9000
left a comment
Contributor
There was a problem hiding this comment.
Looks pretty good, I have some tweaks
|
|
||
| keys := []string{"DATABASE_URL", "API_TOKEN"} | ||
| secrets, errs := FetchSecrets(context.Background(), apiClient, "test-job-id", keys, false) | ||
| secrets, errs := FetchSecrets(context.Background(), apiClient, "test-job-id", keys, 1) |
Contributor
There was a problem hiding this comment.
While you're here, why not update all these:
Suggested change
| secrets, errs := FetchSecrets(context.Background(), apiClient, "test-job-id", keys, 1) | |
| secrets, errs := FetchSecrets(t.Context(), apiClient, "test-job-id", keys, 1) |
Contributor
Author
There was a problem hiding this comment.
i have another branch locally to clean up the tests in this file, will submit along with that
3004536 to
d83cea5
Compare
DrJosh9000
reviewed
Sep 17, 2025
49e136a to
1515f4f
Compare
1515f4f to
966b9a7
Compare
DrJosh9000
approved these changes
Sep 17, 2025
dabarrell
previously requested changes
Sep 17, 2025
…ting to value for single and json for multiple
dabarrell
reviewed
Sep 18, 2025
Co-authored-by: David Barrell <david@buildkite.com>
a6e265f to
319a28a
Compare
DrJosh9000
approved these changes
Sep 18, 2025
DrJosh9000
left a comment
Contributor
There was a problem hiding this comment.
Still LGTM. Great work!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 updates the
buildkite-agent secret getcommand to be able to concurrently fetch multiple secrets — eg, where previously you might've had to do something like:and wait for each secret fetch to happen serially. Now, the
secret getcommand can fetch the secrets concurrently, and output them in an easy-to-parse format like JSON or env:Note that under normal circumstances (where the
--skip-redactionflag is omitted) the values of the secrets would be redacted from buildkite job logs.Additionally, secrets embdedded in the buildkite pipeline YAML will also be fetched concurrently.
Context
PS-1064
Slack convo
Changes
Testing
go test ./...). Buildkite employees may check this if the pipeline has run automatically.go fmt ./...)Disclosures / Credits
It's all artisanal, handcrafted slop from me.