dnephin / dobi

A build automation tool for Docker applications
https://dnephin.github.io/dobi/
Apache License 2.0
309 stars 36 forks source link

Add feature to expand environmental variables defaults to actual values of those defaults #156

Open uzakoff opened 5 years ago

uzakoff commented 5 years ago

In the documentation: https://dnephin.github.io/dobi/variables.html it says that variables can have default values. When I am building an image I would like dobi to resolve those defaults to their actual value. For example if I run b=1 dobi image/test I would like RUN echo ${evaluate} to print 1 instead of env.b, which is what happens now.

Dockerfile

FROM   alpine:3.4
ARG evaluate
RUN echo ${evaluate}  

dobi.yaml

image=image/test:
  image: myproject
  dockerfile: Dockerfile
  args:
     evaluate: "{env.a:env.b}"
Enteee commented 5 years ago

it would be nice if a default for a variable would be handled the same as a string with config variables.

Which means, for {env.a:{env.b}} with a=1; b=2: 1 with a=UNDEFINED; b=2: 2