Skip to content

Conversation

@adityamaru
Copy link
Contributor

@adityamaru adityamaru commented Nov 4, 2025

Summary

This PR adds support for driver-opts input parameter to the setup-docker-builder action, enabling users to pass environment variables to buildkitd. This brings API compatibility with Docker's setup-buildx-action for driver options.

Key Changes

  • ✨ Added driver-opts input parameter to action.yml
  • 📝 Parse driver-opts using Util.getInputList with ignoreComma: true and quote: false (matching Docker's approach)
  • 🔧 Support env.* format for passing environment variables to buildkitd
  • ✅ Added comprehensive tests for driver-opts functionality
  • 🧪 Added test workflow job to verify driver-opts in CI

Use Case

This enables OpenTelemetry tracing and other environment-based configuration for buildkitd:

- name: Set up Docker Buildx with OTEL
  uses: useblacksmith/setup-docker-builder@feat/driver-opts-support
  with:
    driver-opts: |
      env.OTEL_TRACES_EXPORTER=otlp
      env.OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
      env.OTEL_EXPORTER_OTLP_ENDPOINT=https://otel.example.com
      env.OTEL_SERVICE_NAME=buildkitd

Testing

  • Added unit tests in src/driver-opts.test.ts
  • Added integration test job test-driver-opts in .github/workflows/test-action.yml
  • All tests passing ✅

Compatibility

This implementation closely mirrors the parsing logic from docker/setup-buildx-action to ensure compatibility while adapting to our direct buildkitd execution approach.

🤖 Generated with Claude Code


Note

Adds driver-opts input and plumbing to pass env.* options to buildkitd, with tests, CI workflow, and usage example.

  • Action inputs & parsing:
    • Add inputs.driver-opts in action.yml.
    • Parse driver-opts via Util.getInputList({ignoreComma: true, quote: false}) in src/main.ts.
  • Buildkitd env propagation:
    • In src/setup_builder.ts, parse env.* entries and start buildkitd with sudo env KEY='value' ....
  • Tests:
    • Add src/driver-opts.test.ts covering env parsing, quoting, and warnings.
    • Update src/main.test.ts to validate input handling for driver-opts.
  • CI/Examples:
    • Add workflow job test-driver-opts in .github/workflows/test-action.yml to exercise driver options.
    • Add example examples/with-driver-opts.yml demonstrating OTEL configuration.
  • Build artifacts:
    • Update dist/index.js and source map.

Written by Cursor Bugbot for commit 383d6bd. This will update automatically on new commits. Configure here.

adityamaru and others added 2 commits November 5, 2025 02:59
- Add driver-opts input parameter to action.yml
- Parse driver-opts with ignoreComma and quote options (matching Docker's approach)
- Support env.* format for passing environment variables to buildkitd
- Add comprehensive tests for driver-opts functionality
- Add test workflow job to verify driver-opts in CI

This enables OpenTelemetry tracing and other environment-based configuration
for buildkitd, matching the API of docker/setup-buildx-action.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@adityamaru adityamaru requested a review from pbardea November 4, 2025 22:35
The lost+found directory is created by default when formatting ext4 filesystems.
Only warn if it actually contains files, which would indicate filesystem recovery
occurred during a previous unclean shutdown.
The previous approach of putting env vars before sudo doesn't work because
sudo doesn't pass them through. Using 'sudo env KEY=value command' ensures
the environment variables are set for the sudo'd process.
@adityamaru adityamaru merged commit affa10d into main Nov 4, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants