-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial inclusion of pre-activation triggers #129
Conversation
Signed-off-by: Ikey Doherty <[email protected]>
This ensures we only match to the bounds of directories and not beyond. Signed-off-by: Ikey Doherty <[email protected]>
Signed-off-by: Ikey Doherty <[email protected]>
While this certainly isn't our last iteration we now have enough pieces in to support `pre-activation` triggers in moss, powered by the new `triggers::Collection` management type with DAG-based dependency ordering and `fnmatch`-based path globbing. Signed-off-by: Ikey Doherty <[email protected]>
This is currently only tested (and supported) with stateful roots, not ephemeral. We identify all paths from our `vfs::Tree` and pump them via a `triggers::Collection` that we load from the usr tree within the yet-to-be-activated rootfs pre-triggers. Currently no UI integration work has been done, and we simply run all triggers via the `container` crate (clone-based ns) within their own isolated environment pre activation of `/usr`. Signed-off-by: Ikey Doherty <[email protected]>
Signed-off-by: Ikey Doherty <[email protected]>
For testing this PR note that |
yolo |
triggers = { version = "0.1.0", path = "../triggers" } | ||
container = { version = "0.1.0", path = "../container" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: we have local crates grouped above
} | ||
|
||
fn merge(self, other: Self) -> Self { | ||
todo!() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
never used as we load all :D
// Recollect in dependency order | ||
let built_triggers = graph | ||
.topo() | ||
.cloned() | ||
.map(|i| { | ||
self.hits | ||
.iter() | ||
.filter(move |(id, _, _)| i == *id) | ||
.collect::<Vec<_>>() | ||
}) | ||
.flatten() | ||
.collect::<Vec<_>>(); | ||
|
||
let mut runnables: BTreeMap<format::Handler, TriggerCommand> = BTreeMap::new(); | ||
for (_, hit, handler) in built_triggers { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we no longer care about dependency order when adding to runnables? format::Handler seems to be ordered basically off command name
Thoughts and suggestions welcome, this lands the initial
pre-triggers
as part of a new unifiedpostblit
process that will eventually grow to absorb tasks like os-release management.We currently have no caching mechanism, so each trigger is run fresh for each new transaction. Some scaffolding is
put in place to know which paths are involved in the fnmatch-based glob, so that in future we can capture the input hashes (CA xxhash) to "save" trigger executions.
Note this PR yields a writable
/usr
and/etc
, however the plan is to make/etc
read-only. This is currently broken and needs investigation once we have a baseline,