61 Commits

Author SHA1 Message Date
Sjoerd Simons
2da9970f14 Rename to debos
Yaib (yet another image builder) was always a temporary name, while I
suck at naming debos seems like a pretty good name that isn't overly
confusing (yaib is also the name of an irc bot).

With the renaming I'm also considering the current yaml format and
actions as stable, which means no backwards incompatible will be done
from this point onwards without changing the major version (1)
v1.0.0
2017-08-02 12:09:15 +02:00
Sjoerd Simons
610d3ae9c5 Update TODO
Most todo for 1.0 apart from renaming to debos are done. The format
seems pretty ok and ends up being pleasant enough to use, without any
unpleasantness that i'd like to change around in the short term. So good
enough for v1.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-08-02 11:30:33 +02:00
Sjoerd Simons
0197835acc Change source naming in the raw action
To be consistent with the filesystem deploy action, change the source
identifier from rootdir to filesystem. In general the intended jargon is
that the "filesystem" is the filesystem being created by the tool
(by unpacking a tarball or debootstrap or deploying an ostree or
whatever)

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-08-02 11:30:33 +02:00
Sjoerd Simons
40598df43d Remove debugging output 2017-08-02 11:14:20 +02:00
Sjoerd Simons
77fda77efb Improve run postprocess vs. chroot message
At first i was thinking we should have a stage keyboard in the run
action rather then a simple postprocessing boolean, but that bool is
rather convenient to use and the other stages aren't well-defined yet.

So keep the simple bool for now and improve the error it shows (asking
it to chroot into the filesystem makes no sense in postprocessing)

If more stages are defined (pre-processing?) then a new key can be added
and this one kept for backwards compatibility

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-08-02 11:11:46 +02:00
Sjoerd Simons
3b436df582 Improve logging
Some action can take a good amount of time (packing, unpacking) but gave
no indication that they were running. Improve this by logging whenever
an action starts (using the description) so it's easier to determine
what's going on. Also log at the end (mostly so there is a timestamp)
and in case fakemachine isn't supported, which is a less well tested
usecase.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-08-02 10:42:05 +02:00
Sjoerd Simons
d9740d9a41 Split filesytem deployment and image partitioning
The image-setup action ended up being really two things, doing all the
image partitioning and creating the filesystems as well as deploying the
currently setup filesystem onto it and create its fstab and kernel
cmdline. This especially showed when what was deployed onto the images
wasn't the filesystem but an ostree commit as the latter doesn't have
e.g. an /etc on /

Split the action into two new actions:
* image-partition, which does all the partitioning and filesystem creation
  (and mounting those)
* filesystem-deploy, which deploys the current filesystem onto the image
  and sets up fstab + /etc/kernel/cmdline

For fstab setup and kernel commandline the required information is
stashed into the general context such that both the ostree deploy action
and the filesystem deploy action can re-use it for their particular
setups

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-08-02 10:08:11 +02:00
Sjoerd Simons
7c8e8ae4db Make actions describe themselves
Let Action also implement the Stringer interface and have a sensible
implementaton in BaseAction which uses the Description field in yaml and
falls back on the Action field otherwise

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-08-02 09:02:56 +02:00
Sjoerd Simons
120516a863 Refactor to have all failures bubble up error
Let all Action functions return error and refactor all actions to return
their errors rather then calling log.Fatalf or panic. This allows
handling/printing of the errors consistently at the top level

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-08-02 09:02:47 +02:00
Sjoerd Simons
4291937e2c Split TODO into pre-v1 and post-v1
Split things that need to be done before a v1 release and which can be
done after.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-08-02 09:02:21 +02:00
Sjoerd Simons
29d9434a26 Do minimal escaping for template vars
Simply wrap template vars as passed to the inner run in " this should
solve the most problem (template vars with spaces), though for a full
solution we'll need to do proper shell escaping or have fakemachine not
start things under a shell

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-08-02 09:00:43 +02:00
Sjoerd Simons
295fbaf58e Add todo item 2017-07-31 23:56:06 +02:00
Sjoerd Simons
c9cf0867ba Turn off ostree gpg signing by default for now 2017-07-31 23:55:33 +02:00
Sjoerd Simons
fcfeaae71f Hack around ostree incorrectly configuring repository
When getting a repository from ostree via the OstreeSysroot object some
extra information is stashed in place which seems to confused
ostree_repo_add_remote causing it to put the remote configuration in
/etc (as opposed to the repository itself).

While the proper fix should be in ostree, this allows us to get around
it for now

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-07-31 15:01:28 +02:00
Sjoerd Simons
7c1263d1c6 Explicitely name the remote repository field
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-07-31 14:11:59 +02:00
Sjoerd Simons
ec3a85fd6e Add todo item to support shell parsing in run script action
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-07-31 12:54:14 +02:00
Sjoerd Simons
9bc811cbca Set ROOTDIR as env var rather then argument
Passing the rootdir as the last argument can be cumbersome especially
when using commands rather then scripts. Instead set the ROOTDIR
environment variable for usage in scripts/commands

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-07-31 12:51:57 +02:00
Sjoerd Simons
9519e76158 Add TODO braindump
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-07-31 12:10:48 +02:00
Sjoerd Simons
8472d4d942 Support a configurable keyring package for debootstrap
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-07-31 12:09:17 +02:00
Sjoerd Simons
a2b115f007 Refactor command runner
Factor out the command runner helper into its own file and make it an
object rather then a helper function so multiple runs can easily be done
using the same setup. Also rather then pulling out the output afterwards
implement a small object implementing the Writer interface to be used
for stdout/stderr which simply re-outputs the information line-based
with a prefix attached for easy debugging.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-07-31 12:06:07 +02:00
Sjoerd Simons
f616182b45 Fix build errors 2017-07-28 15:03:16 +02:00
Sjoerd Simons
25fa982147 Empty /dev but keep the toplevel directory
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-07-28 14:49:23 +02:00
Sjoerd Simons
03bb2f89c0 Import image fstab and kernel cmdline into the ostree deployment 2017-07-28 14:49:23 +02:00
Sjoerd Simons
913c494133 apt: Use --setenv for settng env variables
It appears that -E <envvar> is broken in the systemd-nspawn that is in
debian stretch, use --setenv instead which does seem to work
2017-07-27 22:58:04 +02:00
Sjoerd Simons
b5bbc4bd55 Create paths for fstab and etc/kernel/cmdline as needed 2017-07-27 21:58:21 +02:00
Sjoerd Simons
2b5c301ea5 run apt clean after every apt action 2017-07-27 21:56:45 +02:00
Sjoerd Simons
3bf09fab85 Add ostree commit and deploy actions
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-07-27 21:56:28 +02:00
Sjoerd Simons
f14c73c0f7 Parse recipe as go text template
Support simple templating by using go's standard text/template on the
recipe. Thusfar it supports one custon template function, sector, to
calculate a sector number to byte offset

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-07-23 22:05:14 +02:00
Sjoerd Simons
b7494dcbec Use file: in both unpack and pack rather then source and target 2017-07-21 12:22:16 +02:00
Sjoerd Simons
2aaff3cc47 Fix typo
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-07-21 12:21:56 +02:00
Sjoerd Simons
1c1d39de0a Error out if a command couldn't start 2017-07-13 00:23:47 +02:00
Sjoerd Simons
17767f796b Drop duplicate image validation 2017-07-12 22:34:11 +02:00
Sjoerd Simons
bfe4cd0ac6 Correct logic to determine when running in a fake machine 2017-07-12 22:33:55 +02:00
Sjoerd Simons
7a5f78d2e4 Add license 2017-07-12 22:08:55 +02:00
Sjoerd Simons
7680305bff Don't get confused about double images in the inner yaib 2017-07-12 11:01:53 +02:00
Sjoerd Simons
cd641c8015 Create the tmpdir if needed in the cwd as /tmp might be tiny, also ensure it only happens if fakemachine is not supported 2017-07-12 10:46:51 +02:00
Sjoerd Simons
703ba818b0 Add support for running without fakemachine
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-07-12 10:31:04 +02:00
Sjoerd Simons
7f69ea3d25 Support turning on partition flags
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-07-11 17:55:51 +02:00
Sjoerd Simons
363e08f740 Correct support for msdos partitions 2017-07-11 17:55:51 +02:00
Sjoerd Simons
8b640a9785 Fail if no recipe given
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-07-11 17:55:51 +02:00
Sjoerd Simons
b792b4722a Add a raw action 2017-07-11 17:55:51 +02:00
Sjoerd Simons
2ed0acfd45 Let the overlay be relative to the recipe path 2017-07-11 17:55:51 +02:00
Sjoerd Simons
43dd3ac4cf Allow run action to run at postprocessing time 2017-07-11 15:15:58 +02:00
Sjoerd Simons
26fbd8cf63 Fix command runs
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-07-11 14:11:33 +02:00
Sjoerd Simons
3cf0f0c63a Nice failure logging 2017-07-11 14:00:02 +02:00
Sjoerd Simons
b5b96fa09b Add support for commands and script in and outside of the chroot 2017-07-11 14:00:02 +02:00
Sjoerd Simons
d4aeb57c57 Add helper function for relative path cleanup
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-07-11 13:51:10 +02:00
Sjoerd Simons
8377651449 Save the path to the current recipe in the context
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2017-07-11 13:50:29 +02:00
Sjoerd Simons
46a451f1c4 Generate fstab and /etc/kernel/cmdline 2017-07-11 13:46:26 +02:00
Sjoerd Simons
0a02a68ecf Add an apt action to install a list of packages 2017-07-11 10:04:11 +02:00