Commit graph

7209 commits

Author SHA1 Message Date
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
Martin Sehnoutka
78ea0e0b6f Introduce Azure upload CLI utility
It uses Azure SDK to connect to Azure storage, creates a container there
and uploads the image. Unfortunately the API for page blobs does not
include some thread pool for upload so I implemented one myself. The
performance can be tweaked using the upload chunk size and number of
parallel threads.

The package is prepared to be refactored into common module within
internals package as soon as we agree on the of these common packages
for image upload.

Add azure-blob-storage rpm package as a dependency

It didn't work for me using the `golang(package)` syntax. Using the
package name explicitly works.
2019-11-25 17:10:11 +01:00
Martin Sehnoutka
4910cd18e3 change image size to fulfill Azure requirements
the hardcoded image size is now aligned to 1MB, because Azure requires
it: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/create-upload-generic

once we make the size configurable, we should make sure the alignment
stays the same

fix test cases to reflect new image size
2019-11-25 17:06:32 +01:00
Martin Sehnoutka
ea73597c5d use vpc type in call to qemu-img for vhd images
vhd images currently use qcow2 format, because osbuild does not support
vpc yet, but it should land soon in related PR
2019-11-25 17:06:32 +01:00
Tom Gundersen
e98b189b82 targets: add dummy azure and aws targets
These are not currently implemented in the backend, but shows how
the API will look like.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-11-25 07:53:50 +01:00
Tom Gundersen
283e89d0f4 distros/f30/ami: image type should be RAW
This was accidentally left as QCOW2.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-11-24 17:43:00 +01:00
Tom Gundersen
eee08c41ac image-info: support images with empty partitions
Official RHEL EC2 images come with an empty partition, simply ignore
it rather than fail.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-11-24 17:43:00 +01:00
Ondřej Budai
e73b43162d api: add basic support for v1 api
lorax-composer recently introduced API version 1. This commit introduces
very basic support for it. This implementation tries to deduplicate code
for routes with the same behaviour as much as possible. All the differences of
v1 API are marked as TODOs for now and will be implemented in follow-ups PRs.
2019-11-22 14:36:05 +01:00
Lars Karlitski
b911d0b928 weldr: get repositories from distro
Make distros export repository information and use those in the weldr
API. This means that repos are only specified once and that the API
returns the right packages when we allow different distros.
2019-11-18 12:22:10 +01:00
Lars Karlitski
1dac0a03d2 weldr/sourceInfo: move '*' out of the loop
The API returns all sources on the route `sources/info/*`, but shouldn't
when one of the sources in the comma-separated list is a `*`.
2019-11-18 12:22:10 +01:00
Lars Karlitski
d1a6e2efb7 weldr: clean up source/info route
Split the error case (no sources specified) into its own function, so
that we can use `source/info/:sources` (note the colon) to get the list
of sources without the leading `/`. This gets rid of two special cases
which made the previous implementation hard to parse.
2019-11-18 12:22:10 +01:00
Lars Karlitski
d06a39bd51 weldr: move RepoConfig → SourceConfig conversion to store
This puts it aside the already existing SourceConfig → RepoConfig
conversion and makes `sourceInfoHandler` a bit easier to parse.
2019-11-18 12:22:10 +01:00
Lars Karlitski
919d849123 weldr: use repo ids as source names
The naming is confusing: repositories have an `id` and a human readable
`name`. Weldr's sources also have a field called `name`, but
lorax-composer uses that as a way to identify repositories by their id.

Use `id` consistently here as well.
2019-11-18 12:22:10 +01:00
Lars Karlitski
740e4da733 rpmmd: move SourceToRepo to store
This removes the `store` dependency from `rpmmd`, which is the more
generic package.

It's also nicer to have this on a method of `SourceConfig`.
2019-11-18 12:22:10 +01:00
Ondřej Budai
cd5a192dfd 3 2019-11-15 17:22:20 +01:00
Martin Sehnoutka
b0698271b7 Revert "Fill in the license template"
This reverts commit ce6854d781 as I
understood the license text in a wrong way.
2019-11-15 15:26:51 +01:00
Jacob Kozol
e72004de56 api/tests: fix blueprints freeze test
The blueprints freeze test now creates the blueprint with the package
dep-package1 which is mocked and will properly depsolve when the
blueprint is frozen. This test can no longer run externally against
lorax-composer.
2019-11-15 15:24:39 +01:00
Jacob Kozol
6dbde1b5df api/tests: add blueprint freeze test
This test creates a new blueprint with libsemanage. Libsemanage is
already in the mock rpmmd so when we test the freeze route on this
blueprint, the blueprint will properly depsolve and return the package
with the depsolved version.
2019-11-15 00:25:18 +01:00
Jacob Kozol
c4088caee1 api: add blueprint freeze route
The blueprint freeze route returns the blueprint info but each
package will be the package selected by depsolving. So, instead of the
version being the version number with optional wildcards as
/blueprints/info would provide, the version is of the form
`Version-Release.Arch`.
2019-11-15 00:25:18 +01:00
Ondřej Budai
dd9a815c40 api: improve parity of /{modules,projects}/{list,info} routes
These endpoint are similar in many ways, therefore just one commit. Their
functionality is basically same as in lorax except for error messages and
weird edge cases when handling trailing slashes.

closes #64, closes #65
2019-11-15 00:23:24 +01:00
Ondřej Budai
2ed070b218 api: remove packages from api struct
This was probably forgotten in c882bebf
2019-11-15 00:23:24 +01:00
Jacob Kozol
5ffcb3fe6d api: add undo blueprint route
Add a route to set a blueprint back to its state at a particular change.
The route `blueprints/undo/:blueprint/:commit` requires the blueprint
name and the commit hash for the change that the blueprint should be
reverted too. Also, the commit message for the change created when a
blueprint is pushed is now passed from the api to the store's
PushBlueprint funtion.
2019-11-14 20:36:17 +01:00
Jacob Kozol
1b46a83522 store: add getBlueprintChange update blueprint commit message
Add function to get a single blueprint change given the blueprint name
and the commit hash. Update the PushBlueprint function to allow a commit
message to be passed to it which will be used when adding a change.
2019-11-14 20:36:17 +01:00
Jacob Kozol
c882bebfb4 remove packages from weldr API initialization
The package list is generated on each request for a package so there is
no longer a need to generate the package list in main or to store these
packages in the API object.
2019-11-14 12:16:07 +01:00
Jacob Kozol
6f4a7bacd2 api: fetch packages from sources and base repo
The package list is now generated from the base repo and the
user-defined repos. This allows users to add packages not found in the
base repo to their blueprints.
2019-11-14 12:16:07 +01:00
Jacob Kozol
085ba6fec9 rpmmd: convert sources to repos
Add function to convert between a user source and a repo which can be
passed to dnf-json. This is neccessary because user-defined sources have
a slightly different format than dnf repos.
2019-11-14 12:16:07 +01:00
Ondřej Budai
af73810a2d tests: fix failing tests due to a bad merge
I changed the API of weldr.New in 495f5b55 and Jacob added a new call of
that function in 9970150e, which created conflicting state.
2019-11-14 10:19:27 +01:00
Ondřej Budai
2cb7c8936e api/tests: test bodies for equality even if status codes are different
When developing tests it's nice to see all the differences at once.
2019-11-13 23:49:57 +01:00
Martin Sehnoutka
1fac27527b add more local boot test cases
1) additional qemu tests for ami, vmdk, vhd, and openstack image types
2) new type of systemd-nspawn tests for tar, ext4, and parititioned disk
types

the systemd-nspawn tests use loopback network interface directly from
the host so it is necessary to tweak the settings of its SSH server.
This is done in a "script" stage using simple "sed" command.
2019-11-13 21:06:49 +01:00
Ondřej Budai
306ca58588 spec: update to packaging guidelines
- %{_libexecdir}/osbuild-composer/ is good enough for listing the directory
  and its whole tree

- summary should not end with full stop
2019-11-13 19:37:28 +01:00
Ondřej Budai
36ccb110b3 api: add support for /projects/depsolve 2019-11-13 14:54:02 +01:00
Ondřej Budai
9076f68f7b rpmmd: Add error reporting support to dnf-json
Previously dnf-json hasn't been able to report any reports. This commit
tries to fix it with introduction of somewhat flexible error format.
2019-11-13 14:54:02 +01:00
Ondřej Budai
495f5b558b Add support for mocking rpmmd
We want to test API methods which calls dnf. Unfortunately, calling dnf
is expensive operation - it requires network access and downloading
a lot of (meta)data. This commit changes the rpmmd implementation
so that it can be mocked.
2019-11-13 14:54:02 +01:00