- Use layer DiffIDs for progress output in v1 push. This makes the
output consistent with v2 pushes, which means that a fallback to v1
won't start progress bars for a different set of IDs.
- Change wording used in v1 status updates to be consistent with v2.
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
| ... | ... |
@@ -175,7 +175,6 @@ func (p *v1Puller) downloadImage(ctx context.Context, repoData *registry.Reposit |
| 175 | 175 |
progress.Update(p.config.ProgressOutput, stringid.TruncateID(img.ID), err.Error()) |
| 176 | 176 |
return err |
| 177 | 177 |
} |
| 178 |
- progress.Update(p.config.ProgressOutput, stringid.TruncateID(img.ID), "Download complete") |
|
| 179 | 178 |
return nil |
| 180 | 179 |
} |
| 181 | 180 |
|
| ... | ... |
@@ -297,11 +297,13 @@ func (p *v1Pusher) lookupImageOnEndpoint(wg *sync.WaitGroup, endpoint string, im |
| 297 | 297 |
defer wg.Done() |
| 298 | 298 |
for image := range images {
|
| 299 | 299 |
v1ID := image.V1ID() |
| 300 |
+ truncID := stringid.TruncateID(image.Layer().DiffID().String()) |
|
| 300 | 301 |
if err := p.session.LookupRemoteImage(v1ID, endpoint); err != nil {
|
| 301 | 302 |
logrus.Errorf("Error in LookupRemoteImage: %s", err)
|
| 302 | 303 |
imagesToPush <- v1ID |
| 304 |
+ progress.Update(p.config.ProgressOutput, truncID, "Waiting") |
|
| 303 | 305 |
} else {
|
| 304 |
- progress.Messagef(p.config.ProgressOutput, "", "Image %s already pushed, skipping", stringid.TruncateID(v1ID)) |
|
| 306 |
+ progress.Update(p.config.ProgressOutput, truncID, "Already exists") |
|
| 305 | 307 |
} |
| 306 | 308 |
} |
| 307 | 309 |
} |
| ... | ... |
@@ -372,7 +374,6 @@ func (p *v1Pusher) pushRepository(ctx context.Context) error {
|
| 372 | 372 |
if err != nil {
|
| 373 | 373 |
return err |
| 374 | 374 |
} |
| 375 |
- progress.Message(p.config.ProgressOutput, "", "Sending image list") |
|
| 376 | 375 |
|
| 377 | 376 |
imageIndex := createImageIndex(imgList, tags) |
| 378 | 377 |
for _, data := range imageIndex {
|
| ... | ... |
@@ -385,7 +386,6 @@ func (p *v1Pusher) pushRepository(ctx context.Context) error {
|
| 385 | 385 |
if err != nil {
|
| 386 | 386 |
return err |
| 387 | 387 |
} |
| 388 |
- progress.Message(p.config.ProgressOutput, "", "Pushing repository "+p.repoInfo.FullName()) |
|
| 389 | 388 |
// push the repository to each of the endpoints only if it does not exist. |
| 390 | 389 |
for _, endpoint := range repoData.Endpoints {
|
| 391 | 390 |
if err := p.pushImageToEndpoint(ctx, endpoint, imgList, tags, repoData); err != nil {
|
| ... | ... |
@@ -397,10 +397,12 @@ func (p *v1Pusher) pushRepository(ctx context.Context) error {
|
| 397 | 397 |
} |
| 398 | 398 |
|
| 399 | 399 |
func (p *v1Pusher) pushImage(ctx context.Context, v1Image v1Image, ep string) (checksum string, err error) {
|
| 400 |
+ l := v1Image.Layer() |
|
| 400 | 401 |
v1ID := v1Image.V1ID() |
| 402 |
+ truncID := stringid.TruncateID(l.DiffID().String()) |
|
| 401 | 403 |
|
| 402 | 404 |
jsonRaw := v1Image.Config() |
| 403 |
- progress.Update(p.config.ProgressOutput, stringid.TruncateID(v1ID), "Pushing") |
|
| 405 |
+ progress.Update(p.config.ProgressOutput, truncID, "Pushing") |
|
| 404 | 406 |
|
| 405 | 407 |
// General rule is to use ID for graph accesses and compatibilityID for |
| 406 | 408 |
// calls to session.registry() |
| ... | ... |
@@ -411,14 +413,12 @@ func (p *v1Pusher) pushImage(ctx context.Context, v1Image v1Image, ep string) (c |
| 411 | 411 |
// Send the json |
| 412 | 412 |
if err := p.session.PushImageJSONRegistry(imgData, jsonRaw, ep); err != nil {
|
| 413 | 413 |
if err == registry.ErrAlreadyExists {
|
| 414 |
- progress.Update(p.config.ProgressOutput, stringid.TruncateID(v1ID), "Image already pushed, skipping") |
|
| 414 |
+ progress.Update(p.config.ProgressOutput, truncID, "Image already pushed, skipping") |
|
| 415 | 415 |
return "", nil |
| 416 | 416 |
} |
| 417 | 417 |
return "", err |
| 418 | 418 |
} |
| 419 | 419 |
|
| 420 |
- l := v1Image.Layer() |
|
| 421 |
- |
|
| 422 | 420 |
arch, err := l.TarStream() |
| 423 | 421 |
if err != nil {
|
| 424 | 422 |
return "", err |
| ... | ... |
@@ -431,7 +431,7 @@ func (p *v1Pusher) pushImage(ctx context.Context, v1Image v1Image, ep string) (c |
| 431 | 431 |
// Send the layer |
| 432 | 432 |
logrus.Debugf("rendered layer for %s of [%d] size", v1ID, size)
|
| 433 | 433 |
|
| 434 |
- reader := progress.NewProgressReader(ioutils.NewCancelReadCloser(ctx, arch), p.config.ProgressOutput, size, stringid.TruncateID(v1ID), "Pushing") |
|
| 434 |
+ reader := progress.NewProgressReader(ioutils.NewCancelReadCloser(ctx, arch), p.config.ProgressOutput, size, truncID, "Pushing") |
|
| 435 | 435 |
defer reader.Close() |
| 436 | 436 |
|
| 437 | 437 |
checksum, checksumPayload, err := p.session.PushImageLayerRegistry(v1ID, reader, ep, jsonRaw) |
| ... | ... |
@@ -449,6 +449,6 @@ func (p *v1Pusher) pushImage(ctx context.Context, v1Image v1Image, ep string) (c |
| 449 | 449 |
logrus.Warnf("Could not set v1 ID mapping: %v", err)
|
| 450 | 450 |
} |
| 451 | 451 |
|
| 452 |
- progress.Update(p.config.ProgressOutput, stringid.TruncateID(v1ID), "Image successfully pushed") |
|
| 452 |
+ progress.Update(p.config.ProgressOutput, truncID, "Image successfully pushed") |
|
| 453 | 453 |
return imgData.Checksum, nil |
| 454 | 454 |
} |