Fortunately this error was easy enough to replicate without Helm or having to set up a local registry: just run --org (org) --buildkite-token (token) --debug -f config.yaml where config.yaml was:
pod-spec-patch:
containers:
- name: container-0
resources:
requests:
cpu: 100m
For parsing our config once the controller starts, Viper gets the first bite (pun intended), and it uses mapstructure. Immediately before the failing call (v.UnmarshalExact(...)), Viper contains something like (obtained with v.Debug()):
Viper doesn't know how to put "100m" into a resource.Quantity. resource.Quantity knows how to unmarshal itself from JSON, but neither mapstructure nor Viper call that. Instead we must alter the decode hook used by Viper from its default (that conveniently understands time.Duration strings and comma-separated lists).
Fixes #293
Fortunately this error was easy enough to replicate without Helm or having to set up a local registry:
just run --org (org) --buildkite-token (token) --debug -f config.yaml
where config.yaml was:For parsing our config once the controller starts, Viper gets the first bite (pun intended), and it uses mapstructure. Immediately before the failing call (
v.UnmarshalExact(...)
), Viper contains something like (obtained withv.Debug()
):Viper doesn't know how to put
"100m"
into aresource.Quantity
.resource.Quantity
knows how to unmarshal itself from JSON, but neither mapstructure nor Viper call that. Instead we must alter the decode hook used by Viper from its default (that conveniently understandstime.Duration
strings and comma-separated lists).