Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ The following inputs can be used as `step.with` keys:
| `append` | YAML | | [Append additional nodes](https://docs.docker.com/build/ci/github-actions/configure-builder/#append-additional-nodes-to-the-builder) to the builder |
| `cache-binary` | Bool | `true` | Cache buildx binary to GitHub Actions cache backend |
| `cleanup` | Bool | `true` | Cleanup temp files and remove builder at the end of a job |
| `name` | String | Default Docker Context | Name of the builder to create or use. If a builder with this name already exists, it will be used instead of creating a new one. |

> [!IMPORTANT]
> If you set the `buildkitd-flags` input, the default flags (`--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host`)
Expand Down
71 changes: 65 additions & 6 deletions __tests__/context.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ describe('getCreateArgs', () => {
['use', 'true'],
['cache-binary', 'true'],
['cleanup', 'true'],
['keep-state', 'false']
]),
[
'create',
Expand All @@ -74,6 +75,7 @@ describe('getCreateArgs', () => {
['use', 'true'],
['cache-binary', 'true'],
['cleanup', 'true'],
['keep-state', 'false']
]),
[
'create',
Expand All @@ -92,6 +94,7 @@ describe('getCreateArgs', () => {
['driver-opts', 'image=moby/buildkit:master\nnetwork=host'],
['cache-binary', 'true'],
['cleanup', 'true'],
['keep-state', 'false']
]),
[
'create',
Expand All @@ -112,6 +115,7 @@ describe('getCreateArgs', () => {
['use', 'true'],
['cache-binary', 'true'],
['cleanup', 'true'],
['keep-state', 'false']
]),
[
'create',
Expand All @@ -132,6 +136,7 @@ describe('getCreateArgs', () => {
['use', 'true'],
['cache-binary', 'true'],
['cleanup', 'true'],
['keep-state', 'false']
]),
[
'create',
Expand All @@ -151,6 +156,7 @@ describe('getCreateArgs', () => {
['driver-opts', `"env.no_proxy=localhost,127.0.0.1,.mydomain"`],
['cache-binary', 'true'],
['cleanup', 'true'],
['keep-state', 'false'],
]),
[
'create',
Expand All @@ -169,6 +175,7 @@ describe('getCreateArgs', () => {
['platforms', 'linux/amd64\n"linux/arm64,linux/arm/v7"'],
['cache-binary', 'true'],
['cleanup', 'true'],
['keep-state', 'false'],
]),
[
'create',
Expand All @@ -187,6 +194,7 @@ describe('getCreateArgs', () => {
['driver', 'unknown'],
['cache-binary', 'true'],
['cleanup', 'true'],
['keep-state', 'false'],
]),
[
'create',
Expand All @@ -203,6 +211,7 @@ describe('getCreateArgs', () => {
['buildkitd-config', path.join(fixturesDir, 'buildkitd.toml')],
['cache-binary', 'true'],
['cleanup', 'true'],
['keep-state', 'false'],
]),
[
'create',
Expand All @@ -221,6 +230,7 @@ describe('getCreateArgs', () => {
['buildkitd-config-inline', 'debug = true'],
['cache-binary', 'true'],
['cleanup', 'true'],
['keep-state', 'false'],
]),
[
'create',
Expand All @@ -240,14 +250,53 @@ describe('getCreateArgs', () => {
['buildkitd-flags', '--allow-insecure-entitlement network.host'],
['cache-binary', 'true'],
['cleanup', 'true'],
['keep-state', 'false'],
]),
[
'create',
'--name', 'builder-9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d',
'--driver', 'cloud',
'--buildkitd-flags', '--allow-insecure-entitlement network.host',
]
]
],
[
11,
'v0.10.3',
new Map<string, string>([
['install', 'false'],
['use', 'true'],
['cleanup', 'true'],
['cache-binary', 'true'],
['keep-state', 'false'],
['name', 'test-builder-name'],
]),
[
'create',
'--name', 'test-builder-name',
'--driver', 'docker-container',
'--buildkitd-flags', '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
'--use'
]
],
[
12,
'v0.10.3',
new Map<string, string>([
['install', 'false'],
['use', 'true'],
['cleanup', 'true'],
['cache-binary', 'true'],
['keep-state', 'true'],
['name', 'test-builder-name'],
]),
[
'create',
'--name', 'test-builder-name',
'--driver', 'docker-container',
'--buildkitd-flags', '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
'--use',
]
],
])(
'[%d] given buildx %s and %p as inputs, returns %p',
async (num: number, buildxVersion: string, inputs: Map<string, string>, expected: Array<string>) => {
Expand Down Expand Up @@ -285,6 +334,7 @@ describe('getAppendArgs', () => {
['use', 'true'],
['cache-binary', 'true'],
['cleanup', 'true'],
['keep-state', 'false']
]),
{
"name": "aws_graviton2",
Expand Down Expand Up @@ -343,6 +393,7 @@ describe('getVersion', () => {
['use', 'true'],
['cache-binary', 'true'],
['cleanup', 'true'],
['keep-state', 'false']
]),
''
],
Expand All @@ -354,7 +405,8 @@ describe('getVersion', () => {
['install', 'false'],
['use', 'true'],
['cache-binary', 'true'],
['cleanup', 'true']
['cleanup', 'true'],
['keep-state', 'false']
]),
'latest'
],
Expand All @@ -366,7 +418,8 @@ describe('getVersion', () => {
['install', 'false'],
['use', 'true'],
['cache-binary', 'true'],
['cleanup', 'true']
['cleanup', 'true'],
['keep-state', 'false']
]),
'edge'
],
Expand All @@ -378,7 +431,8 @@ describe('getVersion', () => {
['install', 'false'],
['use', 'true'],
['cache-binary', 'true'],
['cleanup', 'true']
['cleanup', 'true'],
['keep-state', 'false']
]),
'v0.19.2'
],
Expand All @@ -391,7 +445,8 @@ describe('getVersion', () => {
['install', 'false'],
['use', 'true'],
['cache-binary', 'true'],
['cleanup', 'true']
['cleanup', 'true'],
['keep-state', 'false']
]),
'cloud:latest'
],
Expand All @@ -404,7 +459,8 @@ describe('getVersion', () => {
['install', 'false'],
['use', 'true'],
['cache-binary', 'true'],
['cleanup', 'true']
['cleanup', 'true'],
['keep-state', 'false']
]),
'cloud:edge'
],
Expand All @@ -417,6 +473,7 @@ describe('getVersion', () => {
['use', 'true'],
['cache-binary', 'true'],
['cleanup', 'true'],
['keep-state', 'false']
]),
'cloud:latest'
],
Expand All @@ -430,6 +487,7 @@ describe('getVersion', () => {
['use', 'true'],
['cache-binary', 'true'],
['cleanup', 'true'],
['keep-state', 'false']
]),
'cloud:v0.11.2-desktop.2'
],
Expand All @@ -442,6 +500,7 @@ describe('getVersion', () => {
['use', 'true'],
['cache-binary', 'true'],
['cleanup', 'true'],
['keep-state', 'false']
]),
'cloud:v0.11.2-desktop.2'
],
Expand Down
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ inputs:
cleanup:
description: 'Cleanup temp files and remove builder at the end of a job'
default: 'true'
keep-state:
description: 'Keep BuildKit state on cleanup. This is only useful on persistent self-hosted runners.'
default: 'false'
required: false
name:
description: 'Builder name set when creating the builder. If not specified, one will be generated.'
required: false
# TODO: remove deprecated config and config-inline inputs
config:
Expand Down
48 changes: 18 additions & 30 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

Loading
Loading