refactor: keep recordings on an orphan branch
This commit is contained in:
1 parent
d4bd3b4b76
commit
daaad6771f
9 files changed
+80
-13
No files matched your search
@@ -1,2 +1,3 @@
|
|||||||
target
|
target
|
||||||
result*
|
result*
|
||||||
|
/recordings/
|
||||||
@@ -9,7 +9,7 @@ I started bootvine out of frustration with the boot screen of most Linux
|
|||||||
distributions: a wall of log lines scrolling past too fast to read, which never
|
distributions: a wall of log lines scrolling past too fast to read, which never
|
||||||
gave me any idea of what was going on.
|
gave me any idea of what was going on.
|
||||||
|
|
||||||
<img src="https://codeberg.org/wvhulle/bootvine/raw/branch/main/recordings/boot.gif" width="691" alt="A boot through the initrd into stage 2, with one failed unit">
|
<img src="https://codeberg.org/wvhulle/bootvine/raw/branch/recordings/boot.gif" width="691" alt="A boot through the initrd into stage 2, with one failed unit">
|
||||||
|
|
||||||
It also follows shutdowns, answers passphrase prompts such as a
|
It also follows shutdowns, answers passphrase prompts such as a
|
||||||
[LUKS](https://gitlab.com/cryptsetup/cryptsetup) unlock in place, and shows why
|
[LUKS](https://gitlab.com/cryptsetup/cryptsetup) unlock in place, and shows why
|
||||||
|
|||||||
+5
-1
@@ -9,7 +9,7 @@
|
|||||||
| `xtask/` | repository tasks run with `cargo xtask` |
|
| `xtask/` | repository tasks run with `cargo xtask` |
|
||||||
| `vm-tests/` | the sample NixOS machines, one folder each with its VM check |
|
| `vm-tests/` | the sample NixOS machines, one folder each with its VM check |
|
||||||
| `nix/` | the crane builds and the NixOS module |
|
| `nix/` | the crane builds and the NixOS module |
|
||||||
| `recordings/` | the scripted demo GIFs and the sample machine WebP recordings the README and the [guide](guide.md) show |
|
| `recordings/` | ignored output of `record-screencasts`: the scripted demo GIFs and the sample machine WebP recordings, published on the `recordings` branch for the README and the [guide](guide.md) |
|
||||||
|
|
||||||
`cargo build` and `cargo test` act on every crate. `cargo run` needs the binary:
|
`cargo build` and `cargo test` act on every crate. `cargo run` needs the binary:
|
||||||
`--bin bootvine`, `--bin scripted-boot` and so on.
|
`--bin bootvine`, `--bin scripted-boot` and so on.
|
||||||
@@ -109,6 +109,10 @@ exports libraries that clash with [QEMU](https://www.qemu.org) or Chromium.
|
|||||||
- `nix run .#record-screencasts` re-records the animations from the scripted
|
- `nix run .#record-screencasts` re-records the animations from the scripted
|
||||||
demos and turns the frames each VM check captured into
|
demos and turns the frames each VM check captured into
|
||||||
`recordings/<machine>.webp`, for the README and the [guide](guide.md).
|
`recordings/<machine>.webp`, for the README and the [guide](guide.md).
|
||||||
|
- `nix run .#publish-recordings` force-pushes `recordings/` as the single,
|
||||||
|
parentless commit of the `recordings` branch, which the README and the guide
|
||||||
|
link to. Keeping the recordings off `main` keeps them out of every clone and
|
||||||
|
flake fetch.
|
||||||
- `cargo xtask sync-default-config` rewrites the defaults block in
|
- `cargo xtask sync-default-config` rewrites the defaults block in
|
||||||
[configuration](configuration.md#defaults) from `bootvine defaults`.
|
[configuration](configuration.md#defaults) from `bootvine defaults`.
|
||||||
- `cargo run --bin bootvine -- install --destdir <dir> --initrd dracut` stages an install
|
- `cargo run --bin bootvine -- install --destdir <dir> --initrd dracut` stages an install
|
||||||
|
|||||||
+7
-7
@@ -7,7 +7,7 @@ by their [VM checks](development.md#testing).
|
|||||||
|
|
||||||
## Reading the screen
|
## Reading the screen
|
||||||
|
|
||||||
<img src="../recordings/boot.gif" width="691" alt="A boot through the initrd into stage 2, with one failed unit">
|
<img src="https://codeberg.org/wvhulle/bootvine/raw/branch/recordings/boot.gif" width="691" alt="A boot through the initrd into stage 2, with one failed unit">
|
||||||
|
|
||||||
From top to bottom:
|
From top to bottom:
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ From top to bottom:
|
|||||||
|
|
||||||
## Booting through the initrd
|
## Booting through the initrd
|
||||||
|
|
||||||
<img src="../recordings/slow-services.webp" width="640" alt="A NixOS machine booting through the initrd into stage 2, handing over to a greetd login, then powering off">
|
<img src="https://codeberg.org/wvhulle/bootvine/raw/branch/recordings/slow-services.webp" width="640" alt="A NixOS machine booting through the initrd into stage 2, handing over to a greetd login, then powering off">
|
||||||
|
|
||||||
The `slow-services` machine boots with a held hardware probe in the initrd,
|
The `slow-services` machine boots with a held hardware probe in the initrd,
|
||||||
slow units in stage 2 and one failing unit, hands over to its greetd login
|
slow units in stage 2 and one failing unit, hands over to its greetd login
|
||||||
@@ -69,7 +69,7 @@ How bootvine gets in that early and survives the switch is in
|
|||||||
|
|
||||||
### Without a display manager
|
### Without a display manager
|
||||||
|
|
||||||
<img src="../recordings/text-console.webp" width="640" alt="The same boot on a machine without a display manager, ending at a text login">
|
<img src="https://codeberg.org/wvhulle/bootvine/raw/branch/recordings/text-console.webp" width="640" alt="The same boot on a machine without a display manager, ending at a text login">
|
||||||
|
|
||||||
The `text-console` machine boots the same units without greetd. With no
|
The `text-console` machine boots the same units without greetd. With no
|
||||||
display manager to wait for, bootvine hands the console back as soon as the
|
display manager to wait for, bootvine hands the console back as soon as the
|
||||||
@@ -77,7 +77,7 @@ default target is reached, and the text login on `tty1` comes forward.
|
|||||||
|
|
||||||
### Without a systemd initrd
|
### Without a systemd initrd
|
||||||
|
|
||||||
<img src="../recordings/scripted-initrd.webp" width="640" alt="The same boot with NixOS's scripted initrd: the kernel and initrd lines scroll past before bootvine starts in stage 2">
|
<img src="https://codeberg.org/wvhulle/bootvine/raw/branch/recordings/scripted-initrd.webp" width="640" alt="The same boot with NixOS's scripted initrd: the kernel and initrd lines scroll past before bootvine starts in stage 2">
|
||||||
|
|
||||||
The `scripted-initrd` machine uses NixOS's older scripted initrd, which has no
|
The `scripted-initrd` machine uses NixOS's older scripted initrd, which has no
|
||||||
systemd. The initrd's lines scroll past as usual, and bootvine starts in
|
systemd. The initrd's lines scroll past as usual, and bootvine starts in
|
||||||
@@ -85,7 +85,7 @@ stage 2, from `sysinit.target` on.
|
|||||||
|
|
||||||
## Shutdown
|
## Shutdown
|
||||||
|
|
||||||
<img src="../recordings/shutdown.gif" width="691" alt="A poweroff: units stopping under the targets waiting on them">
|
<img src="https://codeberg.org/wvhulle/bootvine/raw/branch/recordings/shutdown.gif" width="691" alt="A poweroff: units stopping under the targets waiting on them">
|
||||||
|
|
||||||
On a poweroff, reboot or halt the tree turns around:
|
On a poweroff, reboot or halt the tree turns around:
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ On a poweroff, reboot or halt the tree turns around:
|
|||||||
|
|
||||||
## Passphrase prompts
|
## Passphrase prompts
|
||||||
|
|
||||||
<img src="../recordings/encrypted-volume.webp" width="640" alt="A LUKS passphrase prompt floating over the initrd tree, a wrong answer, then the unlock">
|
<img src="https://codeberg.org/wvhulle/bootvine/raw/branch/recordings/encrypted-volume.webp" width="640" alt="A LUKS passphrase prompt floating over the initrd tree, a wrong answer, then the unlock">
|
||||||
|
|
||||||
The `encrypted-volume` machine asks for a LUKS passphrase in the initrd; its
|
The `encrypted-volume` machine asks for a LUKS passphrase in the initrd; its
|
||||||
recording shows a wrong answer, then the right one.
|
recording shows a wrong answer, then the right one.
|
||||||
@@ -118,7 +118,7 @@ bootvine started, bootvine waits behind it.
|
|||||||
|
|
||||||
## Failures
|
## Failures
|
||||||
|
|
||||||
<img src="../recordings/failures.webp" width="640" alt="Units failing one after another, each landing in the failure panel with its reason and last journal lines">
|
<img src="https://codeberg.org/wvhulle/bootvine/raw/branch/recordings/failures.webp" width="640" alt="Units failing one after another, each landing in the failure panel with its reason and last journal lines">
|
||||||
|
|
||||||
A unit that broke or timed out gets an entry in the failure panel, newest
|
A unit that broke or timed out gets an entry in the failure panel, newest
|
||||||
first:
|
first:
|
||||||
|
|||||||
@@ -124,7 +124,7 @@
|
|||||||
|
|
||||||
record-screencasts =
|
record-screencasts =
|
||||||
shellScriptApp "record-screencasts"
|
shellScriptApp "record-screencasts"
|
||||||
"Re-record the scripted demo animations and the sample machine recordings into recordings/"
|
"Re-record the scripted demo animations and the sample machine recordings into recordings/; publish them with publish-recordings"
|
||||||
{
|
{
|
||||||
runtimeInputs = [
|
runtimeInputs = [
|
||||||
pkgs.vhs
|
pkgs.vhs
|
||||||
@@ -139,6 +139,17 @@
|
|||||||
}";
|
}";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
publish-recordings =
|
||||||
|
shellScriptApp "publish-recordings"
|
||||||
|
"Replace the recordings branch on origin with a single commit holding recordings/"
|
||||||
|
{
|
||||||
|
runtimeInputs = [
|
||||||
|
pkgs.gitMinimal
|
||||||
|
builds.repo-tasks
|
||||||
|
];
|
||||||
|
text = "exec xtask publish-recordings";
|
||||||
|
};
|
||||||
|
|
||||||
build-and-push-to-cachix =
|
build-and-push-to-cachix =
|
||||||
shellScriptApp "build-and-push-to-cachix"
|
shellScriptApp "build-and-push-to-cachix"
|
||||||
"Build flake outputs and push everything built to the wvhulle Cachix cache"
|
"Build flake outputs and push everything built to the wvhulle Cachix cache"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
mod publish_recordings;
|
||||||
mod record_screencasts;
|
mod record_screencasts;
|
||||||
mod sync_default_config;
|
mod sync_default_config;
|
||||||
mod task_error;
|
mod task_error;
|
||||||
@@ -20,6 +21,10 @@ enum Task {
|
|||||||
screenshots to WebP in recordings/"
|
screenshots to WebP in recordings/"
|
||||||
)]
|
)]
|
||||||
RecordScreencasts(RecordScreencastsOptions),
|
RecordScreencasts(RecordScreencastsOptions),
|
||||||
|
#[command(
|
||||||
|
about = "Replace the recordings branch on origin with a single commit holding recordings/"
|
||||||
|
)]
|
||||||
|
PublishRecordings,
|
||||||
#[command(
|
#[command(
|
||||||
about = "Rewrite the defaults block in docs/configuration.md from `bootvine defaults`"
|
about = "Rewrite the defaults block in docs/configuration.md from `bootvine defaults`"
|
||||||
)]
|
)]
|
||||||
@@ -41,6 +46,7 @@ fn main() -> ExitCode {
|
|||||||
Task::RecordScreencasts(options) => {
|
Task::RecordScreencasts(options) => {
|
||||||
record_screencasts::record_screencasts(&options.vm_check_outputs)
|
record_screencasts::record_screencasts(&options.vm_check_outputs)
|
||||||
}
|
}
|
||||||
|
Task::PublishRecordings => publish_recordings::publish_recordings(),
|
||||||
Task::SyncDefaultConfig => sync_default_config::sync_default_config(),
|
Task::SyncDefaultConfig => sync_default_config::sync_default_config(),
|
||||||
};
|
};
|
||||||
match outcome {
|
match outcome {
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
use std::path::Path;
|
||||||
|
|
||||||
|
use xshell::{Shell, cmd};
|
||||||
|
|
||||||
|
use crate::{record_screencasts::RECORDINGS_DIRECTORY, task_error::TaskError};
|
||||||
|
|
||||||
|
const RECORDINGS_BRANCH: &str = "refs/heads/recordings";
|
||||||
|
|
||||||
|
pub fn publish_recordings() -> Result<(), TaskError> {
|
||||||
|
if !Path::new(RECORDINGS_DIRECTORY).is_dir() {
|
||||||
|
return Err(TaskError::RecordingsMissing);
|
||||||
|
}
|
||||||
|
let shell = Shell::new()?;
|
||||||
|
let git_directory = cmd!(shell, "git rev-parse --absolute-git-dir").read()?;
|
||||||
|
let temporary_directory = shell.create_temp_dir()?;
|
||||||
|
let _index_override = shell.push_env(
|
||||||
|
"GIT_INDEX_FILE",
|
||||||
|
temporary_directory.path().join("recordings-index"),
|
||||||
|
);
|
||||||
|
let _git_directory_override = shell.push_env("GIT_DIR", &git_directory);
|
||||||
|
let _recordings_directory = shell.push_dir(RECORDINGS_DIRECTORY);
|
||||||
|
cmd!(shell, "git --work-tree=. add --all --force .")
|
||||||
|
.quiet()
|
||||||
|
.run()?;
|
||||||
|
let recordings_tree = cmd!(shell, "git write-tree").read()?;
|
||||||
|
let recordings_commit = cmd!(
|
||||||
|
shell,
|
||||||
|
"git commit-tree {recordings_tree} -m 'chore: sample recordings [skip ci]'"
|
||||||
|
)
|
||||||
|
.read()?;
|
||||||
|
let branch = RECORDINGS_BRANCH;
|
||||||
|
cmd!(
|
||||||
|
shell,
|
||||||
|
"git push --force origin {recordings_commit}:{branch}"
|
||||||
|
)
|
||||||
|
.run()?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
@@ -13,6 +13,7 @@ const TAPES: [&str; 2] = [
|
|||||||
"scripted-demos/tapes/scripted-shutdown.tape",
|
"scripted-demos/tapes/scripted-shutdown.tape",
|
||||||
];
|
];
|
||||||
const RECORDING_FRAME_MILLISECONDS: &str = "500";
|
const RECORDING_FRAME_MILLISECONDS: &str = "500";
|
||||||
|
pub const RECORDINGS_DIRECTORY: &str = "recordings";
|
||||||
|
|
||||||
fn sorted_entries(directory: &Path) -> Result<Vec<PathBuf>, TaskError> {
|
fn sorted_entries(directory: &Path) -> Result<Vec<PathBuf>, TaskError> {
|
||||||
let read_failure = |source| TaskError::File {
|
let read_failure = |source| TaskError::File {
|
||||||
@@ -106,10 +107,14 @@ fn encode_machine_recording(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn record_screencasts(vm_check_outputs: &Path) -> Result<(), TaskError> {
|
pub fn record_screencasts(vm_check_outputs: &Path) -> Result<(), TaskError> {
|
||||||
let recordings = Path::new("recordings");
|
if !TAPES.iter().all(|tape| Path::new(tape).is_file()) {
|
||||||
if !recordings.is_dir() {
|
|
||||||
return Err(TaskError::NotInRepositoryRoot);
|
return Err(TaskError::NotInRepositoryRoot);
|
||||||
}
|
}
|
||||||
|
let recordings = Path::new(RECORDINGS_DIRECTORY);
|
||||||
|
fs::create_dir_all(recordings).map_err(|source| TaskError::File {
|
||||||
|
path: recordings.to_path_buf(),
|
||||||
|
source,
|
||||||
|
})?;
|
||||||
let shell = Shell::new()?;
|
let shell = Shell::new()?;
|
||||||
TAPES.iter().try_for_each(|tape| {
|
TAPES.iter().try_for_each(|tape| {
|
||||||
let tape_path = Path::new(tape);
|
let tape_path = Path::new(tape);
|
||||||
|
|||||||
@@ -10,8 +10,10 @@ pub enum TaskError {
|
|||||||
File { path: PathBuf, source: io::Error },
|
File { path: PathBuf, source: io::Error },
|
||||||
#[error("{} has no recording frames", .0.display())]
|
#[error("{} has no recording frames", .0.display())]
|
||||||
NoRecordingFrames(PathBuf),
|
NoRecordingFrames(PathBuf),
|
||||||
#[error("no recordings directory here; run from the repository root")]
|
#[error("no VHS tapes here; run from the repository root")]
|
||||||
NotInRepositoryRoot,
|
NotInRepositoryRoot,
|
||||||
|
#[error("no recordings/ directory here; run record-screencasts from the repository root first")]
|
||||||
|
RecordingsMissing,
|
||||||
#[error("{0} has no ```toml block under its Defaults heading")]
|
#[error("{0} has no ```toml block under its Defaults heading")]
|
||||||
DefaultsBlockMissing(&'static str),
|
DefaultsBlockMissing(&'static str),
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user