Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: add more logging to packager2.Pull #3557

Merged
merged 2 commits into from
Mar 6, 2025
Merged

feat: add more logging to packager2.Pull #3557

merged 2 commits into from
Mar 6, 2025

Conversation

mkcp
Copy link
Contributor

@mkcp mkcp commented Mar 5, 2025

Description

Previously, Pull would only report errors to users by passing nested errors up the chain from ORAS. This focused more on internal library details than actionable user behavior. This PR is a first pass at adding debugging context with metadata and some info, error, and debug logs to packager2.Pull.

Related Issue

Checklist before merging

@mkcp mkcp requested review from a team as code owners March 5, 2025 19:48
@mkcp mkcp self-assigned this Mar 5, 2025
Copy link

netlify bot commented Mar 5, 2025

Deploy Preview for zarf-docs ready!

Name Link
🔨 Latest commit f52437b
🔍 Latest deploy log https://app.netlify.com/sites/zarf-docs/deploys/67c9ff1869b4660008df19fc
😎 Deploy Preview https://deploy-preview-3557--zarf-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@mkcp mkcp added the enhancement ✨ New feature or request label Mar 5, 2025
Copy link

codecov bot commented Mar 5, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/internal/packager2/pull.go 50.00% 4 Missing ⚠️
Files with missing lines Coverage Δ
src/internal/packager2/pull.go 34.30% <50.00%> (+0.83%) ⬆️
🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

if err != nil {
return false, "", err
}
desc, err := remote.ResolveRoot(ctx)
if err != nil {
l.Error("unable to resolve oci descriptor", "os", platform.OS, "arch", platform.Architecture, "error", err)
Copy link
Contributor

@AustinAbro321 AustinAbro321 Mar 5, 2025

Choose a reason for hiding this comment

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

The average user probably won't know what an OCI descriptor is. maybe something like "failed to pull package for platform {OS}/{ARCH}" would be more actionable.

I also think the error below is misleading. ResolveRoot is trying to get the manifest not the index.json. IMO combining this line and the below line would be the way to go for now

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 also feel like our error here is misleading, could you clarify what you mean by combining the two lines though?

Copy link
Contributor

Choose a reason for hiding this comment

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

Combining these two lines

		l.Error("unable to resolve oci descriptor", "os", platform.OS, "arch", platform.Architecture, "error", err)
		return false, "", fmt.Errorf("could not fetch images index: %w", err)

maybe something like

return false, "", fmt.Errorf("could not find package at %s with architecture %s: %w", err, src, platform.Architecture)

Leaving out the platform.OS might make sense as well since from a user perspective since it's always MultiOS for Zarf packages which feels like more of an implementation detail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's fair, definitely agreed on OS not being actionable info for users. I'll go ahead and take out the error log and we'll rely on the err log near main. Fixed in latest

Signed-off-by: Kit Patella <[email protected]>
@mkcp mkcp added this pull request to the merge queue Mar 6, 2025
Merged via the queue into main with commit 46cec01 Mar 6, 2025
26 checks passed
@mkcp mkcp deleted the improve-pull-errors branch March 6, 2025 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants