rancher / elemental-toolkit

:snowflake: The toolkit to build, ship and maintain cloud-init driven Linux derivatives based on container images
https://rancher.github.io/elemental-toolkit/docs/
Apache License 2.0
288 stars 49 forks source link

Prevent use of --force argument when initing from container #2064

Open anmazzotti opened 3 months ago

anmazzotti commented 3 months ago

Is your feature request related to a problem? Please describe.

When building a derivative image and invoking elemental init, I always have to use --force. I wonder if this could be separated to a dedicated flag, like --allow-init-from-container for this specific case, so that --force can be omitted and used to make the build fail or pass due to warnings.

Describe the solution you'd like

As an example of this use case, considering the file overwriting issue, I would like warnings to be a failure reason to elemental init, with the ability of suppressing them using --force when needed.

frelon commented 3 months ago

How are you building the images? docker build should put the /.dockerenv file that we check for in elemental init, so if that file exists you don't actually need to pass the --force flag.