@@ -60,7 +60,7 @@ type DryRunKey struct{}
6060// DryRunClient implements APIClient by delegating to implementation functions. This allows lazy init and per-method overrides
6161type DryRunClient struct {
6262 apiClient client.APIClient
63- containers []moby. Container
63+ containers []containerType. Summary
6464 execs sync.Map
6565 resolver * imagetools.Resolver
6666}
@@ -82,7 +82,7 @@ func NewDryRunClient(apiClient client.APIClient, cli command.Cli) (*DryRunClient
8282 }
8383 return & DryRunClient {
8484 apiClient : apiClient ,
85- containers : []moby. Container {},
85+ containers : []containerType. Summary {},
8686 execs : sync.Map {},
8787 resolver : imagetools .New (configFile ),
8888 }, nil
@@ -103,7 +103,7 @@ func (d *DryRunClient) ContainerAttach(ctx context.Context, container string, op
103103func (d * DryRunClient ) ContainerCreate (ctx context.Context , config * containerType.Config , hostConfig * containerType.HostConfig ,
104104 networkingConfig * network.NetworkingConfig , platform * specs.Platform , containerName string ,
105105) (containerType.CreateResponse , error ) {
106- d .containers = append (d .containers , moby. Container {
106+ d .containers = append (d .containers , containerType. Summary {
107107 ID : containerName ,
108108 Names : []string {containerName },
109109 Labels : config .Labels ,
@@ -115,7 +115,7 @@ func (d *DryRunClient) ContainerCreate(ctx context.Context, config *containerTyp
115115 return containerType.CreateResponse {ID : containerName }, nil
116116}
117117
118- func (d * DryRunClient ) ContainerInspect (ctx context.Context , container string ) (moby. ContainerJSON , error ) {
118+ func (d * DryRunClient ) ContainerInspect (ctx context.Context , container string ) (containerType. InspectResponse , error ) {
119119 containerJSON , err := d .apiClient .ContainerInspect (ctx , container )
120120 if err != nil {
121121 id := "dryRunId"
@@ -124,20 +124,20 @@ func (d *DryRunClient) ContainerInspect(ctx context.Context, container string) (
124124 id = container
125125 }
126126 }
127- return moby. ContainerJSON {
128- ContainerJSONBase : & moby .ContainerJSONBase {
127+ return containerType. InspectResponse {
128+ ContainerJSONBase : & containerType .ContainerJSONBase {
129129 ID : id ,
130130 Name : container ,
131- State : & moby. ContainerState {
131+ State : & containerType. State {
132132 Status : "running" , // needed for --wait option
133- Health : & moby .Health {
134- Status : moby .Healthy , // needed for healthcheck control
133+ Health : & containerType .Health {
134+ Status : containerType .Healthy , // needed for healthcheck control
135135 },
136136 },
137137 },
138138 Mounts : nil ,
139139 Config : & containerType.Config {},
140- NetworkSettings : & moby .NetworkSettings {},
140+ NetworkSettings : & containerType .NetworkSettings {},
141141 }, nil
142142 }
143143 return containerJSON , err
@@ -147,7 +147,7 @@ func (d *DryRunClient) ContainerKill(ctx context.Context, container, signal stri
147147 return nil
148148}
149149
150- func (d * DryRunClient ) ContainerList (ctx context.Context , options containerType.ListOptions ) ([]moby. Container , error ) {
150+ func (d * DryRunClient ) ContainerList (ctx context.Context , options containerType.ListOptions ) ([]containerType. Summary , error ) {
151151 caller := getCallingFunction ()
152152 switch caller {
153153 case "start" :
@@ -222,16 +222,26 @@ func (d *DryRunClient) ImageBuild(ctx context.Context, reader io.Reader, options
222222 }, nil
223223}
224224
225- func (d * DryRunClient ) ImageInspectWithRaw (ctx context.Context , imageName string ) (moby. ImageInspect , [] byte , error ) {
225+ func (d * DryRunClient ) ImageInspect (ctx context.Context , imageName string , options ... client. ImageInspectOption ) (image. InspectResponse , error ) {
226226 caller := getCallingFunction ()
227227 switch caller {
228228 case "pullServiceImage" , "buildContainerVolumes" :
229- return moby. ImageInspect {ID : "dryRunId" }, nil , nil
229+ return image. InspectResponse {ID : "dryRunId" }, nil
230230 default :
231- return d .apiClient .ImageInspectWithRaw (ctx , imageName )
231+ return d .apiClient .ImageInspect (ctx , imageName , options ... )
232232 }
233233}
234234
235+ // Deprecated: Use [DryRunClient.ImageInspect] instead; raw response can be obtained by [client.ImageInspectWithRawResponse] option.
236+ func (d * DryRunClient ) ImageInspectWithRaw (ctx context.Context , imageName string ) (image.InspectResponse , []byte , error ) {
237+ var buf bytes.Buffer
238+ resp , err := d .ImageInspect (ctx , imageName , client .ImageInspectWithRawResponse (& buf ))
239+ if err != nil {
240+ return image.InspectResponse {}, nil , err
241+ }
242+ return resp , buf .Bytes (), err
243+ }
244+
235245func (d * DryRunClient ) ImagePull (ctx context.Context , ref string , options image.PullOptions ) (io.ReadCloser , error ) {
236246 if _ , _ , err := d .resolver .Resolve (ctx , ref ); err != nil {
237247 return nil , err
@@ -299,15 +309,15 @@ func (d *DryRunClient) VolumeRemove(ctx context.Context, volumeID string, force
299309 return nil
300310}
301311
302- func (d * DryRunClient ) ContainerExecCreate (ctx context.Context , container string , config containerType.ExecOptions ) (moby. IDResponse , error ) {
312+ func (d * DryRunClient ) ContainerExecCreate (ctx context.Context , container string , config containerType.ExecOptions ) (containerType. ExecCreateResponse , error ) {
303313 b := make ([]byte , 32 )
304314 _ , _ = rand .Read (b )
305315 id := fmt .Sprintf ("%x" , b )
306316 d .execs .Store (id , execDetails {
307317 container : container ,
308318 command : config .Cmd ,
309319 })
310- return moby. IDResponse {
320+ return containerType. ExecCreateResponse {
311321 ID : id ,
312322 }, nil
313323}
@@ -344,7 +354,7 @@ func (d *DryRunClient) ConfigUpdate(ctx context.Context, id string, version swar
344354 return d .apiClient .ConfigUpdate (ctx , id , version , config )
345355}
346356
347- func (d * DryRunClient ) ContainerCommit (ctx context.Context , container string , options containerType.CommitOptions ) (moby. IDResponse , error ) {
357+ func (d * DryRunClient ) ContainerCommit (ctx context.Context , container string , options containerType.CommitOptions ) (containerType. CommitResponse , error ) {
348358 return d .apiClient .ContainerCommit (ctx , container , options )
349359}
350360
@@ -368,7 +378,7 @@ func (d *DryRunClient) ContainerExport(ctx context.Context, container string) (i
368378 return d .apiClient .ContainerExport (ctx , container )
369379}
370380
371- func (d * DryRunClient ) ContainerInspectWithRaw (ctx context.Context , container string , getSize bool ) (moby. ContainerJSON , []byte , error ) {
381+ func (d * DryRunClient ) ContainerInspectWithRaw (ctx context.Context , container string , getSize bool ) (containerType. InspectResponse , []byte , error ) {
372382 return d .apiClient .ContainerInspectWithRaw (ctx , container , getSize )
373383}
374384
@@ -392,11 +402,11 @@ func (d *DryRunClient) ContainerStatsOneShot(ctx context.Context, container stri
392402 return d .apiClient .ContainerStatsOneShot (ctx , container )
393403}
394404
395- func (d * DryRunClient ) ContainerTop (ctx context.Context , container string , arguments []string ) (containerType.ContainerTopOKBody , error ) {
405+ func (d * DryRunClient ) ContainerTop (ctx context.Context , container string , arguments []string ) (containerType.TopResponse , error ) {
396406 return d .apiClient .ContainerTop (ctx , container , arguments )
397407}
398408
399- func (d * DryRunClient ) ContainerUpdate (ctx context.Context , container string , updateConfig containerType.UpdateConfig ) (containerType.ContainerUpdateOKBody , error ) {
409+ func (d * DryRunClient ) ContainerUpdate (ctx context.Context , container string , updateConfig containerType.UpdateConfig ) (containerType.UpdateResponse , error ) {
400410 return d .apiClient .ContainerUpdate (ctx , container , updateConfig )
401411}
402412
@@ -424,8 +434,8 @@ func (d *DryRunClient) ImageCreate(ctx context.Context, parentReference string,
424434 return d .apiClient .ImageCreate (ctx , parentReference , options )
425435}
426436
427- func (d * DryRunClient ) ImageHistory (ctx context.Context , imageName string ) ([]image.HistoryResponseItem , error ) {
428- return d .apiClient .ImageHistory (ctx , imageName )
437+ func (d * DryRunClient ) ImageHistory (ctx context.Context , imageName string , options ... client. ImageHistoryOption ) ([]image.HistoryResponseItem , error ) {
438+ return d .apiClient .ImageHistory (ctx , imageName , options ... )
429439}
430440
431441func (d * DryRunClient ) ImageImport (ctx context.Context , source image.ImportSource , ref string , options image.ImportOptions ) (io.ReadCloser , error ) {
@@ -436,16 +446,16 @@ func (d *DryRunClient) ImageList(ctx context.Context, options image.ListOptions)
436446 return d .apiClient .ImageList (ctx , options )
437447}
438448
439- func (d * DryRunClient ) ImageLoad (ctx context.Context , input io.Reader , quiet bool ) (image.LoadResponse , error ) {
440- return d .apiClient .ImageLoad (ctx , input , quiet )
449+ func (d * DryRunClient ) ImageLoad (ctx context.Context , input io.Reader , options ... client. ImageLoadOption ) (image.LoadResponse , error ) {
450+ return d .apiClient .ImageLoad (ctx , input , options ... )
441451}
442452
443453func (d * DryRunClient ) ImageSearch (ctx context.Context , term string , options registry.SearchOptions ) ([]registry.SearchResult , error ) {
444454 return d .apiClient .ImageSearch (ctx , term , options )
445455}
446456
447- func (d * DryRunClient ) ImageSave (ctx context.Context , images []string ) (io.ReadCloser , error ) {
448- return d .apiClient .ImageSave (ctx , images )
457+ func (d * DryRunClient ) ImageSave (ctx context.Context , images []string , options ... client. ImageSaveOption ) (io.ReadCloser , error ) {
458+ return d .apiClient .ImageSave (ctx , images , options ... )
449459}
450460
451461func (d * DryRunClient ) ImageTag (ctx context.Context , imageName , ref string ) error {
0 commit comments