kaniko icon indicating copy to clipboard operation
kaniko copied to clipboard

Is there a way to populate ARG from kaniko-executor's environment?

Open f0o opened this issue 4 years ago • 12 comments

Hi,

is there a way to populate the Dockerfile's ARGs (or ENVs at this point) from the environment present at kaniko's executor build time?

I would like to avoid writing a bash-loop to generate --build-arg FOO=$FOO statements to feed these into the executor's cmdline if possible.

f0o avatar Feb 04 '20 12:02 f0o

@f0o currently there is now way. Maybe we could support it somewhere here to auto add build args from env variables. https://github.com/GoogleContainerTools/kaniko/blob/9f4fead7b52df63c28761137dd2c3a8c07bf74d5/pkg/commands/add.go#L48

tejal29 avatar May 08 '20 00:05 tejal29

+1 Also would like this to be standard behavior

wanderrful avatar Jul 06 '20 15:07 wanderrful

+1 Repeating build args for very env var is unnecessary boilerplate and can actually break things.

rafaelcanovas avatar Jul 30 '20 20:07 rafaelcanovas

I am looking for this or similar feature as well

pjaudiomv avatar Oct 27 '20 23:10 pjaudiomv

+1

rubenmartinez avatar Nov 14 '20 07:11 rubenmartinez

+1

as a temporary workaround i auto-generate those --build-arg arguments - e.g. from .env file, but would also work for system env vars:

$(grep '^[^#]' .env | sed 's/.*/--build-arg &/' | xargs)

polmabri avatar Jan 30 '21 00:01 polmabri

+1

vince-franco avatar Mar 03 '21 18:03 vince-franco

+1

ad3119 avatar Jul 20 '21 01:07 ad3119

+1

gesundes avatar Jan 14 '22 14:01 gesundes

+1

melanger avatar Sep 14 '22 10:09 melanger

Bump this

morkovka1337 avatar Sep 19 '23 14:09 morkovka1337

Bump

pablodz avatar Jan 26 '24 19:01 pablodz