Skip to content

feat(cli): rework build / test environment handling - #33

Open
mikonse wants to merge 1 commit into
mainfrom
milo/driver-environment-tracking
Open

mikonse wants to merge 1 commit into
mainfrom
milo/driver-environment-tracking

Conversation

@mikonse

@mikonse mikonse commented Oct 3, 2026

Copy link
Copy Markdown
Member

Adds an explicit environment (env) subcommand which allows users to list and interact with existing build / test environments.

Additionally contains extensive internal refactoring to make the environment tracking and cleanup more robust.

@mikonse
mikonse force-pushed the milo/driver-environment-tracking branch from b23ef23 to 1667c27 Compare October 3, 2026 12:52
@mikonse
mikonse marked this pull request as draft October 3, 2026 13:06
@mikonse
mikonse force-pushed the milo/driver-environment-tracking branch 2 times, most recently from 1aa18de to 58e39cc Compare October 4, 2026 10:19
Adds an explicit environment (env) subcommand which allows users
to list and interact with existing build / test environments.

Additionally contains extensive internal refactoring to make the
environment tracking and cleanup more robust.
@mikonse
mikonse force-pushed the milo/driver-environment-tracking branch from 58e39cc to e17b3c1 Compare October 4, 2026 12:46
@mikonse
mikonse marked this pull request as ready for review October 4, 2026 12:46

@TheJJ TheJJ left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nice! some improvements found:

owner_pid_start INTEGER,
destroying INTEGER NOT NULL DEFAULT 0,
driver_metadata TEXT NOT NULL DEFAULT '{}'
);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

add STRICT (for all tables)

);
CREATE TABLE attachments (
id INTEGER PRIMARY KEY AUTOINCREMENT,
environment_id TEXT NOT NULL REFERENCES environments(id) ON DELETE CASCADE,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

then we need PRAGMA foreign key checks

Comment thread debian/rules.py
system_sqlite = "bundled-sqlite = []"


def use_system_sqlite() -> str:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

uuh there must be a better way, since we only want to change a feature flag. maybe feature flags can be set somehow differentlly (env? cli?)

Comment thread docs/index.md

- **Isolated builds without the setup**: `debmagic build binary` builds a `debian/`-packaged source tree in a temporary container (using LXD, Incus, Docker)
- **Fast iteration**: `--persistent`/`--incremental` reuse the environment and sync only source changes; `--shell-on-failure` and `debmagic shell` drop you right where the build broke
- **Fast iteration**: `--persistent`/`--incremental` reuse the environment and sync only source changes; a failed build prints `debmagic env shell <id>`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

you can analyze failures with devmagic env shell

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

could call this environment.rs, or just env.rs - the _cmd is weird^^

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

that file seems very verbose, maybe some better db adapter abstraction reduces the boilerplate. env management should start db transactions, then invoke functions for manipulation on the db abstraction. that separates data and env logic and hopefully helps?

cargo then pulls the deps right, as well as apt?

let config = config::Config::load(None, cli.config.as_deref())?;
env_cmd::list_environments(&config)?;
}
EnvCommands::Clean { id, force } => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we should have "rm"/"remove" for env removals (ala docker/lxd), and the clean for the automatic removals.

could oneday even be automatically removed after some time.

@@ -0,0 +1,3 @@
-- Persistence values in environments.persistent: 0 = no, 1 = always, 2 = on-failure.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

reference the conversion functions?

also sad that sqlite has no enums.

};

use anyhow::{Context, anyhow, bail};
use rusqlite::{Connection, OptionalExtension, TransactionBehavior, params};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

could we use https://docs.rs/sqlx/latest/sqlx/sqlite/index.html instead? then also the system sqlite problem could be resolved.


/// A single signing invocation: what to sign and whether to send a desktop
/// notification just before the gpg touch prompt.
pub struct SignRequest<'a> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

not used anywhere?

This branch has not been deployed

No deployments
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