mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-29 17:05:46 +08:00
build: support for tar output
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
parent
a238b05a4c
commit
b979216b2d
@ -21,29 +21,40 @@ func ParseOutputs(inp []string) ([]client.ExportEntry, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if len(fields) == 1 && fields[0] == s && !strings.HasPrefix(s, "type=") {
|
|
||||||
outs = append(outs, client.ExportEntry{
|
|
||||||
Type: client.ExporterLocal,
|
|
||||||
OutputDir: s,
|
|
||||||
})
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
out := client.ExportEntry{
|
out := client.ExportEntry{
|
||||||
Attrs: map[string]string{},
|
Attrs: map[string]string{},
|
||||||
}
|
}
|
||||||
for _, field := range fields {
|
if len(fields) == 1 && fields[0] == s && !strings.HasPrefix(s, "type=") {
|
||||||
parts := strings.SplitN(field, "=", 2)
|
if s != "-" {
|
||||||
if len(parts) != 2 {
|
outs = append(outs, client.ExportEntry{
|
||||||
return nil, errors.Errorf("invalid value %s", field)
|
Type: client.ExporterLocal,
|
||||||
|
OutputDir: s,
|
||||||
|
})
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
key := strings.TrimSpace(strings.ToLower(parts[0]))
|
out = client.ExportEntry{
|
||||||
value := parts[1]
|
Type: client.ExporterTar,
|
||||||
switch key {
|
Attrs: map[string]string{
|
||||||
case "type":
|
"dest": s,
|
||||||
out.Type = value
|
},
|
||||||
default:
|
}
|
||||||
out.Attrs[key] = value
|
}
|
||||||
|
|
||||||
|
if out.Type == "" {
|
||||||
|
for _, field := range fields {
|
||||||
|
parts := strings.SplitN(field, "=", 2)
|
||||||
|
if len(parts) != 2 {
|
||||||
|
return nil, errors.Errorf("invalid value %s", field)
|
||||||
|
}
|
||||||
|
key := strings.TrimSpace(strings.ToLower(parts[0]))
|
||||||
|
value := parts[1]
|
||||||
|
switch key {
|
||||||
|
case "type":
|
||||||
|
out.Type = value
|
||||||
|
default:
|
||||||
|
out.Attrs[key] = value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if out.Type == "" {
|
if out.Type == "" {
|
||||||
@ -59,7 +70,7 @@ func ParseOutputs(inp []string) ([]client.ExportEntry, error) {
|
|||||||
}
|
}
|
||||||
out.OutputDir = dest
|
out.OutputDir = dest
|
||||||
delete(out.Attrs, "dest")
|
delete(out.Attrs, "dest")
|
||||||
case client.ExporterOCI, client.ExporterDocker:
|
case client.ExporterOCI, client.ExporterDocker, client.ExporterTar:
|
||||||
dest, ok := out.Attrs["dest"]
|
dest, ok := out.Attrs["dest"]
|
||||||
if !ok {
|
if !ok {
|
||||||
if out.Type != client.ExporterDocker {
|
if out.Type != client.ExporterDocker {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user