Commit graph

2941 commits

Author SHA1 Message Date
Ondřej Budai
24faab8c18 store: clean up blueprint API
Prior to this commit blueprint getters looked like C-style API with output
parameters. This commit refactors them to more conventional multiple return
values API.
2019-12-05 13:08:50 +01:00
Ondřej Budai
f89a9671be store: add image struct into compose struct
As a part of f4991cb1 ComposeEntry struct was removed from store package.
This change made sense because this struct is connected more with API than
with store - store uses its own Compose struct. In addition, converters
between Compose and ComposeEntry were added. Unfortunately, ComposeEntry
contains ImageSize which was not stored in Compose but retrieved from store
using GetImage method. This made those converters dependent on the store,
which was messy.

To solve this issue this commit adds image struct into Compose struct.
The content of image struct is generated on the worker side - when the worker
sets the compose status to FINISHED, it also sends Image struct with detailed
information about the result.
2019-12-05 09:48:21 +01:00
Lars Karlitski
b2880cacc6 weldr: don't indent toml output
Be consistent with lorax-composer.

The integration tests do a string compare on received toml files.
2019-12-04 19:15:33 +01:00
Lars Karlitski
b1c65bb671 blueprint: tag all struct fields for toml
This is repetitive, but there doesn't seem to be another way to export
lower-case field names.
2019-12-04 19:15:33 +01:00
Lars Karlitski
94bfcc518c weldr: bump blueprint version
According to the same rules as lorax-compposer:

  https://weldr.io/lorax/lorax-composer.html#blueprints
2019-12-04 18:35:18 +01:00
Ondřej Budai
b6307cafd5 api: fix compose routes returning null instead of empty array
Cockpit-composer really doesn't like that
2019-12-03 11:49:35 +01:00
Ondřej Budai
dca7ab2847 api: handle blueprint depsolve error 2019-12-03 11:49:27 +01:00
Lars Karlitski
20bb60f3fd weldr: add support for toml blueprints 2019-12-03 01:27:00 +01:00
Martin Sehnoutka
bddac13048 add makefile targets for rpm build 2019-12-02 13:45:07 +01:00
Tom Gundersen
b21ebf81c8 4
Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-12-01 00:09:17 +01:00
Tom Gundersen
0217b4b590 test/run: uncompressed raw images before running image-info
Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-12-01 00:05:17 +01:00
Tom Gundersen
e62ba4577a submodule: update to osbulid v6 2019-12-01 00:05:17 +01:00
Lars Karlitski
1c5adfc682 job: use image.raw.xz filename
RHEL and Fedora used different output formats (.ami vs .raw.xz). The job
package assumed `image.ami`, which failed for RHEL.

Change Fedora to use image.raw.xz as well. This makes it consistent, but
we should also get the filename from the distro at some point.
2019-12-01 00:05:17 +01:00
Lars Karlitski
b53d897019 job: set S3 key to compose id
cockpit-composer currently doesn't require setting the S3 key. Set it to
the compose ID if it's empty.
2019-12-01 00:05:17 +01:00
Ondřej Budai
f4991cb1ca api: Add support for upload API
This commit introduces basic support for upload API. Currently, all the routes
required by cockpit-composer are supported (except for /compose/log).

Also, ComposeEntry struct is moved outside of the store package. I decided
to do it because it isn't connected in any way to store, it's more connected
to API. Due to this move there's currently a known bug that image size is
not returned. This should be solved by moving Image struct inside Compose
struct by follow-up PR.
2019-12-01 00:05:17 +01:00
Ondřej Budai
be1cf79d6a test: introduce helpers for go-cmp
This commit introduces three helpers to ignore dates, uuids and paths when
using cmp.diff() method
2019-12-01 00:05:17 +01:00
Ondřej Budai
613b659b95 test: use google cmp library to do the deep reflect
The cmp library has two advantages:

- it shows diffs between compared values
- it allows ignoring fields based on field name or type
2019-12-01 00:05:17 +01:00
Ondřej Budai
268befa435 store: make ListQueue return value more predictable by sorting it
The return value hasn't been predictable prior to this commit. This is
probably caused by internal implementation of Golang map. This commit
fixes it by sorting the output.
2019-12-01 00:05:17 +01:00
Ondřej Budai
7fbe8453ef api: support wildcard /compose/status 2019-12-01 00:05:17 +01:00
Ondřej Budai
df7e14d5eb target: add new fields to target and cleanup
We need some more fields in target struct to support weldr API. This commit
introduces them. Also a bit of cleanup is done.
2019-12-01 00:05:17 +01:00
Martin Sehnoutka
364ea62f59 Introduce Azure upload test
The test is very simple, it first upload a file with random content and
then downloads it back and compare hashes.
2019-11-29 12:19:40 +01:00
Ondřej Budai
91bce12513 add packit 2019-11-29 12:16:27 +01:00
Lars Karlitski
5dad3bfc8e worker: pass build environment to osbuild
Detect it from the host using the distro package.
2019-11-29 00:46:05 +01:00
Lars Karlitski
85e6182bdc distro: don't fall back to fedora-30
Make osbuild-composer use FromHost() directly. Everywhere else needs to
specify the distro explicitly.

Also don't panic when a distro doesn't exist. Instead, return nil. Make
sure all callers check for that.
2019-11-29 00:46:05 +01:00
Lars Karlitski
70857963bb osbuild-composer: don't try creating state directory
systemd creates it for us. We don't support running this binary outside
of systemd.
2019-11-29 00:46:05 +01:00
Lars Karlitski
14ebed46da distro: register distros explicitly
Automatically registering on `init()` is clever, but a bit too magical
and easy to get wrong, because every binary must include all distros
somewhere.

Flip this inside out: distros now have a `New()`, which returns
something that implements the `Distro` interface. The distro package
explicitly creates all of them.

This means that distros cannot import distro itself anymore, because go
forbids import cycles. This only affected `InvalidOutputFormatError`.
Return a generic error for now.
2019-11-29 00:46:05 +01:00
Lars Karlitski
673d3ff14b blueprint: remove unused error
It was moved to the distro package a while ago.
2019-11-29 00:46:05 +01:00
Lars Karlitski
c0516420cc distro/rhel82: move ami output closer to official ec2 image
This includes adding (and excluding) the right packages, setting the right
systemd boot target, fixing kernel options, changing output type to
.raw.xz, and setting the size of the image to 6GB.
2019-11-29 00:46:05 +01:00
Alexander Todorov
4790e4e593 Provides: osbuild-composer in .spec
this is a small helper to enable easy switch between backends
in the existing test suite where we reference everything by name.

The current working variant is:

	yum install $BACKEND
	systemctl enable $BACKEND.socket

where BACKEND is either lorax-composer or osbuild-composer!
2019-11-28 14:06:54 +01:00
Tom Gundersen
7485094b34 pipeline/stage: add unit test for basic (un)marshalling
This makes sure that marshall/unmarshal are inverses of each other
for the most trivial instances of the various stage structs.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-11-28 05:56:11 +01:00
Tom Gundersen
caff96bd4f job/run: never panic on failed job
Return the error code of the osbuild run, and an array of errors,
one for each target provided. If a target fails, all other targets
are still attempted.

If either osbuild or one of the targets retursn an error, the worker
notifies osbuild-composer that the job failed.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-11-28 05:56:11 +01:00
Tom Gundersen
e29b6fe06b target/aws: support setting the image name
This is part of the lorax API, so support forwarding this.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-11-28 05:56:11 +01:00
Tom Gundersen
553edef01d distro/f30: rework in the same way as RHEL8.2
The produced pipelines are unchanged.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-11-28 01:24:05 +01:00
Ondřej Budai
66c57a05b7 api tests: add store fixtures
Prior this commit there wasn't an easy to populate the store. The only way
was to call the weldr API or store methods. This design made testing of
various edges quite hard.

This commit adds store fixtures - an easy way how to define store state
before each test case.

In addition, the fixtures were refactored so that new instances are created
prior each test. Before this change the tests were in some cases dependant
on each other.
2019-11-27 22:27:40 +01:00
Ondřej Budai
a00a0caa70 api tests: refactor weldr and jobqueue api tests to use common helpers
The helper functions in both api packages were more or less same. However,
over time they have been slowly diverging. This commit extract the helpers
into one common package to make the tests more maintainable and
to deduplicate the code.
2019-11-27 22:27:40 +01:00
Lars Karlitski
da311f13eb distro: add rhel82
This takes a different approach to outputs and customizations, which is
much shorter and duplicates less code.

This uses links to internal repositories for now, because 8.2 hasn't
been released yet.

Add a `distro` flag to `osbuild-pipeline`.
2019-11-27 17:08:51 +01:00
Lars Karlitski
df74737194 pipeline: fix timezone stage name 2019-11-27 17:08:51 +01:00
Lars Karlitski
4cf94e2629 rpmmd: add checksum to repoconfig
We should always specify a checksum when describing a repository to pull
content from. For now, fedora-30 duplicated the checksum. The idea is
that we can have it in one place at some point.
2019-11-27 17:08:51 +01:00
Lars Karlitski
72e7ea7de1 pipeline/groups: add missing Name field 2019-11-27 17:08:51 +01:00
Martin Sehnoutka
1135e9fe01 Refactor Azure upload code to a separate package
as part of this, move also the AWS upload code to the same directory
2019-11-27 12:14:07 +01:00
Lars Karlitski
7b54f5cfdc pipeline: support osbuild runners
osbuild has a concept of runners now: scripts that set up a build
environment. Update the osbuild submodule to latest master, change
`Pipeline` to to the new buildroot description format, and use the
`org.osbuild.fedora30` runner from the fedora30 distro.
2019-11-27 02:47:36 +01:00
Tom Gundersen
382d4e2118 distro/f30/ami: make the images boot on aws
This makes the image in line whith the ones produced by lorax.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-11-26 22:00:04 +01:00
Tom Gundersen
de93ddc757 distro/f30: rework customizations
This slightly changes the customizations logic. We now make sure
that each stage is appended exactly once.

customizations.go are now responsible only for the things that are
completely generic, and not per-ouput-type. helpers.go contain more
high-level helpers that combine customziations and per-output-type
defaults.

This does not change the behaviour, though some pipelines are slightly
reordered to make them consistent.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-11-26 22:00:04 +01:00
Tom Gundersen
c6e73e65a5 distro/f30: drop liveiso support
This never worked, either here or in lorax. Drop it so it is not
shown in the UI.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-11-26 22:00:04 +01:00
Tom Gundersen
d1d3768d9d image-info: include more properties
This gets us closer to returning all the properties we support as
customizations.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-11-26 13:48:09 +01:00
Tom Gundersen
7f4490b963 test: the vhd image is in 'raw' format now 2019-11-26 13:48:09 +01:00
Tom Gundersen
4fdcb756da go.mod: fix order of requires
Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-11-26 13:48:09 +01:00
Tom Gundersen
2eca62caf2 submodule: update to get vpc support
This is required by commit ea73597c5d.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-11-26 13:48:09 +01:00
Tom Gundersen
04d055d262 job/target: add support for uploading to S3
This should still import the image into EC2, but that is left for
a future patch.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-11-26 01:05:34 +01:00
Tom Gundersen
7f5c869cd2 upload/aws: add a sample AWS upload client
This commandline tools uploads a file to S3, as a proof of concept.

All options are mandatory. Credentials are only read from the
commandline and not from the environment or configuration files.

The next step is to add support for importing from S3 to EC2,
currently the images we produce cannot be imported as-is, so this
requires more research.

To try this out: create an S3 bucket, get your credentials and
call the tool, passing any value as `key`. Note that if the key
already exists, it will be overwritten.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-11-26 01:05:34 +01:00