45 Commits

Author SHA1 Message Date
Christopher Obbard
673fc9e77c docker: Install qemu-img disk imaging utility
Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2022-05-18 18:05:51 +01:00
Sjoerd Simons
69d35a46df Run a matrix of debos recipes as test
The docker-compose test strategy was mainly done for integration with
dockerhub, but as dockerhub no longer builds our images it's not that
relevant.

What's more interesting is to use the docker container we've build to
run a selection of debos recipes, whose successfull build indicate
success. This both makes it easier to test locally as well (just run the
debos recipe) and makes the test jobs more specific.

On top of the existing test this also adds a "debian" test which does some basic
debian smoketesting (debootstrap and apt) as well as a basic
"partitioning" test. The partitioning test unforutunately doesn't work
in the nofakemachine run as udev isn't available in the container, so
that only runs on UML and Qemu based backends.

Current the kvm backend isn't tested because the standard github action
runners don't support kvm. But qemu, though being lots slower, covers
some part of it.

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
2022-04-27 17:18:51 +02:00
Christopher Obbard
e4dfbfa557 Build docker container in GitHub actions
This is a continuation of work done by @eds-collabora in !275

This replaces the old, simpler pipeline with a three phase process:

- First, build the image and cache it using docker buildx.
- Second, run all the tests in parallel, restoring the image from the cache.
- Thirdly, if the tests pass:
  - if this is a push to the main branch, push to DockerHub.
  - push to GitHub Container registry (PS: will push to a user's own fork).

This uses Buildkit caching aggressively, and will make use of the entire 5GiB allocation of cache space that GitHub provides over time.

It requires the following additional repository secrets:

- DOCKERHUB_USERNAME: the username to login as on DockerHub (e.g. go-debos)
- DOCKERHUB_PASSWORD: an access token for the DockerHub repository.

Closes: #275
Based on original work by: Ed Smith <ed.smith@collabora.com>
Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2022-04-20 20:45:31 +02:00
Christopher Obbard
8164d9a98e docker: Build using go modules
Since we are now building using go modules, let's remove
the hacks for various dependencies and build the docker
container using the go modules.

Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2022-04-14 21:14:27 +02:00
Christopher Obbard
a95ed8411f Revert "docker: Install qemu-user-static 6.0 to fix segfault"
This reverts commit 91af617bea.

qemu is no longer in experimental so the container build
will now fail. The required patches for qemu have been
backported into bullseye so let's revert using qemu from
experimental.

Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=988174
Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2021-10-04 09:26:59 +02:00
Christopher Obbard
c66a48d699 Run recipe tests using UML on GitHub actions
Running the tests on the host is a good first step; to test Debos
properly we should run inside a Fakemachine. Since GitHub actions
do not support creating nested virtual machines, use the
user-mode-linux backend in Fakemachine to create a user process
to run the tests inside of.

Since Docker autobuild does not support UML the docker-compose
file purposely does not have a suffix of `.test.yml` so that the
test will not be picked up to run on Docker autobuild.

Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2021-07-07 22:11:52 +02:00
Christopher Obbard
9bb2764c12 tests: Allow arguments to be passed to debos
Currently we assume all of the tests are run without fakemachine;
since we are looking to run the tests with fakemachine as well,
let's allow arguments to be passed to the test script which are
then passed to debos.

Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2021-07-07 22:11:52 +02:00
Christopher Obbard
429a0bb9a6 docker: Add information about unit and recipe tests to README
Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2021-07-07 22:11:52 +02:00
Christopher Obbard
21fdbc283a docker: recipes-test: move tests to project root directory
The tests are first-class citizens; they should be present in the
directory as such.

Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2021-07-07 22:11:52 +02:00
Christopher Obbard
8b60bab5d2 docker: unit-tests: run all of the unit-tests
Currently only the unit-tests under the actions directory are ran. This
patch runs all of the available unit tests in the project.

Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2021-07-07 22:11:52 +02:00
Christopher Obbard
ba83a9631f docker: dockerfile: install unzip for unit-test
The unit tests require the unzip package to be installed.

Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2021-07-07 22:11:52 +02:00
Sjoerd Simons
0dec131ed3 docker: Add some useful deployment tools
Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2021-07-06 21:59:21 +02:00
Nguyen Thi Huong
fe62ce195a image-partition: add support for xfs
This patch adds support for XFS, including the ability
to specify the UUID through the fsuuid property of the
image-partition action.

Signed-off-by: Nguyen Thi Huong <huong4.nguyenthi@toshiba.co.jp>
Signed-off-by: Daniel Sangorrin <daniel.sangorrin@toshiba.co.jp>
2021-07-06 21:54:17 +02:00
Christopher Obbard
306d2ea194 docker: Manually register binfmts
Debian's qemu-user-static package no longer registers binfmts on postinst
when running inside a virtualmachine; dockerhub builds are now built inside
a vm so the binfmts are not generated inside the docker container.

Fixes: 91af617bea ("docker: Install qemu-user-static 6.0 to fix segfault")

Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2021-05-28 16:24:37 +02:00
Christopher Obbard
91af617bea docker: Install qemu-user-static 6.0 to fix segfault
There are issues with qemu-user-static 5.2 crashing when attempting
to allocate guest memory when compiled as a proper statically-linked
binary.

From testing, qemu 6.0 fixes the bug but it's not yet clear which
patch fixes the bug. So until the correct patch is backported to
bullseye, let's install qemu from experimental to pickup the bugfix.

See: #245
See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=988174

Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2021-05-26 08:33:10 +02:00
Christopher Obbard
da53d4b001 docker: Add git package
Add the git package to the docker image.

Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2021-04-29 11:42:55 +02:00
Christopher Obbard
59c38c76ed docker: Add zip package
Add the zip package to allow the cration of compressed zip archives.

Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2021-04-28 18:51:36 +02:00
Christopher Obbard
0427306a09 Docker tests should run without fakemachine
Since we have the support for the new user-mode-linux backend in the
docker container, Debos defaults to attempting to use that.
Unfortunately that isn't possible to run inside the Docker Hub where the
test suite runs, so let's explicitly disable the fakemachine library
when running the Docker Hub test suite.

Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2021-03-23 10:54:58 +01:00
Christopher Obbard
88464339d6 dockerfile: Add fakemachine uml backend support
The fakemachine uml backend uses user-mode-linux and libslirp-helper
packages available from bullseye, let's include those inside the container.

Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2021-03-23 10:54:58 +01:00
Christopher Obbard
6fbb5752d7 docker: Upgrade from buster to bullseye
Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2021-03-23 10:54:58 +01:00
Christopher Obbard
bd53aff709 docker: Add equivs package
The equivs package is used to create dummy Debian packages which can
be useful in development to satisfy dependencies without installing the
real package. Note that this package is not the recommended way of
dealing with broken dependencies: a bug report should be filed instead.

Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2021-01-25 14:10:39 +01:00
Christopher Obbard
0303282b25 docker: Fix formatting
Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2021-01-25 14:10:39 +01:00
Christopher Obbard
26945d8833 docker: dockerfile: install testify from source
Testify is currently not built unless the manual tests are ran at which
point testify compiliation fails due to requiring a newer version of
golang than in buster. Unfortunately the main branch is no longer
compatible, so install from source to get the unit tests running again.

Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2020-08-14 15:18:47 +02:00
Sjoerd Simons
1fde503ac7 docker: Add f2fs-tools for mkfs.f2fs
Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
2020-08-14 14:27:02 +02:00
Christopher Obbard
b86d0d4816 actions/image-partition: add support for setting partition type
Debos currently sets the partition type to filesystem type and
does not allow the partition type to be set from the recipe.

In some situations setting the partition type is required, so add the
property `PartType` to the Partition and set the partition type to the value
of that property. If the `PartType` property is unset, the original partition
type is retained thus not breaking backwards compatibility.

For msdos, the partition type should be hexadecimal and 2-characters long.
For gpt, the partition GUID should be in GUID format and 36-characters long.
Some examples and further reading is included in the documentation.

Resolves: #98

Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
2020-08-14 14:17:25 +02:00
Mylène Josserand
948e1e4564 docker: Add u-boot-tools package
Add the u-boot-tools package to be able to use binaries such as
mkimage in debos' recipes.

Signed-off-by: Mylène Josserand <mylene.josserand@collabora.com>
2020-04-28 12:23:16 +02:00
Jonah Brüchert
76419fc60b docker: Add unzip 2019-12-05 11:29:11 +01:00
Frédéric Danis
18395c85c8 docker: Add debos-docker tests for "recipe" action
Move simple test to simple dir.
Add test with recipe included from sub-directory.
Add test with recipe included from directory outside of main recipe path.
Add script to run tests in sequence.

Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
2019-12-05 11:28:04 +01:00
Sjoerd Simons
112fcf5aef docker: Add pigz
pigz is a parallel gzip implementation allowing for faster compression.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2019-11-27 22:44:18 +01:00
Frédéric Danis
1a441c5839 docker: Re-order packages alphabetically
Ordered packages list simplify maintenance.

Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
2019-06-11 16:49:30 +02:00
Frédéric Danis
55070b66e0 docker: Container should be used as an executable
The usage of the container as an executable does not seems to be
straightforward.
Add a warning in docker/README.md and add container installation reference
in main README.md.

Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
2019-04-16 15:49:00 +02:00
Frédéric Danis
9e8c0e575d docker: Add compression utilities support
Useful compression utilities which may be used by debos
Fixes #155

Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
2019-04-15 11:13:49 +02:00
Frédéric Danis
9bc3ff0483 docker: Add an ENTRYPOINT to run container as debos executable
The ENTRYPOINT set the image’s main command, allowing that image to
be run as though it was that command. With 'docker run', the command
parameters could be passed directly after the container's name.

Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
2019-04-09 17:14:20 +02:00
Frédéric Danis
0ec3327525 docker: Add LABELs to debos container
Add name, simple description, upstream URL and docker command to run it.

Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
2019-04-09 17:14:20 +02:00
Frédéric Danis
4271e350f4 docker: Add simple recipe test for debos-docker
This test run on the final debos-docker container.
It doesn't use actions which act on image files which either needs
fakemachine or access to loop devices.

Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
2019-04-09 17:14:20 +02:00
Frédéric Danis
bf4759357e docker: Add debos container test
This allows to automatically run debos unit test on dockerhub when
a build is triggered.
The unit test are run on "builder" target image, which needs to make
GOPATH available from the container and add go packages dependency for
the test.

Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
2019-04-09 17:14:20 +02:00
Frédéric Danis
9527a19f62 docker: Update README
Move build and run explanations from scripts to README.md

Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
2019-04-09 17:14:20 +02:00
Frédéric Danis
07927639a8 docker: Use local debos source for container build
Copy the local debos source during container build instead of downloading
master debos branch from github.
This allows to use docker container during debos development.

Add apt-transport-https, pkg-config and btrfs-progs packages to runtime
dependencies.
Remove dbus package which is not requested (see
https://gitlab.collabora.com/docker/debos/blob/master/docker/Dockerfile)

Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
2019-04-09 17:14:20 +02:00
Frédéric Danis
7ca7907ec2 docker: Move container to buster-slim
Move builder and runner stages to buster-slim to get newer versions
of go, deboostrap and libostree.

Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
2019-04-09 17:14:20 +02:00
Maciej Pijanowski
7b156f727b docker/run.sh: drop 'privileged', expose kvm device
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
2019-04-09 17:14:20 +02:00
Maciej Pijanowski
59f2ffd7b1 Dockefile: pass --no-install-recommends to apt install
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
2019-04-09 17:14:20 +02:00
Maciej Pijanowski
3c3cddb480 Dockefile: add debos image phase dependencies
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
2019-04-09 17:14:20 +02:00
Maciej Pijanowski
59d1d9ec85 Dockefile: remove outdated comment
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
2019-04-09 17:14:20 +02:00
Maciej Pijanowski
edb4b6a9cc Dockerfile: remove non-free from backports list
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
2019-04-09 17:14:20 +02:00
Maciej Pijanowski
43c00f6fbd docker: add basic docker support
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>

The problem with building for non-host arch as described in the:
https://github.com/go-debos/debos/issues/9 was resolved. Basic
arm64 example image building was tested on the Ubuntu 18.04.
This may enable more users to take advantage of the debos, as
using it on non-Debian distros seems either impossible or not
trivial.
2019-04-09 17:14:20 +02:00