GoogleContainerTools / GoogleContainerTools/skaffold
Consolidate to single style for specifying environment-style parameters (env, buildArgs)
- Dominant language
- Go
- Stars
- 15.9k
- Forks
- 1.7k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 10
Description
We have three styles of specifying environment-style variables in the `skaffold.yaml`. It's inconsistent and confusing for users (#5841).
### Map-style
Seen in Docker and Kaniko's `buildArgs`:
```
// BuildArgs are arguments passed to the docker build.
// For example: `{"key1": "value1", "key2": "value2"}`.
BuildArgs map[string]*string `yaml:"buildArgs,omitempty"`
```
The use of a pointer here allows using YAML's `null` to unset a value
```
docker:
buildArgs:
name: value
other: null
```
### Array-style
Seen in Buildpacks's `env`:
```
// Env are environment variables, in the `key=value` form, passed to the build.
// Values can use the go template syntax.
// For example: `["key1=value1", "key2=value2", "key3={{.ENV_VARIABLE}}"]`.
Env []string `yaml:"env,omitempty"`
```
### Key-Value pairs (`k8s.io/api/core/v1.EnvVar`)
Seen in Kaniko's `env`:
```
// Env are environment variables passed to the kaniko pod.
// It also accepts environment variables via the go template syntax.
// For example: `[{"name": "key1", "value": "value1"}, {"name": "key2", "value": "value2"}, {"name": "key3", "value": "'{{.ENV_VARIABLE}}'"}]`.
Env []v1.EnvVar `yaml:"env,omitempty"`
```
---
We have other fields that are in a similar state:
- Kaniko `label` is a `map[string]*string`
- Cluster's `annotations` is a `map[string]string`
Contributor guide
Assessment
This issue has not been assessed yet.