1. Resources
  2. /
  3. Plugins
  4. /
  5. aws-secretsmanager-to-bazelrc-buildkite-plugin

AWS SecretsManager to BazelRC file Buildkite Plugin Build status

A Buildkite plugin that will take a JSON blob from an AWS SecretsManager path and hydrate it into Bazel configuration options.

Secret data structure

The secret stored within AWS SecretsManager is expected to be a JSON object that conforms to a specific structure.

{
  "files": [
    {
      "filename": "file-to-output-content.extension",
      "key": "key_used_in_bazelrc_file",
      "value": "super-secret-content"
    }
  ],
  "values": [
    {
      "key": "key_used_in_bazelrc_file",
      "value": "secret-content-of-key"
    }
  ]
}

There are 2 lists that will be used, with slightly different uses.

  1. files contains a list of objects that will hydrate files into a temporary path and reference those files.
    1. filename is the name of the file to place the content.
    2. key is the argument the file will be referenced to within the .bazelrc configuration.
    3. value is the base64-encoded file content.
  2. values are bare values that will be placed into the .bazelrc file.
    1. key is the argument for the value.
    2. value is the bare value to be placed into the config.

All files will be placed into a generated temporary path, this matches the pattern aws-secretsmanager-bazelrc-tmp.XXXXXX. The included post-command hook will remove this path after the command is completed to prevent these secret files from being left-behind.

Options

These are all the options available to configure this plugin’s behaviour.

Required

path (string)

The path within SecretsManager that the secret can be retrieved from.

Optional

bazel-config (string)

The name of the config group within Bazel to assign the parameters to. This is the value that will be used in the --config= switch when running Bazel.

By default, this value is set to buildkite.

output-filename (string)

The filename of the generated .bazelrc configuration. This is the filename that will be referred to when using --bazelrc= when running Bazel.

By default, this value is set to .bazelrc-buildkite.

Examples

Default usage.

steps:
  - label: "🔨 Running plugin"
    command: "bazelisk --bazelrc=.bazelrc --bazelrc=.bazelrc-generated build --config=buildkite //..."
    plugins:
      - aws-secretsmanager-to-bazelrc-file#v1.0.0:
          path: "my/secret/path"

And with other options as well

With all configuration options included.

steps:
  - label: "🔨 Running plugin"
    command: "bazelisk --bazelrc=.bazelrc --bazelrc=other build --config=bk //..."
    plugins:
      - aws-secretsmanager-to-bazelrc-file#v1.0.0:
          path: "my/secret/path"
          bazel-config: "bk"
          output-filename: "other"

Combining with other plugins

This plugin is designed to work with the aws-assume-role-with-web-identity plugin to allow for OIDC access to SecretsManager.

See the Buildkite docs for a comprehensive guide on setting up and using OIDC.

steps:
  - label: "🔨 Running plugin"
    command: "bazelisk --bazelrc=.bazelrc --bazelrc=other build --config=bk //..."
    plugins:
      - aws-assume-role-with-web-identity#v1.1.0:
          role: "arn:aws:..."
      - aws-secretsmanager-to-bazelrc-file#v1.0.0:
          path: "my/secret/path"
          bazel-config: "bk"
          output-filename: "other"

👩‍💻 Contributing

Naturally, PRs are welcomed! The intention here is to ensure a JSON structure of secret content can be safely converted into configuration that allows for proper extended usage of Bazel, especially with services such as remote executors or caches.

Using dry-run mode

To enable dry-run, use DRY_RUN=1 to run the hooks/pre-command file. This will allow for the subsequent use of DRY_RUN_FILE that should reference a JSON file to simulate the content retrieved from AWS. A full example command might look like the following.

DRY_RUN=1 DRY_RUN_FILE=secretsmanager.json BUILDKITE_PLUGIN_AWS_SECRETSMANAGER_TO_BAZELRC_PATH=/unused ./hooks/pre-command

📜 License

The package is available as open source under the terms of the MIT License.

The plugins listed on this webpage are provided for informational purposes only. They have not undergone any formal security review or assessment. While we strive to provide useful resources, we cannot guarantee the safety, reliability, or integrity of these plugins. Users are strongly advised to conduct their own security evaluations before downloading, installing, or using any plugin. By using these plugins, you acknowledge and accept any risks associated with their use. We disclaim any liability for any harm or damages arising from the use of the plugins listed.

Start turning complexity into an advantage

Create an account to get started with a 30-day free trial. No credit card required.

Buildkite Pipelines

Platform

  1. Pipelines
  2. Pipeline templates
  3. Public pipelines
  4. Test Engine
  5. Package Registries
  6. Mobile Delivery Cloud
  7. Pricing

Hosting options

  1. Self-hosted agents
  2. Mac hosted agents
  3. Linux hosted agents

Resources

  1. Docs
  2. Blog
  3. Changelog
  4. Webinars
  5. Plugins
  6. Case studies
  7. Events
  8. Migration Services
  9. Comparisons

Company

  1. About
  2. Careers
  3. Press
  4. Brand assets
  5. Contact

Solutions

  1. Replace Jenkins
  2. Workflows for AI/ML
  3. Testing at scale
  4. Monorepo mojo
  5. Bazel orchestration

Legal

  1. Terms of Service
  2. Acceptable Use Policy
  3. Privacy Policy
  4. Subprocessors
  5. Service Level Agreement

Support

  1. System status
  2. Forum
© Buildkite Pty Ltd 2025