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

feat(docker): add command to inject packed docker images into firmware images #119

Merged
merged 25 commits into from
Jun 10, 2024

Conversation

empwilli
Copy link
Contributor

@empwilli empwilli commented Jun 5, 2024

No description provided.

We add a small helper function to read file contents from the image
programmatically.
We add helper functionality to determine the architecture for which an image was
built. This feature relies on this information being stored in the os-release
file.
With omnect-ui (and possibly other use cases) we want to inject docker images
post-built via omnect-cli. This commit adds a new command that realizes this
feature. To this end, we extend the omnect-cli to fetch docker images, pack
them, and copy them into the platform image.
We update the test images to reflect the information currently supplied in
/usr/lib/os-release. In particular, this now includes the `OMNECT_TARGET_ARCH`
variable. The updated content reflects a build for
`build-omnect-gateway-devel-rpi4-omnect-lab` and contains the following info:

```
ID=omnect-os
NAME="dobi-OMNECT-gateway-devel"
VERSION="4.0.18.0"
VERSION_ID=4.0.18.0
PRETTY_NAME="dobi-OMNECT-gateway-devel 4.0.18.0"
DISTRO_FEATURES="debuginfod ipv4 ipv6 polkit seccomp zeroconf  bluetooth wifi wifi-commissioning flash-mode-2 flash-mode-3 iotedge persistent-var-log resize-data systemd virtualization"
MACHINE="raspberrypi4-64"
MACHINE_FEATURES="  apm  keyboard   screen touchscreen  bluetooth wifi sdio vc4graphics"
META_OMNECT_GIT_SHA="15bae4449c8246bc7cd497329ae61e8b3177880b"
META_OMNECT_GIT_BRANCH="fix/os-release_target_arch"
META_OMNECT_GIT_REPO="META_OMNECT_GIT_REPO_NOT_SET"
META_OMNECT_VERSION="META_OMNECT_VERSION_NOT_SET"
OMNECT_OS_GIT_SHA="OMNECT_OS_GIT_SHA_NOT_SET"
OMNECT_OS_GIT_BRANCH="OMNECT_OS_GIT_BRANCH_NOT_SET"
OMNECT_OS_GIT_REPO="OMNECT_OS_GIT_REPO_NOT_SET"
OMNECT_OS_VERSION="OMNECT_OS_VERSION_NOT_SET"
OMNECT_DEVEL_TOOLS="    curl     e2fsprogs     ethtool     gdbserver     htop     iproute2-ip     ldd     less     lshw     lsof     ltrace     mmc-utils     screen     strace     sysstat     tcpdump     valgrind           "
OMNECT_RELEASE_IMAGE="0"
OMNECT_TARGET_ARCH="aarch64"
```
We add the mock feature to the omnect-cli to enable conditional compilation for
some testing scenarios which require mocking.
We therefore also restructure the docker module with an inner module. This way
we can encapsulate the used implementation depending on the `mock` feature flag.
Cargo.toml Outdated Show resolved Hide resolved
src/cli.rs Outdated Show resolved Hide resolved
src/cli.rs Outdated Show resolved Hide resolved
src/docker.rs Outdated Show resolved Hide resolved
src/docker.rs Outdated Show resolved Hide resolved
src/image.rs Outdated Show resolved Hide resolved
We add an implementation of the display trait for the partitions to print them
from omnect-cli.
We ensure that clap uses partition names as they are. Until now clap converts
them to kebab-case, which leads to inconsistencies with the omnect-cli file
copy-* commands.
We want to reuse the compression functionality for `File` types within the
crate. Thus, we make the operations public. To this end we type to enclose
compression options parameters to the value types.
We pack the docker image with xz, as such use the correct file suffix.
@empwilli empwilli requested a review from JanZachmann June 6, 2024 14:21
src/cli.rs Outdated Show resolved Hide resolved
src/file/functions.rs Show resolved Hide resolved
@empwilli empwilli merged commit 1836fed into omnect:main Jun 10, 2024
3 checks passed
@empwilli empwilli deleted the feat/add_docker_image branch June 20, 2024 11:08
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.

4 participants