Skip to content

Commit 8df8cee

Browse files
authored
Merge pull request #68 from crazy-max/fix-driver-opts-parsing
builder: fix regex to parse driver-opts
2 parents b7cdc61 + 94febd1 commit 8df8cee

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

__tests__/buildx/builder.test.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jest.spyOn(Builder.prototype, 'inspect').mockImplementation(async (): Promise<Bu
3838
{
3939
buildkit: 'v0.11.0',
4040
'buildkitd-flags': '--debug --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
41-
'driver-opts': ['BUILDKIT_STEP_LOG_MAX_SIZE=10485760', 'BUILDKIT_STEP_LOG_MAX_SPEED=10485760', 'JAEGER_TRACE=localhost:6831', 'image=moby/buildkit:latest', 'network=host'],
41+
'driver-opts': ['BUILDKIT_STEP_LOG_MAX_SIZE=10485760', 'BUILDKIT_STEP_LOG_MAX_SPEED=10485760', 'JAEGER_TRACE=localhost:6831', 'image=moby/buildkit:latest', 'network=host', 'qemu.install=true'],
4242
endpoint: 'unix:///var/run/docker.sock',
4343
name: 'builder20',
4444
platforms: 'linux/amd64,linux/amd64/v2,linux/amd64/v3,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6',
@@ -196,11 +196,12 @@ describe('parseInspect', () => {
196196
"buildkit": "v0.11.0",
197197
"buildkitd-flags": "--debug --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host",
198198
"driver-opts": [
199-
"BUILDKIT_STEP_LOG_MAX_SIZE=10485760",
200-
"BUILDKIT_STEP_LOG_MAX_SPEED=10485760",
201-
"JAEGER_TRACE=localhost:6831",
199+
"env.BUILDKIT_STEP_LOG_MAX_SIZE=10485760",
200+
"env.BUILDKIT_STEP_LOG_MAX_SPEED=10485760",
201+
"env.JAEGER_TRACE=localhost:6831",
202202
"image=moby/buildkit:latest",
203-
"network=host"
203+
"network=host",
204+
"qemu.install=true"
204205
],
205206
"endpoint": "unix:///var/run/docker.sock",
206207
"name": "builder20",

__tests__/fixtures/inspect7.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Last Activity: 2023-01-16 09:45:23 +0000 UTC
55
Nodes:
66
Name: builder20
77
Endpoint: unix:///var/run/docker.sock
8-
Driver Options: env.BUILDKIT_STEP_LOG_MAX_SIZE="10485760" env.BUILDKIT_STEP_LOG_MAX_SPEED="10485760" env.JAEGER_TRACE="localhost:6831" image="moby/buildkit:latest" network="host"
8+
Driver Options: env.BUILDKIT_STEP_LOG_MAX_SIZE="10485760" env.BUILDKIT_STEP_LOG_MAX_SPEED="10485760" env.JAEGER_TRACE="localhost:6831" image="moby/buildkit:latest" network="host" qemu.install="true"
99
Status: running
1010
Flags: --debug --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host
1111
Buildkit: v0.11.0

src/buildx/builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export class Builder {
105105
break;
106106
}
107107
case 'driver options': {
108-
node['driver-opts'] = (value.match(/(\w+)="([^"]*)"/g) || []).map(v => v.replace(/^(.*)="(.*)"$/g, '$1=$2'));
108+
node['driver-opts'] = (value.match(/([a-zA-Z0-9_.]+)="([^"]*)"/g) || []).map(v => v.replace(/^(.*)="(.*)"$/g, '$1=$2'));
109109
break;
110110
}
111111
case 'status': {

0 commit comments

Comments
 (0)