GoogleContainerTools / GoogleContainerTools/skaffold

Skaffold evaluates Buildpack env vars differently from buildpack documentation

Open
#8,943 0 comments 0 reactions 0 assignees View on GitHub
kind/bug
Dominant language
Go
Stars
15.9k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

https://github.com/GoogleContainerTools/skaffold/blob/453b101d70ccbf75c98f945516589950c87f63a0/pkg/skaffold/build/buildpacks/lifecycle.go#L71-L75

https://github.com/GoogleContainerTools/skaffold/blob/453b101d70ccbf75c98f945516589950c87f63a0/pkg/skaffold/build/buildpacks/env.go#L58-L60
^^^ This code overwrites runtime env (from skaffold.yaml) with project.toml's ones. And should be vice versa.

Given `project.toml` like this:
```toml
[[build.env]]
name = 'BPE_DEFAULT_PORT'
value = '8080'
```

and `skaffold.yaml` with build section like this:
```yaml
apiVersion: skaffold/v4beta4
kind: Config
metadata:
name: api
build:
artifacts:
- image: api
buildpacks:
env:
- BPE_DEFAULT_PORT='9999'
```

It will execute buildpack with `BPE_DEFAULT_PORT=8080` while [buildpack documentation](https://buildpacks.io/docs/app-developer-guide/environment-variables/) says that runtime env vars take precedence over `project.toml`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.