Skip to content

Commit

Permalink
Merge pull request #68 from crazy-max/fix-driver-opts-parsing
Browse files Browse the repository at this point in the history
builder: fix regex to parse driver-opts
  • Loading branch information
crazy-max committed Mar 11, 2023
2 parents b7cdc61 + 94febd1 commit 8df8cee
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions __tests__/buildx/builder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jest.spyOn(Builder.prototype, 'inspect').mockImplementation(async (): Promise<Bu
{
buildkit: 'v0.11.0',
'buildkitd-flags': '--debug --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
'driver-opts': ['BUILDKIT_STEP_LOG_MAX_SIZE=10485760', 'BUILDKIT_STEP_LOG_MAX_SPEED=10485760', 'JAEGER_TRACE=localhost:6831', 'image=moby/buildkit:latest', 'network=host'],
'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'],
endpoint: 'unix:///var/run/docker.sock',
name: 'builder20',
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',
Expand Down Expand Up @@ -196,11 +196,12 @@ describe('parseInspect', () => {
"buildkit": "v0.11.0",
"buildkitd-flags": "--debug --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host",
"driver-opts": [
"BUILDKIT_STEP_LOG_MAX_SIZE=10485760",
"BUILDKIT_STEP_LOG_MAX_SPEED=10485760",
"JAEGER_TRACE=localhost:6831",
"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"
"network=host",
"qemu.install=true"
],
"endpoint": "unix:///var/run/docker.sock",
"name": "builder20",
Expand Down
2 changes: 1 addition & 1 deletion __tests__/fixtures/inspect7.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Last Activity: 2023-01-16 09:45:23 +0000 UTC
Nodes:
Name: builder20
Endpoint: unix:///var/run/docker.sock
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"
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"
Status: running
Flags: --debug --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host
Buildkit: v0.11.0
Expand Down
2 changes: 1 addition & 1 deletion src/buildx/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class Builder {
break;
}
case 'driver options': {
node['driver-opts'] = (value.match(/(\w+)="([^"]*)"/g) || []).map(v => v.replace(/^(.*)="(.*)"$/g, '$1=$2'));
node['driver-opts'] = (value.match(/([a-zA-Z0-9_.]+)="([^"]*)"/g) || []).map(v => v.replace(/^(.*)="(.*)"$/g, '$1=$2'));
break;
}
case 'status': {
Expand Down

0 comments on commit 8df8cee

Please sign in to comment.