@@ -105,7 +105,7 @@ func NewCommitter(registryAddr, registryUsername, registryPassword string, merge
105105
106106// CreateContainer create container with labels
107107func (c * CommitterImpl ) CreateContainer (ctx context.Context , devboxName string , contentID string , baseImage string ) (string , error ) {
108- fmt . Println ("========>>>> create container" , devboxName , contentID , baseImage )
108+ log . Printf ("========>>>> create container, devboxName: %s, contentID: %s, baseImage: %s " , devboxName , contentID , baseImage )
109109 ctx = namespaces .WithNamespace (ctx , DefaultNamespace )
110110
111111 // check connection status, if connection is bad, try to reconnect
@@ -221,7 +221,7 @@ func (c *CommitterImpl) DeleteContainer(ctx context.Context, containerName strin
221221}
222222
223223func (c * CommitterImpl ) SetLvRemovable (ctx context.Context , containerID string , contentID string ) error {
224- fmt . Println ("========>>>> set lv removable for container" , contentID )
224+ log . Printf ("========>>>> set lv removable for container, containerID: %s, contentID: %s" , containerID , contentID )
225225 ctx = namespaces .WithNamespace (ctx , DefaultNamespace )
226226
227227 // check connection status, if connection is bad, try to reconnect
@@ -248,7 +248,7 @@ func (c *CommitterImpl) RemoveContainers(ctx context.Context, containerNames []s
248248 return fmt .Errorf ("[RemoveContainers]containerNames is empty" )
249249 }
250250
251- fmt . Println ("========>>>> remove container" , containerNames )
251+ log . Printf ("========>>>> remove container, containerNames: %v " , containerNames )
252252 ctx = namespaces .WithNamespace (ctx , DefaultNamespace )
253253
254254 // check connection status, if connection is bad, try to reconnect
@@ -275,11 +275,11 @@ func (c *CommitterImpl) RemoveContainers(ctx context.Context, containerNames []s
275275
276276// Commit commit container to image
277277func (c * CommitterImpl ) Commit (ctx context.Context , devboxName string , contentID string , baseImage string , commitImage string ) (string , error ) {
278- fmt . Println ("========>>>> commit devbox" , devboxName , contentID , baseImage , commitImage )
278+ log . Printf ("========>>>> commit devbox, devboxName: %s, contentID: %s, baseImage: %s, commitImage: %s " , devboxName , contentID , baseImage , commitImage )
279279 ctx = namespaces .WithNamespace (ctx , DefaultNamespace )
280280 containerID , err := c .CreateContainer (ctx , devboxName , contentID , baseImage )
281281 if err != nil {
282- return "" , fmt .Errorf ("failed to create container: %v" , err )
282+ return containerID , fmt .Errorf ("failed to create container: %v" , err )
283283 }
284284
285285 // // mark for gc
@@ -300,7 +300,7 @@ func (c *CommitterImpl) Commit(ctx context.Context, devboxName string, contentID
300300 // commit container
301301 err = container .Commit (ctx , c .containerdClient , commitImage , containerID , opt )
302302 if err != nil {
303- return "" , fmt .Errorf ("failed to commit container: %v" , err )
303+ return containerID , fmt .Errorf ("failed to commit container: %v" , err )
304304 }
305305
306306 return containerID , nil
@@ -324,7 +324,7 @@ func (c *CommitterImpl) GetContainerAnnotations(ctx context.Context, containerNa
324324
325325// Push pushes an image to a remote repository
326326func (c * CommitterImpl ) Push (ctx context.Context , imageName string ) error {
327- fmt . Println ("========>>>> push image" , imageName )
327+ log . Printf ("========>>>> push image, imageName: %s " , imageName )
328328 ctx = namespaces .WithNamespace (ctx , DefaultNamespace )
329329
330330 // check connection status, if connection is bad, try to reconnect
@@ -365,7 +365,7 @@ func (c *CommitterImpl) RemoveImages(ctx context.Context, imageNames []string, f
365365 if len (imageNames ) == 0 {
366366 return fmt .Errorf ("[RemoveImages]imageNames is empty" )
367367 }
368- fmt . Println ("========>>>> remove image" , imageNames )
368+ log . Printf ("========>>>> remove image, imageNames: %v " , imageNames )
369369 ctx = namespaces .WithNamespace (ctx , DefaultNamespace )
370370
371371 // check connection status, if connection is bad, try to reconnect
0 commit comments