docs: documentation for `buildEnv` (#592)

* Doc for func.yaml's buildEnv

* Update docs/guides/func_yaml.md

Co-authored-by: Zbynek Roubalik <726523+zroubalik@users.noreply.github.com>

Co-authored-by: Zbynek Roubalik <726523+zroubalik@users.noreply.github.com>
This commit is contained in:
Preetham 2021-10-25 18:28:38 +05:30 committed by GitHub
parent f161d50084
commit 9b01368418
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 0 deletions

View File

@ -28,6 +28,26 @@ field will contain all of the available builders for a given runtime. Although
it's typically unnecessary to modify the `builder` field, using values from
`builders` is OK.
### `buildEnvs`
This field allows you to set environment variables available to the builder/buildpack that builds the function. This environment variable is NOT set at runtime, use [envs](#envs) instead
1. Environment variable can be set directly from a value
2. Environment variable can be set from a local environment value. Eg. `'{{ env:LOCAL_ENV_VALUE }}'`, for more details see [Local Environment Variables section](#local-environment-variables).
```yaml
buildEnvs:
- name: EXAMPLE1 # (1) env variable directly from a value
value: value
- name: EXAMPLE2 # (2) env variable from a local environment value
value: '{{ env:LOCAL_ENV_VALUE }}'
```
For example, the below `func.yaml` snippet modifies the default Golang buildpack to build source code with 1.15 compiler version. Refer to respective buildpack documentation to know more about environment variables that modify behavior of the `func build`.
```yaml
buildEnvs:
- name: BP_GO_VERSION
value: '1.15'
```
### `envs`
The `envs` field allows you to set environment variables that will be