@@ -97,13 +97,9 @@ func OnCommand(
9797 }
9898 }
9999
100- var isSame bool
101100 switch cparams .Engine {
102101 case DockerBuildEngine :
103102 initDockerClient ()
104- if cparams .Runtime == DockerRuntimeLoad {
105- isSame = true
106- }
107103
108104 if gparams .Debug {
109105 version .Print (xc , cmdName , logger , dclient , false , gparams .InContainer , gparams .IsDSImage )
@@ -131,9 +127,6 @@ func OnCommand(
131127 HandleSimpleEngine (logger , xc , gparams , cparams , dclient )
132128 case PodmanBuildEngine :
133129 initPodmanClient ()
134- if cparams .Runtime == PodmanRuntimeLoad {
135- isSame = true
136- }
137130
138131 if gparams .Debug {
139132 version .Print (xc , Name , logger , nil , false , gparams .InContainer , gparams .IsDSImage )
@@ -152,33 +145,38 @@ func OnCommand(
152145 xc .Exit (- 1 )
153146 }
154147
155- var crtLoaderClient crt.ImageLoaderAPIClient
156- switch cparams .Runtime {
157- case DockerRuntimeLoad :
158- if dclient == nil {
159- initDockerClient ()
160- }
148+ crtLoaderClients := map [string ]crt.ImageLoaderAPIClient {}
149+ for _ , v := range cparams .LoadRuntimes {
150+ switch v {
151+ case DockerRuntimeLoad :
152+ if dclient == nil {
153+ initDockerClient ()
154+ }
161155
162- crtLoaderClient = dockercrtclient .New (dclient )
163- case PodmanRuntimeLoad :
164- if pclient == nil {
165- initPodmanClient ()
166- }
156+ crtLoaderClients [ v ] = dockercrtclient .New (dclient )
157+ case PodmanRuntimeLoad :
158+ if pclient == nil {
159+ initPodmanClient ()
160+ }
167161
168- crtLoaderClient = podmancrtclient .New (pclient )
162+ crtLoaderClients [v ] = podmancrtclient .New (pclient )
163+ }
169164 }
170165
171- if crtLoaderClient != nil {
172- xc .Out .Info ("runtime.load.image" , ovars {
173- "runtime" : cparams .Runtime ,
174- "image.archive.file" : cparams .ImageArchiveFile ,
175- })
166+ if len (crtLoaderClients ) > 0 {
167+ for rt , client := range crtLoaderClients {
168+ xc .Out .Info ("runtime.load.image" , ovars {
169+ "runtime" : rt ,
170+ "image.archive.file" : cparams .ImageArchiveFile ,
171+ })
176172
177- if ! isSame {
178- err = crtLoaderClient .LoadImage (cparams .ImageArchiveFile , os .Stdout )
179- xc .FailOn (err )
180- } else {
181- xc .Out .Info ("same.image.engine.runtime" )
173+ if ! ((cparams .Engine == PodmanBuildEngine && rt == PodmanRuntimeLoad ) ||
174+ (cparams .Engine == DockerBuildEngine && rt == DockerRuntimeLoad )) {
175+ err = client .LoadImage (cparams .ImageArchiveFile , os .Stdout )
176+ xc .FailOn (err )
177+ } else {
178+ xc .Out .Info ("same.image.engine.runtime" )
179+ }
182180 }
183181 } else {
184182 xc .Out .Info ("runtime.load.image.none" )
0 commit comments