Skip to content

feat: add more logging to packager2.Pull#3557

Merged
mkcp merged 2 commits intomainfrom
improve-pull-errors
Mar 6, 2025
Merged

feat: add more logging to packager2.Pull#3557
mkcp merged 2 commits intomainfrom
improve-pull-errors

Conversation

@mkcp
Copy link
Copy Markdown
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

Signed-off-by: Kit Patella <kit@defenseunicorns.com>
@mkcp mkcp requested review from a team as code owners March 5, 2025 19:48
@mkcp mkcp self-assigned this Mar 5, 2025
@netlify
Copy link
Copy Markdown

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
@mkcp mkcp added this to Zarf Mar 5, 2025
@mkcp mkcp moved this to Ready to merge in Zarf Mar 5, 2025
@mkcp mkcp moved this from Ready to merge to In review in Zarf Mar 5, 2025
@codecov
Copy link
Copy Markdown

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.

Comment thread src/internal/packager2/pull.go Outdated
Comment thread src/internal/packager2/pull.go Outdated
}
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
Copy Markdown
Member

@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
Copy Markdown
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
Copy Markdown
Member

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
Copy Markdown
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

Comment thread src/internal/packager2/pull.go Outdated
Signed-off-by: Kit Patella <kit@defenseunicorns.com>
@github-project-automation github-project-automation Bot moved this from In review to Ready to merge in Zarf Mar 6, 2025
@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
@mkcp mkcp deleted the improve-pull-errors branch March 6, 2025 21:25
@github-project-automation github-project-automation Bot moved this from Ready to merge to Done in Zarf Mar 6, 2025
nevinaragam pushed a commit to nevinaragam/zarf that referenced this pull request May 20, 2025
Signed-off-by: Kit Patella <kit@defenseunicorns.com>
Signed-off-by: NevinAragam <nevin.aragam@gmail.com>
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