I’m trying out the jsonnet feature by converting an existing yaml and so far so good, however I have an issue – I’m reusing some function in a monorepo and I have this:
local DockerRepoSettings(name, dockerfile, context=null, build_args=[]) = {
repo: 'xxx/' + name,
registry: 'xxxx',
username: 'xxx',
password: 'xxxxx,
context: if context != null then context else name,
dockerfile: dockerfile,
build_args: build_args,
};
and in step:
{
name: 'build-and-push',
image: 'plugins/docker',
settings: DockerRepoSettings(name='xxx', dockerfile='xxx/Dockerfile'),
},
so when build_args
is not specified I expect it to be an empty array and get ignored by plugins/docker, however:
usr/local/bin/docker build --rm=true -f xxx/Dockerfile -t 118f8043074a8d82c2cb2dcd6044009b5149e1e1 xxx --pull=true --build-arg --label org.opencontainers.image.created=2022-04-30T00:01:21Z ...
resulting in:
invalid argument "" for "--build-arg" flag: invalid environment variable:
See 'docker build --help'.
exit status 125
I tried some other syntax but it seems I cannot skip the --build-arg
docker argument if array is empty.
any tips?