The OCI image exporter does not support naming, so reject such attempts.
Adjust the test case to not name in the OCI case. Signed-off-by: Ian Campbell <ijc@docker.com>docker-18.09
parent
aa51b40649
commit
0b20bcc8f3
|
@ -226,7 +226,9 @@ func testFrontendImageNaming(t *testing.T, sb integration.Sandbox) {
|
|||
imageName := "image-" + exp + "-fe:latest"
|
||||
|
||||
switch exp {
|
||||
case ExporterOCI, ExporterDocker:
|
||||
case ExporterOCI:
|
||||
t.Skip("oci exporter does not support named images")
|
||||
case ExporterDocker:
|
||||
outW, err := os.Create(out)
|
||||
require.NoError(t, err)
|
||||
so.ExporterOutput = outW
|
||||
|
@ -671,12 +673,13 @@ func testOCIExporter(t *testing.T, sb integration.Sandbox) {
|
|||
outW, err := os.Create(out)
|
||||
require.NoError(t, err)
|
||||
target := "example.com/buildkit/testoci:latest"
|
||||
|
||||
attrs := map[string]string{}
|
||||
if exp == ExporterDocker {
|
||||
attrs["name"] = target
|
||||
}
|
||||
_, err = c.Solve(context.TODO(), def, SolveOpt{
|
||||
Exporter: exp,
|
||||
ExporterAttrs: map[string]string{
|
||||
"name": target,
|
||||
},
|
||||
ExporterAttrs: attrs,
|
||||
ExporterOutput: outW,
|
||||
}, nil)
|
||||
require.NoError(t, err)
|
||||
|
|
|
@ -190,6 +190,9 @@ func oneOffProgress(ctx context.Context, id string) func(err error) error {
|
|||
func getExporter(variant ExporterVariant, name string) (images.Exporter, error) {
|
||||
switch variant {
|
||||
case VariantOCI:
|
||||
if name != "" {
|
||||
return nil, errors.New("oci exporter cannot export named image")
|
||||
}
|
||||
return &oci.V1Exporter{}, nil
|
||||
case VariantDocker:
|
||||
return &dockerexporter.DockerExporter{Name: name}, nil
|
||||
|
|
Loading…
Reference in New Issue