Repository navigation
feat: add just recipes to run the current checkout in an isolated dev device - #4387
jarhodes314 wants to merge 5 commits into
Conversation
`just pr-device-up` builds the current checkout and starts a debian-systemd container named after the branch, with recipes to register it with Cumulocity, switch it to `tedge run all`, open a shell, list and remove it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: James Rhodes <jarhodes314@gmail.com>
`ci/build_scripts/build.sh --features <list>` enables cargo features for
every binary it builds. `just pr-device-up` forwards arguments starting
with `-` to the build, so a feature-gated change can be tried on a PR
device while keeping the device name derived from the branch:
just pr-device-up --features tedge/mapper-config
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: James Rhodes <jarhodes314@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
Packages from the `debug` and `dev-stripped` profiles are only used locally, and xz on an unstripped debug `tedge` binary (~600 MB) took over a minute per package type. nfpm doesn't expand env vars in `compression`, so package.sh builds from a copy of the manifest with `compression: none` when BUILD_PROFILE isn't `release`. build.sh also warns that the `debug` profile keeps debug info in the packaged binaries, since `dev-stripped` is usually what's wanted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: James Rhodes <jarhodes314@gmail.com>
The recipes run whatever is checked out, not a PR, so they are renamed to `dev-device-*` and the containers to `tedge-dev-<name>`. `dev-device-up` builds its own `tedge-dev-<name>` image instead of retagging `debian-systemd`, so a build in another worktree can't change which image the device starts from. `build-integration-test` takes the image name from INTTEST_IMAGE (defaulting to `debian-systemd`), and `dev-device-down`/`dev-device-prune` remove the images too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: James Rhodes <jarhodes314@gmail.com>
Robot Results
|
`dev-device-up` builds with the `dev-stripped` profile unless BUILD_PROFILE is given, as an unstripped `debug` binary is ~600 MB. `build-integration-test` only builds deb packages, which is all `invoke build` copies into the image. Packaging the other formats took ~50 s on a debug build, against ~3 s for debs alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: James Rhodes <jarhodes314@gmail.com>
|
Following the discussion in the daily, I've renamed the commands for this to I had a discussion with claude about the feasibility of reusing robot for setting up the device. It seems that it isn't terribly worthwhile. Between the container image and
|
Proposed changes
Adds
justrecipes to try out the current checkout (e.g. a PR branch) on a throwaway device: build it, run it in an isolateddebian-systemd-based container named after the branch, and optionally register it with Cumulocity or switch it totedge run all. Cargo features can be passed to the build, so feature-gated changes such asmapper-configcan be tried too.NAMEdefaults to the current branch (or short commit when detached) with non-alphanumerics replaced by-, so several devices can run side by side. If the first argument todev-device-upstarts with-, the arguments are assumed to be cargo arguments:dev-device-upbuilds with thedev-strippedprofile unlessBUILD_PROFILEis given, as an unstrippeddebugtedgebinary is ~600 MB. Sincereleaseis also the justfile's default, a release dev device needsBUILD_PROFILE=release just dev-device-up.Each device gets its own
tedge-dev-<name>image rather than the shareddebian-systemdtag, so a build in another worktree can't retag the image betweendev-device-upbuilding it and running it.The features need the package prefix (
tedge/…) because the workspace root isn't a package. The run-all script masks the per-component services rather than only disabling them, sotedge connectcan't start them alongsidetedge run all.Packages built with
debugordev-strippedare only used locally, sopackage.shskips xz for them. nfpm doesn't expand env vars incompression, so it builds from a copy of the manifest withcompression: none. With an unstrippeddebugbinary (~600 MB), deb packaging went from 80 s to 2.8 s.build-integration-testnow only builds debs, which is allinvoke builduses; the other formats took another ~50 s.build.shalso warns whendebugis used, sincedev-strippedis usually what's wanted.Types of changes
Paste Link to the issue
None
Checklist
just prepare-devonce)just formatas mentioned in CODING_GUIDELINESjust checkas mentioned in CODING_GUIDELINESFurther comments
Merge Danger
Door: two-way
Dev-only recipes, opt-in build behaviour and one extra file in the test image; reverting removes them.
Blast Radius: small
build.sh,package.shand thedebian-systemdimage are shared with CI. Release packages are unchanged: withBUILD_PROFILE=releaseor unset, debs are still built withdata.tar.xz. Builds without--featurespass the same cargo flags as before,integration-teststill builds thedebian-systemdimage (now from debs only, which is all it ever used), and the extraCOPYonly adds a script that nothing runs unless someone callsjust dev-device-run-all.🤖 Generated with Claude Code