Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Improved logging for store copy / Updated store info to handle multi-arch images #146

Merged
merged 2 commits into from
Dec 14, 2023

Conversation

amartin120
Copy link
Contributor

@amartin120 amartin120 commented Dec 14, 2023

Please check below, if the PR fulfills these requirements:

  • The commit message follows the guidelines.
  • Tests for the changes have been added (for bug fixes / features).
  • Docs have been added / updated (for bug fixes / features).

What kind of change does this PR introduce?

  • Improved logging for store copy
  • Updated store info to handle multi-arch images

What is the current behavior?

  • hauler store copy provides no incremental feedback.
  • hauler store info is missing data for the majority of images.

What is the new behavior (if this is a feature change)?

  • hauler store copy provides better logging.
❯ ./bin/hauler store copy registry://your.registry.com                                                                                                                                                                                                              
11:31AM INF carbide/k3s-docs:0.1.2
11:31AM INF rancher/mirrored-library-traefik:2.9.1
11:31AM INF hauler/sha256sum-amd64.txt:latest
11:31AM INF carbide/heimdall2:0.1.1
11:31AM INF carbide/carbide-whitelabel:0.1.1
11:31AM INF rancher/hardened-calico:v3.26.1-build20230802
11:31AM INF carbide/stigatron-hook:0.2.0
11:31AM INF copied artifacts to [your.registry.com]
  • hauler store info now handles multi-arch images.

image

Does this PR introduce a breaking change?

  • No

Other information:

Signed-off-by: Adam Martin <adam.martin@rancherfederal.com>
Signed-off-by: Adam Martin <adam.martin@rancherfederal.com>
@@ -4,8 +4,9 @@ import (
"context"
"encoding/json"
"fmt"
"strings"
"text/tabwriter"
"github.com/olekukonko/tablewriter"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MIT license, okay good.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a fan of his tablewriter. I've used it in a few projects now.

if i != emptyItem {
items = append(items, i)
// handle multi-arch images
if desc.MediaType == consts.OCIImageIndexSchema || desc.MediaType == consts.DockerManifestListSchema2 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagine that these media type comparisons/checks will be with us for some years. I wonder if longer term than this particular change-set if it makes sense to unify them conceptually? i.e. for this one, possibly something like hauler.IsImageIndex() / hauler.IsImageShema()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that idea.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea isn't for saving characters/lines of code so much as conceptual concision.

@amartin120 amartin120 merged commit 7751b12 into hauler-dev:main Dec 14, 2023
1 check passed
@amartin120 amartin120 deleted the more-updates-0.4.1 branch February 16, 2024 15:45
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants