Skip to content

Error logs lost in processLogLine #1268

@t0yv0

Description

@t0yv0

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting-feedbackBlocked on input from the authorimpact/usabilitySomething that impacts users' ability to use the product easily and intuitivelykind/bugSome behavior is incorrect or out of spec

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions