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

Fix panic in Check function #462

Merged
merged 3 commits into from
Jan 20, 2023
Merged

Fix panic in Check function #462

merged 3 commits into from
Jan 20, 2023

Conversation

guineveresaenger
Copy link
Contributor

When the build field is unset entirely, the Check function was
panicking attempting to set the implicit contextDigest field.
This PR properly constructs the inputs["build"] field as a
resource.NewObjectProperty.

When the `build` field is unset entirely, the Check function was
panicking attempting to set the implicit `contextDigest` field.
This PR properly constructs the `inputs["build"]` field as a
`resource.NewObjectProperty`.
@guineveresaenger guineveresaenger requested a review from a team January 20, 2023 17:53
@@ -125,7 +125,10 @@ func (p *dockerNativeProvider) Check(ctx context.Context, req *rpc.CheckRequest)
}

// add implicit resource to provider
inputs["build"].ObjectValue()["contextDigest"] = resource.NewStringProperty(contextDigest)
inputs["build"] = resource.NewObjectProperty(resource.PropertyMap{
Copy link
Contributor

Choose a reason for hiding this comment

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

This would replace inputs["build"] if the user set it - are we overriding anything the user would input?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

d'oh!

Added a null check condition.

@github-actions
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

@github-actions
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

@github-actions
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

@guineveresaenger guineveresaenger merged commit 842da37 into master Jan 20, 2023
@guineveresaenger guineveresaenger deleted the check-panic-fix branch January 20, 2023 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants