Skip to content
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

Merged
merged 6 commits into from
Jan 27, 2024
Merged

Conversation

ikeycode
Copy link
Member

Thoughts and suggestions welcome, this lands the initial pre-triggers as part of a new unified postblit 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,

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]>
@ikeycode ikeycode requested review from ermo and tarkah as code owners January 25, 2024 23:05
@ikeycode
Copy link
Member Author

For testing this PR note that shared-mime-info, glib2, gdk-pixbuf, all now contain triggers in volatile.

@ikeycode ikeycode merged commit 5bed46f into main Jan 27, 2024
2 checks passed
@ikeycode ikeycode deleted the trigger_integration branch January 27, 2024 19:33
@ikeycode
Copy link
Member Author

yolo

Comment on lines +35 to +36
triggers = { version = "0.1.0", path = "../triggers" }
container = { version = "0.1.0", path = "../container" }
Copy link
Collaborator

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!()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

Copy link
Member Author

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

Comment on lines +121 to +135
// 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 {
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants