Porch returns a generic error when Kptfile validation fails on render
Porch always returns a generic error when a Kptfile validator function fails on render.
Expected behavior
Porch should return the fail message of the validator.
Actual behavior
Porch returns the following error regardless of the fail message of the validator
Error: Internal error occurred: fn.render: pkg .:
pkg.render:
pipeline.run: error: function failure
Information
Both Porch and the CLI are on https://github.com/GoogleContainerTools/kpt/tree/208b4c422c85ff6da4cb4c2b9755f0a23a1329c6.
Steps to reproduce the behavior
-
Create a simple Kpt package using
kpt alpha rpkg init -
Use
kpt alpha rpkg pullto save package to local filesystem -
Add a simple StarlarkRun validation resource to the package
apiVersion: fn.kpt.dev/v1alpha1
kind: StarlarkRun
metadata:
name: validate
annotations:
config.kubernetes.io/local-config: "true"
source: |-
fail("Validation always fails")
- Update Kptfile to reference StarlarkRun resource
pipeline:
validators:
- image: gcr.io/kpt-fn/starlark:v0.4.3
configPath: validate.yaml
- Using
kpt fn renderthe expected error message returns
Package "this-package":
[RUNNING] "gcr.io/kpt-fn/starlark:v0.4.3"
[FAIL] "gcr.io/kpt-fn/starlark:v0.4.3" in 4.4s
Results:
[error]: fail: Validation always fails
Stderr:
"failed to evaluate function: error: function failure"
Exit code: 1
- Using
kpt alpha rpkg pushto push the package to Porch the generic error message is returned
Error: Internal error occurred: fn.render: pkg .:
pkg.render:
pipeline.run: error: function failure
https://github.com/GoogleContainerTools/kpt/pull/3451 will surface the validation error. Do you mind taking a quick look to see if the format of the returned error works for you?
Per offline discussion, @droot will be taking over this by surfacing the function results in the API.