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

Improve error message when Zarf can't pull container images when creating a package #25

Closed
RothAndrew opened this issue Sep 7, 2021 · 8 comments
Labels

Comments

@RothAndrew
Copy link
Contributor

What I expected:

As a user of Zarf I want it to give me a simple and descriptive error message when it isn't able to pull container images when creating a package, so that I don't have to track down what my issue is.

What I saw:

In this case it was because registry1.dso.mil was down for a few minutes, but I've also seen this error message when I don't have my credentials for the container registry set properly

 - https://repo1.dso.mil/platform-one/big-bang/apps/core/[email protected]
 - https://repo1.dso.mil/platform-one/big-bang/apps/core/[email protected]
 - https://repo1.dso.mil/platform-one/big-bang/apps/core/[email protected]
 - https://repo1.dso.mil/platform-one/big-bang/apps/security-tools/[email protected]


INFO[0000] Create Zarf package confirmed
INFO[0000] Loading images for local install
INFO[0000] Loading images
INFO[0000] Fetching image metadata                       image="registry1.dso.mil/ironbank/fluxcd/helm-controller:v0.11.0"
WARN[0030] Unable to pull the image                      image="registry1.dso.mil/ironbank/fluxcd/helm-controller:v0.11.0"
INFO[0030] Fetching image metadata                       image="registry1.dso.mil/ironbank/fluxcd/kustomize-controller:v0.13.0"
WARN[0060] Unable to pull the image                      image="registry1.dso.mil/ironbank/fluxcd/kustomize-controller:v0.13.0"
INFO[0060] Fetching image metadata                       image="registry1.dso.mil/ironbank/fluxcd/notification-controller:v0.15.0"
WARN[0091] Unable to pull the image                      image="registry1.dso.mil/ironbank/fluxcd/notification-controller:v0.15.0"
INFO[0091] Fetching image metadata                       image="registry1.dso.mil/ironbank/fluxcd/source-controller:v0.14.0"
WARN[0121] Unable to pull the image                      image="registry1.dso.mil/ironbank/fluxcd/source-controller:v0.14.0"
INFO[0121] Creating image tarball (this will take a while)
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x5a43bf2]

goroutine 1 [running]:
github.com/google/go-containerregistry/pkg/v1/cache.(*image).ConfigName(0xc0004383c0, 0xc0007335c0, 0xc000d1e9e8, 0xc000843d40, 0xc000d1e8a8, 0x42465ff, 0x0)
	<autogenerated>:1 +0x32
github.com/google/go-containerregistry/pkg/v1/tarball.calculateManifest(0xc000d1ecc8, 0x0, 0x0, 0x0, 0x8, 0xc0001140b0)
	/Users/andrewroth/.asdf/installs/golang/1.16.7/packages/pkg/mod/github.com/google/[email protected]/pkg/v1/tarball/write.go:230 +0x143
github.com/google/go-containerregistry/pkg/v1/tarball.getSizeAndManifest(0xc000d1ecc8, 0xc0001140b0, 0xc0001140a8, 0x0, 0x0, 0x70, 0xc000d1ebd0, 0x0, 0x0, 0xc000d1ebe8)
	/Users/andrewroth/.asdf/installs/golang/1.16.7/packages/pkg/mod/github.com/google/[email protected]/pkg/v1/tarball/write.go:298 +0x32
github.com/google/go-containerregistry/pkg/v1/tarball.MultiRefWrite(0xc000d1ecc8, 0x626f940, 0xc0001140a8, 0x0, 0x0, 0x0, 0x0, 0xc000d1edeb)
	/Users/andrewroth/.asdf/installs/golang/1.16.7/packages/pkg/mod/github.com/google/[email protected]/pkg/v1/tarball/write.go:101 +0xc5
github.com/google/go-containerregistry/pkg/v1/tarball.MultiRefWriteToFile(0xc00043c500, 0x50, 0xc000d1ecc8, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/andrewroth/.asdf/installs/golang/1.16.7/packages/pkg/mod/github.com/google/[email protected]/pkg/v1/tarball/write.go:64 +0xf2
github.com/google/go-containerregistry/pkg/v1/tarball.MultiWriteToFile(0xc00043c500, 0x50, 0xc000d1efd8, 0x0, 0x0, 0x0, 0xc000754690, 0x0)
	/Users/andrewroth/.asdf/installs/golang/1.16.7/packages/pkg/mod/github.com/google/[email protected]/pkg/v1/tarball/write.go:52 +0x2cb
github.com/google/go-containerregistry/pkg/crane.MultiSave(0xc000d1f5a0, 0xc00043c500, 0x50, 0x1, 0x1)
	/Users/andrewroth/.asdf/installs/golang/1.16.7/packages/pkg/mod/github.com/google/[email protected]/pkg/crane/pull.go:77 +0x66b
repo1.dso.mil/platform-one/big-bang/apps/product-tools/zarf/cli/internal/images.PullAll(0xc00059d840, 0x4, 0x4, 0xc00043c500, 0x50)
	/Users/andrewroth/src/repo1.dso.mil/platform-one/big-bang/apps/product-tools/zarf/cli/internal/images/pull.go:29 +0x435
repo1.dso.mil/platform-one/big-bang/apps/product-tools/zarf/cli/internal/packager.addLocalAssets(0xc0006a76c0, 0x3f, 0xc00043c280, 0x44, 0xc00043c320, 0x45, 0xc00043c410, 0x46, 0xc00043c500, 0x50, ...)
	/Users/andrewroth/src/repo1.dso.mil/platform-one/big-bang/apps/product-tools/zarf/cli/internal/packager/create.go:125 +0x42a
repo1.dso.mil/platform-one/big-bang/apps/product-tools/zarf/cli/internal/packager.Create(0x1)
	/Users/andrewroth/src/repo1.dso.mil/platform-one/big-bang/apps/product-tools/zarf/cli/internal/packager/create.go:37 +0x3fd
repo1.dso.mil/platform-one/big-bang/apps/product-tools/zarf/cli/cmd.glob..func3(0x726ca20, 0xc000699dd0, 0x0, 0x1)
	/Users/andrewroth/src/repo1.dso.mil/platform-one/big-bang/apps/product-tools/zarf/cli/cmd/package.go:24 +0x2c
github.com/spf13/cobra.(*Command).execute(0x726ca20, 0xc000699db0, 0x1, 0x1, 0x726ca20, 0xc000699db0)
	/Users/andrewroth/.asdf/installs/golang/1.16.7/packages/pkg/mod/github.com/spf13/[email protected]/command.go:860 +0x2c2
github.com/spf13/cobra.(*Command).ExecuteC(0x726b620, 0xc000010020, 0xc000bbff58, 0x1)
	/Users/andrewroth/.asdf/installs/golang/1.16.7/packages/pkg/mod/github.com/spf13/[email protected]/command.go:974 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/andrewroth/.asdf/installs/golang/1.16.7/packages/pkg/mod/github.com/spf13/[email protected]/command.go:902
repo1.dso.mil/platform-one/big-bang/apps/product-tools/zarf/cli/cmd.Execute()
	/Users/andrewroth/src/repo1.dso.mil/platform-one/big-bang/apps/product-tools/zarf/cli/cmd/root.go:34 +0xa5
main.main()
	/Users/andrewroth/src/repo1.dso.mil/platform-one/big-bang/apps/product-tools/zarf/cli/main.go:8 +0x25

Migrated from https://repo1.dso.mil/platform-one/big-bang/apps/product-tools/zarf/-/issues/39

@jeff-mccoy
Copy link
Contributor

#3 is related to user feedback of image actions as well

@jeff-mccoy jeff-mccoy added the enhancement ✨ New feature or request label Sep 16, 2021
@YrrepNoj
Copy link
Contributor

YrrepNoj commented Nov 8, 2021

Is there a specific reason why being unable to pull the image only a warning? After logging the warning I don't see anything that looks like attempted error recovery. If we do a fatal log instead of warn it will be more immediately obvious what broke.

@jeff-mccoy
Copy link
Contributor

The fatal isn’t the issue here, this is crashing within crane not our code, we need a cleaner way to instrument crane or just replace it.

@YrrepNoj
Copy link
Contributor

YrrepNoj commented Nov 8, 2021

I think I must be missing something then. It looks to me like crane is crashing because the imageMap gets populated with a nil pointer if we're unable to pull the image from crane.Pull.

If the goal is improving the error message, I think logging a fatal message there would make sense.

@jeff-mccoy
Copy link
Contributor

Tbh I haven’t debugged this myself yet, but believe that if either 1. The registry is down or 2. The user doesn’t have creds for that registry. But both of those conditions aren’t directly sent to crane by zarf, crane is reading those states on its own.

@RothAndrew
Copy link
Contributor Author

@jeff-mccoy @YrrepNoj do you know what this looks like now in #237? I can go test it myself of course, just wanted to see if you already knew whether this is still an issue or is mostly resolved in #237

@jeff-mccoy
Copy link
Contributor

I actually don't recall sorry

@jeff-mccoy
Copy link
Contributor

I think this can be closed. The current design of the CLI gives generic errors across the board for failures that are much cleaner, but to get more details you can run with debug or trace. This was introduced in #237. I think we can discuss changing that broader approach in another issue if it is warranted.

Screen Shot 2022-02-08 at 11 07 27 PM

Screen Shot 2022-02-08 at 11 09 14 PM

Screen Shot 2022-02-08 at 11 09 27 PM

Repository owner moved this from Planned to Done in Zarf Project Board Feb 9, 2022
@Racer159 Racer159 moved this to Done in Zarf Project Board Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants