mikelangelo-project / capstan

Capstan, a tool for packaging and running your application on OSv.
http://osv.io/capstan/
Other
19 stars 7 forks source link

Support --env argument for `capstan package compose` command #35

Closed miha-plesko closed 7 years ago

miha-plesko commented 7 years ago

Similarly as it's already implemented for capstan run we want to be able to accept environment variables here. We need this when we want to compose unikernel with specific bootcmd and run it elsewhere (e.g. on openstack).

To support such functionality we do a little refactoring. There were too many flags walking around the code and with the refactoring we encapsulate them into a struct named SimpleBootOptions. This way we centralize work related to building boot command. Having this done, it was simple to support --env also for package compose command.

The effect is as follows:

# BEFORE
# We couldn't use --boot flag if we wanted to set environment variables
$ capstan package compose demo --run "--env=MASTER=172.16.122.3:7077 runscript /run/worker"

# NOW
# We can use --boot flag and enrich it with --env flag
$ capstan package compose demo --boot worker --env MASTER=172.16.122.3:7077
miha-plesko commented 7 years ago

@gberginc this PR might be somewhat more cumbersome to review since there is refactoring involved. Please let me know if you will need any help/explanation.

gberginc commented 7 years ago

@miha-plesko I see a lot of changes, so it should be farily easy right?

:smile:

miha-plesko commented 7 years ago

Oh, it's not even in conflict with master, I expected some problems after merging https://github.com/mikelangelo-project/capstan/pull/34. Everything is possible on Fridays :)

gberginc commented 7 years ago

Everything is awesome :).

Squash please and we are GTG.

miha-plesko commented 7 years ago

Everything is awesome and squashed :)