spkenv / spk

A Package Manager for high velocity software environments, built on spfs.
https://spkenv.dev
Apache License 2.0
35 stars 5 forks source link

spfs command to add a layer/digest/ref/object onto current runtime stack #760

Open dcookspi opened 1 year ago

dcookspi commented 1 year ago

There doesn't seem to be an easy way for a user to run a command to add a ref/digest/layer onto the current runtime stack, without exiting the spfs environment. spfs reset lets you swap out the whole stack with a single ref, or remove upperdir edits from the runtime.

But to add one extra layer to the top of the runtime stack, you have to go through the convoluted process of:

And even then you won't have any upperdir edits you might've made from the previous environment.

spfs reset currently only takes one ref/digest. If it took a list, or a +'s list, it would be close to this - if spfs info also had an option to output a +s list of the current layers.

One flexible, fairly low-level, option would be to have a spfs command that could show the +s list for the current stack, and take a new list to allow replace the current stack wholesale. Then someone could change it to whatever they liked (while keeping any upperdir edits).

Another option, closeer to the user-level, is to have a command put a new layer on top of the stack, e.g. spfs add someref or spfs reset --add someref, that would let someone add the layer they wanted without needing to edit a +s list. We might want to consider a matching spfs remove or spfs reset --remove someref with this.

This kind of command and functionalty would also help with the example scenario in https://github.com/imageworks/spk/issues/759

rydrman commented 1 year ago

spfs reset currently only takes one ref/digest. If it took a list, or a +'s list, it would be close to this - if spfs info also had an option to output a +s list of the current layers.

Did you test this? The code uses EnvSpec as far as I can tell, which supports the + that you are talking about

rydrman commented 1 year ago

having --add/--remove to reset seems like the clearest path for this idea - though maybe we should consider language that is more clear where the layer will be added/removed from? any thoughts? Given that it's a stack I want to suggest --push/--pop but push might be a little overloaded in spfs