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

Error logs lost in processLogLine #1268

Open
t0yv0 opened this issue Nov 4, 2024 · 0 comments
Open

Error logs lost in processLogLine #1268

t0yv0 opened this issue Nov 4, 2024 · 0 comments
Labels
impact/usability Something that impacts users' ability to use the product easily and intuitively kind/bug Some behavior is incorrect or out of spec

Comments

@t0yv0
Copy link
Member

t0yv0 commented Nov 4, 2024

Describe what happened

I am tracing a problem reported in pulumi/pulumi-awsx#1401 - it appears that in the case of a docker image build failure, not all log output is returned to the Pulumi user, making the troubleshooting experience extra difficult.

Tracing the code, I believe there is something that might be at play here, namely when processing buildkit output with processLogLine the code errors out too early on the first error, instead of logging every line.

func (p *dockerNativeProvider) runImageBuild(
	err = p.processLog(ctx, urn, imgBuildResp.Body, extractImageID)
...

func (p *dockerNativeProvider) processLog
		msg, err := processLogLine(jm, onAuxMessage)

...

func processLogLine(jm jsonmessage.JSONMessage,
	onAuxMessage func(json.RawMessage) (bool, string, error),
) string {
	var info string
	if jm.Error != nil {
		if jm.Error.Code == 401 {
			return "", fmt.Errorf("authentication is required")
		}
		if jm.Error.Message == "EOF" {
			return "", fmt.Errorf("%s\n: This error is most likely due to incorrect or mismatched registry "+
				"credentials. Please double check you are using the correct credentials and registry name.",
				jm.Error.Message)
		}
		return "", fmt.Errorf("%s", jm.Error.Message)
	}

I think we might be hitting the return "", fmt.Errorf("%s", jm.Error.Message) case.

Sample program

See pulumi/pulumi-awsx#1401.

Log output

N/A

Affected Resource(s)

docker.Image and awsx.ecr.Image

Output of pulumi about

CLI          
Version      3.130.0
Go Version   go1.22.6
Go Compiler  gc

Plugins
KIND      NAME    VERSION
resource  aws     6.57.0
resource  awsx    2.16.1
resource  docker  4.5.7
resource  docker  3.6.1
language  nodejs  unknown

Host     
OS       darwin
Version  14.6.1
Arch     arm64

This project is written in nodejs: executable='/Users/anton/bin/node' version='v18.18.2'

Current Stack: anton-pulumi-corp/ecr/dev1

TYPE                                     URN
pulumi:pulumi:Stack                      urn:pulumi:dev1::ecr::pulumi:pulumi:Stack::ecr-dev1
pulumi:providers:awsx                    urn:pulumi:dev1::ecr::pulumi:providers:awsx::default_2_16_1
awsx:ecr:Repository                      urn:pulumi:dev1::ecr::awsx:ecr:Repository::repository
pulumi:providers:aws                     urn:pulumi:dev1::ecr::pulumi:providers:aws::default_6_47_0
aws:ecr/repository:Repository            urn:pulumi:dev1::ecr::awsx:ecr:Repository$aws:ecr/repository:Repository::repository
aws:ecr/lifecyclePolicy:LifecyclePolicy  urn:pulumi:dev1::ecr::awsx:ecr:Repository$aws:ecr/lifecyclePolicy:LifecyclePolicy::repository
pulumi:providers:pulumi                  urn:pulumi:dev1::ecr::pulumi:providers:pulumi::default
awsx:ecr:Image                           urn:pulumi:dev1::ecr::awsx:ecr:Image::image
pulumi:providers:docker                  urn:pulumi:dev1::ecr::pulumi:providers:docker::default_4_5_1
docker:index/image:Image                 urn:pulumi:dev1::ecr::awsx:ecr:Image$docker:index/image:Image::f8fd5a8b-container


Found no pending operations associated with dev1

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/anton-pulumi-corp
User           anton-pulumi-corp
Organizations  anton-pulumi-corp, moolumi, demo, pulumi
Token type     personal

Dependencies:
NAME            VERSION
@pulumi/pulumi  3.137.0
@types/node     18.19.64
@pulumi/aws     6.57.0

Pulumi locates its logs in /var/folders/gd/3ncjb1lj5ljgk8xl5ssn_gvc0000gn/T/com.apple.shortcuts.mac-helper// by default

Additional context

N/A

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@t0yv0 t0yv0 added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Nov 4, 2024
@blampe blampe added impact/usability Something that impacts users' ability to use the product easily and intuitively and removed needs-triage Needs attention from the triage team labels Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/usability Something that impacts users' ability to use the product easily and intuitively kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

2 participants