Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Add configuration for Python buildpack to define package to scan and which function to load #63

Closed
andrew-su opened this issue May 5, 2022 · 5 comments · Fixed by #64
Assignees

Comments

@andrew-su
Copy link
Contributor

andrew-su commented May 5, 2022

Feature Request

The Python buildpack expects two environment variables MODULE_NAME and FUNCTION_NAME.

Proposed configuration values:
BP_FUNCTION: The name of the function to look for. Default: func.main

Alternatively we can instead do:
BP_FUNCTION_MODULE
BP_FUNCTION_NAME

@joeeltgroth
Copy link
Contributor

I tried the following commands to generate a function with kn func create and kn func build with functions-builder:0.0.10:

rm -rf pr64 && mkdir pr64 && cd pr64 && kn func create -l python
Created python Function in /Users/jeltgroth/junk/pr64

kn func build -b ghcr.io/vmware-tanzu/function-buildpacks-for-knative/functions-builder:0.0.10

The build failed with five sets of errors like this:
...
[detector] Java Function Buildpack 0.0.7
[detector] parsing function config: 'func.yaml' config file is not valid:
[detector] line 1: field version is not valid
[detector] line 5: field registry is not valid
[detector] line 8: field build is not valid
[detector] line 9: field git is not valid
[detector] line 23: field created is not valid
[detector] line 24: field invocation is not valid
[detector] err: kn-fn/[email protected] (1)
[detector] ERROR: No buildpack groups passed detection.
[detector] ERROR: failed to detect: buildpack(s) failed with err

@andrew-su
Copy link
Contributor Author

Hey Joe,

This is related to: #55

The version of func cli/plugin is newer than the version being used as dependency (0.19).

@joeeltgroth
Copy link
Contributor

Hi Andrew,
We can't seem to get any of the 3 BP_ variables to work. Also, BP_FUNCTION_MODULE and BP_FUNCTION_NAME aren't on the branch suan/update-python-buildpack. Thoughts?

@andrew-su
Copy link
Contributor Author

To set the configuration on the buildpack it's set through the pack cli with --env BP_FUNCTION=func.main. For the PR I only added BP_FUNCTION

@joeeltgroth
Copy link
Contributor

I was running into function not found when building because I'd created the function using kn func create -l python, but in order to use our template we need to create the function using kn func create -l python -r https://github.com/vmware-tanzu/function-buildpacks-for-knative

@bbtong bbtong closed this as completed in #64 Jun 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants