-
Notifications
You must be signed in to change notification settings - Fork 509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ls: fix duplicated builders for json format #2970
Conversation
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
@@ -159,6 +159,9 @@ func lsPrint(dockerCli command.Cli, current *store.NodeGroup, builders []*builde | |||
} | |||
continue | |||
} | |||
if ctx.Format.IsJSON() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So JSON output does not allow seeing multi-node builders and their properties/endpoints?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
json
format marshals the builder with list of nodes:
Lines 211 to 213 in 0a4eb7e
func (c *lsContext) MarshalJSON() ([]byte, error) { | |
return json.Marshal(c.Builder) | |
} |
{
"Name":"builder",
"Driver":"docker-container",
"LastActivity":"2025-02-06T15:15:12Z",
"Dynamic":false,
"Nodes":[
{
"Name":"builder0",
"Endpoint":"unix:///var/run/docker.sock",
"Flags":[
"--debug",
"--allow-insecure-entitlement",
"security.insecure",
"--allow-insecure-entitlement",
"network.host"
],
"DriverOpts":{
"env.BUILDKIT_STEP_LOG_MAX_SIZE":"10485760",
"env.BUILDKIT_STEP_LOG_MAX_SPEED":"10485760",
"env.JAEGER_TRACE":"localhost:6831",
"image":"moby/buildkit:master"
},
"Status":"running",
"Version":"4b36562",
"IDs":[
"v6u0iluh9v6ixuqwvybs60qzj"
],
"Platforms":[
"linux/amd64",
"linux/amd64/v2",
"linux/amd64/v3",
"linux/arm64",
"linux/riscv64",
"linux/ppc64le",
"linux/s390x",
"linux/386",
"linux/arm/v7",
"linux/arm/v6"
],
"GCPolicy":[
{
"all":false,
"filter":[
"type==source.local,type==exec.cachemount,type==source.git.checkout"
],
"keepDuration":172800000000000,
"reservedSpace":0,
"maxUsedSpace":512000000,
"minFreeSpace":0
},
{
"all":false,
"filter":null,
"keepDuration":5184000000000000,
"reservedSpace":10000000000,
"maxUsedSpace":100000000000,
"minFreeSpace":202000000000
},
{
"all":false,
"filter":null,
"keepDuration":0,
"reservedSpace":10000000000,
"maxUsedSpace":100000000000,
"minFreeSpace":202000000000
},
{
"all":true,
"filter":null,
"keepDuration":0,
"reservedSpace":10000000000,
"maxUsedSpace":100000000000,
"minFreeSpace":202000000000
}
],
"Labels":{
"org.mobyproject.buildkit.worker.executor":"oci",
"org.mobyproject.buildkit.worker.hostname":"e885c15d9fbc",
"org.mobyproject.buildkit.worker.network":"host",
"org.mobyproject.buildkit.worker.oci.process-mode":"sandbox",
"org.mobyproject.buildkit.worker.selinux.enabled":"false",
"org.mobyproject.buildkit.worker.snapshotter":"overlayfs"
}
}
]
}
While table and go template output has an entry for each builder and node. This is similar to what docker service ps
does: https://docs.docker.com/reference/cli/docker/service/ps/#examples.
fixes #2969
JSON format for
ls
command without Go template (--format json
) should not set nodes in formatter context.