Skip to content

Commit

Permalink
Add buildkitd-flags for setup-buildx
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max committed Aug 16, 2020
1 parent 807389a commit 82c243c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
15 changes: 8 additions & 7 deletions setup-buildx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,14 @@ jobs:
Following inputs can be used as `step.with` keys

| Name | Type | Default | Description |
|------------------|---------|-----------------------------------|------------------------------------|
| `version` | String | _the one installed on the runner_ | [Buildx](https://github.com/docker/buildx) version. e.g. `v0.3.0`, `latest` |
| `driver` | String | `docker-container` | Sets the [builder driver](https://github.com/docker/buildx#--driver-driver) to be used. |
| `driver-opt` | String | | Passes additional [driver-specific options](https://github.com/docker/buildx#--driver-opt-options). e.g. `image=moby/buildkit:master` |
| `install` | Bool | `false` | Sets up `docker build` command as an alias to `docker buildx` |
| `use` | Bool | `true` | Switch to this builder instance |
| Name | Type | Default | Description |
|--------------------|---------|-----------------------------------|------------------------------------|
| `version` | String | _the one installed on the runner_ | [Buildx](https://github.com/docker/buildx) version. e.g. `v0.3.0`, `latest` |
| `driver` | String | `docker-container` | Sets the [builder driver](https://github.com/docker/buildx#--driver-driver) to be used. |
| `driver-opt` | String | | Passes additional [driver-specific options](https://github.com/docker/buildx#--driver-opt-options). e.g. `image=moby/buildkit:master` |
| `buildkitd-flags` | String | | [Flags for buildkitd](https://github.com/moby/buildkit/blob/master/docs/buildkitd.toml.md) daemon. |
| `install` | Bool | `false` | Sets up `docker build` command as an alias to `docker buildx` |
| `use` | Bool | `true` | Switch to this builder instance |

### outputs

Expand Down
3 changes: 3 additions & 0 deletions setup-buildx/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ inputs:
driver-opt:
description: 'Passes additional driver-specific options. Eg. image=moby/buildkit:master'
required: false
buildkitd-flags:
description: 'Flags for buildkitd daemon'
required: false
install:
description: 'Sets up docker build command as an alias to docker buildx'
default: 'false'
Expand Down
6 changes: 5 additions & 1 deletion setup-buildx/dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion setup-buildx/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ async function run(): Promise<void> {
const bxVersion: string = core.getInput('version');
const bxDriver: string = core.getInput('driver') || 'docker-container';
const bxDriverOpt: string = core.getInput('driver-opt');
const bxBuildkitdFlags: string = core.getInput('buildkitd-flags');
const bxInstall: boolean = /true/i.test(core.getInput('install'));
const bxUse: boolean = /true/i.test(core.getInput('use'));

Expand All @@ -28,7 +29,7 @@ async function run(): Promise<void> {
core.info('📣 Buildx info');
await exec.exec('docker', ['buildx', 'version']);

const builderName: string = `builder-${(await buildx.countBuilders()) + 1}-${process.env.GITHUB_JOB}`;
const builderName: string = `builder-${process.env.GITHUB_JOB}-${(await buildx.countBuilders()) + 1}`;
core.setOutput('name', builderName);
stateHelper.setBuilderName(builderName);

Expand All @@ -37,6 +38,9 @@ async function run(): Promise<void> {
if (bxDriverOpt) {
createArgs.push('--driver-opt', bxDriverOpt);
}
if (bxBuildkitdFlags) {
createArgs.push('--buildkitd-flags', bxBuildkitdFlags);
}
if (bxUse) {
createArgs.push('--use');
}
Expand Down

0 comments on commit 82c243c

Please sign in to comment.